This commit is contained in:
2023-05-24 15:55:13 +08:00
7 changed files with 760 additions and 27 deletions

View File

@@ -0,0 +1,104 @@
package com.jsowell.web.controller.pile;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.jsowell.common.annotation.Log;
import com.jsowell.common.core.controller.BaseController;
import com.jsowell.common.core.domain.AjaxResult;
import com.jsowell.common.enums.BusinessType;
import com.jsowell.pile.domain.ThirdPartySettingInfo;
import com.jsowell.pile.service.IThirdPartySettingInfoService;
import com.jsowell.common.util.poi.ExcelUtil;
import com.jsowell.common.core.page.TableDataInfo;
/**
* 第三方平台配置Controller
*
* @author jsowell
* @date 2023-05-24
*/
@RestController
@RequestMapping("/pile/info")
public class ThirdPartySettingInfoController extends BaseController
{
@Autowired
private IThirdPartySettingInfoService thirdPartySettingInfoService;
/**
* 查询第三方平台配置列表
*/
@PreAuthorize("@ss.hasPermi('pile:info:list')")
@GetMapping("/list")
public TableDataInfo list(ThirdPartySettingInfo thirdPartySettingInfo)
{
startPage();
List<ThirdPartySettingInfo> list = thirdPartySettingInfoService.selectThirdPartySettingInfoList(thirdPartySettingInfo);
return getDataTable(list);
}
/**
* 导出第三方平台配置列表
*/
@PreAuthorize("@ss.hasPermi('pile:info:export')")
@Log(title = "第三方平台配置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ThirdPartySettingInfo thirdPartySettingInfo)
{
List<ThirdPartySettingInfo> list = thirdPartySettingInfoService.selectThirdPartySettingInfoList(thirdPartySettingInfo);
ExcelUtil<ThirdPartySettingInfo> util = new ExcelUtil<ThirdPartySettingInfo>(ThirdPartySettingInfo.class);
util.exportExcel(response, list, "第三方平台配置数据");
}
/**
* 获取第三方平台配置详细信息
*/
@PreAuthorize("@ss.hasPermi('pile:info:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(thirdPartySettingInfoService.selectThirdPartySettingInfoById(id));
}
/**
* 新增第三方平台配置
*/
@PreAuthorize("@ss.hasPermi('pile:info:add')")
@Log(title = "第三方平台配置", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ThirdPartySettingInfo thirdPartySettingInfo)
{
return toAjax(thirdPartySettingInfoService.insertThirdPartySettingInfo(thirdPartySettingInfo));
}
/**
* 修改第三方平台配置
*/
@PreAuthorize("@ss.hasPermi('pile:info:edit')")
@Log(title = "第三方平台配置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ThirdPartySettingInfo thirdPartySettingInfo)
{
return toAjax(thirdPartySettingInfoService.updateThirdPartySettingInfo(thirdPartySettingInfo));
}
/**
* 删除第三方平台配置
*/
@PreAuthorize("@ss.hasPermi('pile:info:remove')")
@Log(title = "第三方平台配置", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(thirdPartySettingInfoService.deleteThirdPartySettingInfoByIds(ids));
}
}

View File

@@ -0,0 +1,159 @@
package com.jsowell.pile.domain;
import com.jsowell.common.annotation.Excel;
import com.jsowell.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 第三方平台配置对象 thirdparty_setting_info
*
* @author jsowell
* @date 2023-05-24
*/
public class ThirdPartySettingInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private Long id;
/**
* 对接类型1-联联平台)
*/
@Excel(name = "对接类型", readConverterExp = "1=-联联平台")
private String type;
/**
* 站点id
*/
@Excel(name = "站点id")
private Long stationId;
/**
* 运营商id
*/
@Excel(name = "运营商id")
private String operatorId;
/**
* 运营商密钥
*/
@Excel(name = "运营商密钥")
private String operatorSecret;
/**
* 签名密钥
*/
@Excel(name = "签名密钥")
private String signSecret;
/**
* 消息密钥
*/
@Excel(name = "消息密钥")
private String dataSecret;
/**
* 消息密钥初始化向量
*/
@Excel(name = "消息密钥初始化向量")
private String dataSecretIv;
/**
* 删除标识
*/
private String delFlag;
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setType(String type) {
this.type = type;
}
public String getType() {
return type;
}
public void setStationId(Long stationId) {
this.stationId = stationId;
}
public Long getStationId() {
return stationId;
}
public void setOperatorId(String operatorId) {
this.operatorId = operatorId;
}
public String getOperatorId() {
return operatorId;
}
public void setOperatorSecret(String operatorSecret) {
this.operatorSecret = operatorSecret;
}
public String getOperatorSecret() {
return operatorSecret;
}
public void setSignSecret(String signSecret) {
this.signSecret = signSecret;
}
public String getSignSecret() {
return signSecret;
}
public void setDataSecret(String dataSecret) {
this.dataSecret = dataSecret;
}
public String getDataSecret() {
return dataSecret;
}
public void setDataSecretIv(String dataSecretIv) {
this.dataSecretIv = dataSecretIv;
}
public String getDataSecretIv() {
return dataSecretIv;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getDelFlag() {
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.JSON_STYLE)
.append("id", getId())
.append("type", getType())
.append("stationId", getStationId())
.append("operatorId", getOperatorId())
.append("operatorSecret", getOperatorSecret())
.append("signSecret", getSignSecret())
.append("dataSecret", getDataSecret())
.append("dataSecretIv", getDataSecretIv())
.append("createTime", getCreateTime())
.append("createBy", getCreateBy())
.append("updateTime", getUpdateTime())
.append("updateBy", getUpdateBy())
.append("delFlag", getDelFlag())
.toString();
}
}

View File

@@ -0,0 +1,71 @@
package com.jsowell.pile.mapper;
import java.util.List;
import com.jsowell.pile.domain.ThirdPartySettingInfo;
import org.springframework.stereotype.Component;
/**
* 第三方平台配置Mapper接口
*
* @author jsowell
* @date 2023-05-24
*/
@Component
public interface ThirdPartySettingInfoMapper {
/**
* 查询第三方平台配置
*
* @param id 第三方平台配置主键
* @return 第三方平台配置
*/
public ThirdPartySettingInfo selectThirdPartySettingInfoById(Long id);
/**
* 查询第三方平台配置列表
*
* @param thirdPartySettingInfo 第三方平台配置
* @return 第三方平台配置集合
*/
public List<ThirdPartySettingInfo> selectThirdPartySettingInfoList(ThirdPartySettingInfo thirdPartySettingInfo);
/**
* 新增第三方平台配置
*
* @param thirdPartySettingInfo 第三方平台配置
* @return 结果
*/
public int insertThirdPartySettingInfo(ThirdPartySettingInfo thirdPartySettingInfo);
/**
* 修改第三方平台配置
*
* @param thirdPartySettingInfo 第三方平台配置
* @return 结果
*/
public int updateThirdPartySettingInfo(ThirdPartySettingInfo thirdPartySettingInfo);
/**
* 删除第三方平台配置
*
* @param id 第三方平台配置主键
* @return 结果
*/
public int deleteThirdPartySettingInfoById(Long id);
/**
* 批量删除第三方平台配置
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteThirdPartySettingInfoByIds(Long[] ids);
/**
* 根据站点id 查询配置列表
*
* @param stationId
* @return
*/
public ThirdPartySettingInfo getInfoByStationId(Long stationId);
}

View File

@@ -0,0 +1,69 @@
package com.jsowell.pile.service;
import java.util.List;
import com.jsowell.pile.domain.ThirdPartySettingInfo;
/**
* 第三方平台配置Service接口
*
* @author jsowell
* @date 2023-05-24
*/
public interface IThirdPartySettingInfoService {
/**
* 查询第三方平台配置
*
* @param id 第三方平台配置主键
* @return 第三方平台配置
*/
public ThirdPartySettingInfo selectThirdPartySettingInfoById(Long id);
/**
* 查询第三方平台配置列表
*
* @param thirdPartySettingInfo 第三方平台配置
* @return 第三方平台配置集合
*/
public List<ThirdPartySettingInfo> selectThirdPartySettingInfoList(ThirdPartySettingInfo thirdPartySettingInfo);
/**
* 新增第三方平台配置
*
* @param thirdPartySettingInfo 第三方平台配置
* @return 结果
*/
public int insertThirdPartySettingInfo(ThirdPartySettingInfo thirdPartySettingInfo);
/**
* 修改第三方平台配置
*
* @param thirdPartySettingInfo 第三方平台配置
* @return 结果
*/
public int updateThirdPartySettingInfo(ThirdPartySettingInfo thirdPartySettingInfo);
/**
* 批量删除第三方平台配置
*
* @param ids 需要删除的第三方平台配置主键集合
* @return 结果
*/
public int deleteThirdPartySettingInfoByIds(Long[] ids);
/**
* 删除第三方平台配置信息
*
* @param id 第三方平台配置主键
* @return 结果
*/
public int deleteThirdPartySettingInfoById(Long id);
/**
* 根据站点id 查询配置列表
*
* @param stationId
* @return
*/
public ThirdPartySettingInfo getInfoByStationId(Long stationId);
}

View File

@@ -0,0 +1,101 @@
package com.jsowell.pile.service.impl;
import java.util.List;
import com.jsowell.common.util.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.jsowell.pile.mapper.ThirdPartySettingInfoMapper;
import com.jsowell.pile.domain.ThirdPartySettingInfo;
import com.jsowell.pile.service.IThirdPartySettingInfoService;
/**
* 第三方平台配置Service业务层处理
*
* @author jsowell
* @date 2023-05-24
*/
@Service
public class ThirdPartySettingInfoServiceImpl implements IThirdPartySettingInfoService {
@Autowired
private ThirdPartySettingInfoMapper thirdPartySettingInfoMapper;
/**
* 查询第三方平台配置
*
* @param id 第三方平台配置主键
* @return 第三方平台配置
*/
@Override
public ThirdPartySettingInfo selectThirdPartySettingInfoById(Long id) {
return thirdPartySettingInfoMapper.selectThirdPartySettingInfoById(id);
}
/**
* 查询第三方平台配置列表
*
* @param thirdPartySettingInfo 第三方平台配置
* @return 第三方平台配置
*/
@Override
public List<ThirdPartySettingInfo> selectThirdPartySettingInfoList(ThirdPartySettingInfo thirdPartySettingInfo) {
return thirdPartySettingInfoMapper.selectThirdPartySettingInfoList(thirdPartySettingInfo);
}
/**
* 新增第三方平台配置
*
* @param thirdPartySettingInfo 第三方平台配置
* @return 结果
*/
@Override
public int insertThirdPartySettingInfo(ThirdPartySettingInfo thirdPartySettingInfo) {
thirdPartySettingInfo.setCreateTime(DateUtils.getNowDate());
return thirdPartySettingInfoMapper.insertThirdPartySettingInfo(thirdPartySettingInfo);
}
/**
* 修改第三方平台配置
*
* @param thirdPartySettingInfo 第三方平台配置
* @return 结果
*/
@Override
public int updateThirdPartySettingInfo(ThirdPartySettingInfo thirdPartySettingInfo) {
thirdPartySettingInfo.setUpdateTime(DateUtils.getNowDate());
return thirdPartySettingInfoMapper.updateThirdPartySettingInfo(thirdPartySettingInfo);
}
/**
* 批量删除第三方平台配置
*
* @param ids 需要删除的第三方平台配置主键
* @return 结果
*/
@Override
public int deleteThirdPartySettingInfoByIds(Long[] ids) {
return thirdPartySettingInfoMapper.deleteThirdPartySettingInfoByIds(ids);
}
/**
* 删除第三方平台配置信息
*
* @param id 第三方平台配置主键
* @return 结果
*/
@Override
public int deleteThirdPartySettingInfoById(Long id) {
return thirdPartySettingInfoMapper.deleteThirdPartySettingInfoById(id);
}
/**
* 根据站点id 查询配置列表
*
* @param stationId
* @return
*/
@Override
public ThirdPartySettingInfo getInfoByStationId(Long stationId) {
return thirdPartySettingInfoMapper.getInfoByStationId(stationId);
}
}

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jsowell.pile.mapper.ThirdPartySettingInfoMapper">
<resultMap type="com.jsowell.pile.domain.ThirdPartySettingInfo" id="ThirdPartySettingInfoResult">
<result property="id" column="id" />
<result property="type" column="type" />
<result property="stationId" column="station_id" />
<result property="operatorId" column="operator_id" />
<result property="operatorSecret" column="operator_secret" />
<result property="signSecret" column="sign_secret" />
<result property="dataSecret" column="data_secret" />
<result property="dataSecretIv" column="data_secret_IV" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="delFlag" column="del_flag" />
</resultMap>
<sql id="selectThirdPartySettingInfoVo">
select id, type, station_id, operator_id, operator_secret, sign_secret, data_secret, data_secret_IV, create_time, create_by, update_time, update_by, del_flag from thirdparty_setting_info
</sql>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, type, station_id, operator_id, operator_secret, sign_secret, data_secret, data_secret_IV, create_time, create_by, update_time, update_by, del_flag
</sql>
<select id="selectThirdPartySettingInfoList" parameterType="com.jsowell.pile.domain.ThirdPartySettingInfo" resultMap="ThirdPartySettingInfoResult">
<include refid="selectThirdPartySettingInfoVo"/>
<where>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="stationId != null and stationId != ''"> and station_id = #{stationId}</if>
<if test="operatorId != null and operatorId != ''"> and operator_id = #{operatorId}</if>
<if test="operatorSecret != null and operatorSecret != ''"> and operator_secret = #{operatorSecret}</if>
<if test="signSecret != null and signSecret != ''"> and sign_secret = #{signSecret}</if>
<if test="dataSecret != null and dataSecret != ''"> and data_secret = #{dataSecret}</if>
<if test="dataSecretIv != null and dataSecretIv != ''"> and data_secret_IV = #{dataSecretIv}</if>
</where>
</select>
<select id="selectThirdPartySettingInfoById" parameterType="Long" resultMap="ThirdPartySettingInfoResult">
<include refid="selectThirdPartySettingInfoVo"/>
where id = #{id}
</select>
<insert id="insertThirdPartySettingInfo" parameterType="com.jsowell.pile.domain.ThirdPartySettingInfo" useGeneratedKeys="true" keyProperty="id">
insert into thirdparty_setting_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="type != null">type,</if>
<if test="stationId != null">station_id,</if>
<if test="operatorId != null">operator_id,</if>
<if test="operatorSecret != null">operator_secret,</if>
<if test="signSecret != null">sign_secret,</if>
<if test="dataSecret != null">data_secret,</if>
<if test="dataSecretIv != null">data_secret_IV,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="delFlag != null">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="type != null">#{type},</if>
<if test="stationId != null">#{stationId},</if>
<if test="operatorId != null">#{operatorId},</if>
<if test="operatorSecret != null">#{operatorSecret},</if>
<if test="signSecret != null">#{signSecret},</if>
<if test="dataSecret != null">#{dataSecret},</if>
<if test="dataSecretIv != null">#{dataSecretIv},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="delFlag != null">#{delFlag},</if>
</trim>
</insert>
<update id="updateThirdPartySettingInfo" parameterType="com.jsowell.pile.domain.ThirdPartySettingInfo">
update thirdparty_setting_info
<trim prefix="SET" suffixOverrides=",">
<if test="type != null">type = #{type},</if>
<if test="stationId != null">station_id = #{stationId},</if>
<if test="operatorId != null">operator_id = #{operatorId},</if>
<if test="operatorSecret != null">operator_secret = #{operatorSecret},</if>
<if test="signSecret != null">sign_secret = #{signSecret},</if>
<if test="dataSecret != null">data_secret = #{dataSecret},</if>
<if test="dataSecretIv != null">data_secret_IV = #{dataSecretIv},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteThirdPartySettingInfoById" parameterType="Long">
delete from thirdparty_setting_info where id = #{id}
</delete>
<delete id="deleteThirdPartySettingInfoByIds" parameterType="String">
delete from thirdparty_setting_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="getInfoByStationId" resultMap="ThirdPartySettingInfoResult">
select <include refid="Base_Column_List"/>
from thirdparty_setting_info
where station_id = #{stationId,jdbcType=BIGINT}
</select>
</mapper>

View File

@@ -28,6 +28,7 @@ import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO;
import com.jsowell.pile.vo.uniapp.BillingPriceVO;
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
import com.jsowell.pile.vo.web.PileModelInfoVO;
import com.jsowell.pile.vo.web.PileStationVO;
import com.jsowell.thirdparty.domain.*;
import com.jsowell.thirdparty.service.LianLianService;
import com.jsowell.thirdparty.vo.*;
@@ -42,11 +43,11 @@ import java.util.stream.Collectors;
@Service
public class LianLianServiceImpl implements LianLianService {
private static final String TEST_URL = "http://dataexchange.evchargeonline.com:81/shevcs/v1/"; // http://testdataexchange.evchargeonline.com:82/shevcs/v1/
private static final String OPERATOR_ID = "MA1JLFUU8"; // MA1JLFUU8 987654321
private static final String OPERATOR_SECRET = "fGwLsxW1HdzLw7jp"; // fGwLsxW1HdzLw7jp 1234567890abcdef
private static final String SIG_SECRET = "TmsdVaFVTtjzZbLi"; // 签名秘钥 TmsdVaFVTtjzZbLi 1234567890abcdef
private static final String DATA_SECRET = "R1Hdq80mSWswwCzt"; // 消息密钥 R1Hdq80mSWswwCzt 1234567890abcdef
private static final String DATA_SECRETIV = "LVpz3qHD8sM2PYjl"; // 消息密钥初始化向量 LVpz3qHD8sM2PYjl 1234567890abcdef
// private static final String OPERATOR_ID = "MA1JLFUU8"; // MA1JLFUU8 987654321
// private static final String OPERATOR_SECRET = "fGwLsxW1HdzLw7jp"; // fGwLsxW1HdzLw7jp 1234567890abcdef
// private static final String SIG_SECRET = "TmsdVaFVTtjzZbLi"; // 签名秘钥 TmsdVaFVTtjzZbLi 1234567890abcdef
// private static final String DATA_SECRET = "R1Hdq80mSWswwCzt"; // 消息密钥 R1Hdq80mSWswwCzt 1234567890abcdef
// private static final String DATA_SECRETIV = "LVpz3qHD8sM2PYjl"; // 消息密钥初始化向量 LVpz3qHD8sM2PYjl 1234567890abcdef
@Autowired
private IPileMerchantInfoService pileMerchantInfoService;
@@ -72,6 +73,9 @@ public class LianLianServiceImpl implements LianLianService {
@Autowired
private IPileBillingTemplateService pileBillingTemplateService;
@Autowired
private IThirdPartySettingInfoService thirdPartySettingInfoService;
@Override
public void pushMerchantInfo(Long merchantId) {
// 通过id查询运营商信息
@@ -101,10 +105,21 @@ public class LianLianServiceImpl implements LianLianService {
// 通过id查询站点相关信息
PileStationInfo pileStationInfo = pileStationInfoService.selectPileStationInfoById(dto.getStationId());
// 通过站点id查询相关配置信息
ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(dto.getStationId());
if (settingInfo == null) {
return;
}
String operatorId = settingInfo.getOperatorId();
String operatorSecret = settingInfo.getOperatorSecret();
String signSecret = settingInfo.getSignSecret();
String dataSecret = settingInfo.getDataSecret();
String dataSecretIv = settingInfo.getDataSecretIv();
// 组装联联平台所需要的数据格式
StationInfo info = StationInfo.builder()
.stationID(String.valueOf(dto.getStationId()))
.operatorID(dto.getOperatorID())
.operatorID(operatorId)
.equipmentOwnerID(Constants.OPERATORID_LIANLIAN)
.stationName(pileStationInfo.getStationName())
.isAloneApply(Integer.valueOf(pileStationInfo.getAloneApply()))
@@ -157,9 +172,9 @@ public class LianLianServiceImpl implements LianLianService {
System.out.println("jsonString : " + jsonString);
// 获取令牌
String token = getToken(dto.getOperatorID(), OPERATOR_SECRET);
String result = HttpRequestUtil.sendPost(token, jsonString, url, dto.getDataSecret()
, dto.getDataSecretIV(), dto.getOperatorID(), dto.getSigSecret());
String token = getToken(operatorId, operatorSecret);
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret
, dataSecretIv, operatorId, signSecret);
System.out.println(result);
@@ -632,10 +647,24 @@ public class LianLianServiceImpl implements LianLianService {
*/
@Override
public String pushConnectorStatus(String pileConnectorCode, String status) {
// 查出该桩所属哪个站点
String pileSn = StringUtils.substring(pileConnectorCode, 0, 16);
PileStationVO stationVO = pileStationInfoService.getStationInfoByPileSn(pileSn);
// 通过站点id查询相关配置信息
ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(stationVO.getId()));
if (settingInfo == null) {
return null;
}
String operatorId = settingInfo.getOperatorId();
String operatorSecret = settingInfo.getOperatorSecret();
String signSecret = settingInfo.getSignSecret();
String dataSecret = settingInfo.getDataSecret();
String dataSecretIv = settingInfo.getDataSecretIv();
String url = TEST_URL + "notification_stationStatus";
// 获取令牌
String token = getToken(OPERATOR_ID, OPERATOR_SECRET);
String token = getToken(operatorId, operatorSecret);
if (StringUtils.isBlank(token)) {
return null;
}
@@ -648,7 +677,7 @@ public class LianLianServiceImpl implements LianLianService {
json.put("ConnectorStatusInfo", info);
String jsonString = JSONObject.toJSONString(json);
String result = HttpRequestUtil.sendPost(token, jsonString, url, DATA_SECRET, DATA_SECRETIV, OPERATOR_ID, SIG_SECRET);
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
return result;
}
@@ -665,12 +694,23 @@ public class LianLianServiceImpl implements LianLianService {
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
// 通过站点id查询相关配置信息
ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderBasicInfo.getStationId()));
if (settingInfo == null) {
return null;
}
String operatorId = settingInfo.getOperatorId();
String operatorSecret = settingInfo.getOperatorSecret();
String signSecret = settingInfo.getSignSecret();
String dataSecret = settingInfo.getDataSecret();
String dataSecretIv = settingInfo.getDataSecretIv();
String url = TEST_URL + "notification_orderInfo";
// 拼装成联联平台所需格式对象
OrderInfo orderInfo = OrderInfo.builder()
.operatorID(OPERATOR_ID)
.equipmentOwnerID(OPERATOR_ID)
.operatorID(operatorId)
.equipmentOwnerID(Constants.OPERATORID_LIANLIAN)
.stationID(orderBasicInfo.getStationId())
.equipmentID(orderBasicInfo.getPileSn())
.connectorID(orderBasicInfo.getPileConnectorCode())
@@ -750,7 +790,7 @@ public class LianLianServiceImpl implements LianLianService {
orderInfo.setChargeDetails(chargeDetails);
// 获取令牌
String token = getToken(OPERATOR_ID, OPERATOR_SECRET);
String token = getToken(operatorId, operatorSecret);
if (StringUtils.isBlank(token)) {
return null;
}
@@ -759,7 +799,7 @@ public class LianLianServiceImpl implements LianLianService {
json.put("OrderInfo", orderInfo);
String jsonString = JSONObject.toJSONString(json);
String result = HttpRequestUtil.sendPost(token, jsonString, url, DATA_SECRET, DATA_SECRETIV, OPERATOR_ID, SIG_SECRET);
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
return result;
}
@@ -776,10 +816,21 @@ public class LianLianServiceImpl implements LianLianService {
if (orderInfo == null) {
return null;
}
// 通过站点id查询相关配置信息
ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderInfo.getStationId()));
if (settingInfo == null) {
return null;
}
String operatorId = settingInfo.getOperatorId();
String operatorSecret = settingInfo.getOperatorSecret();
String signSecret = settingInfo.getSignSecret();
String dataSecret = settingInfo.getDataSecret();
String dataSecretIv = settingInfo.getDataSecretIv();
// 推送启动充电结果(调用接口 notification_start_charge_result)
String url = TEST_URL + "notification_start_charge_result";
// 获取令牌
String token = getToken(OPERATOR_ID, OPERATOR_SECRET);
String token = getToken(operatorId, operatorSecret);
if (StringUtils.isBlank(token)) {
return null;
}
@@ -804,7 +855,7 @@ public class LianLianServiceImpl implements LianLianService {
String jsonString = JSONObject.toJSONString(json);
String result = HttpRequestUtil.sendPost(token, jsonString, url, DATA_SECRET, DATA_SECRETIV, OPERATOR_ID, SIG_SECRET);
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
return result;
}
@@ -816,10 +867,23 @@ public class LianLianServiceImpl implements LianLianService {
*/
@Override
public String pushChargeStatus(String orderCode) {
// 根据订单号查询订单信息
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
// 通过站点id查询相关配置信息
ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderInfo.getStationId()));
if (settingInfo == null) {
return null;
}
String operatorId = settingInfo.getOperatorId();
String operatorSecret = settingInfo.getOperatorSecret();
String signSecret = settingInfo.getSignSecret();
String dataSecret = settingInfo.getDataSecret();
String dataSecretIv = settingInfo.getDataSecretIv();
// 调用 查询充电状态方法
QueryChargingStatusVO vo = query_equip_charge_status(orderCode);
// 获取令牌
String token = getToken(OPERATOR_ID, OPERATOR_SECRET);
String token = getToken(operatorId, operatorSecret);
if (StringUtils.isBlank(token)) {
return null;
}
@@ -827,7 +891,7 @@ public class LianLianServiceImpl implements LianLianService {
// 调用联联平台接口
String jsonString = JSONObject.toJSONString(vo);
String result = HttpRequestUtil.sendPost(token, jsonString, url, DATA_SECRET, DATA_SECRETIV, OPERATOR_ID, SIG_SECRET);
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
return result;
}
@@ -845,6 +909,17 @@ public class LianLianServiceImpl implements LianLianService {
if (orderInfo == null) {
return null;
}
// 通过站点id查询相关配置信息
ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderInfo.getStationId()));
if (settingInfo == null) {
return null;
}
String operatorId = settingInfo.getOperatorId();
String operatorSecret = settingInfo.getOperatorSecret();
String signSecret = settingInfo.getSignSecret();
String dataSecret = settingInfo.getDataSecret();
String dataSecretIv = settingInfo.getDataSecretIv();
String orderStatus = orderInfo.getOrderStatus();
String successFlag = "1";
if (StringUtils.equals(orderStatus, OrderStatusEnum.IN_THE_CHARGING.getValue())) {
@@ -858,7 +933,7 @@ public class LianLianServiceImpl implements LianLianService {
orderStatus = "5";
}
// 获取token
String token = getToken(OPERATOR_ID, OPERATOR_SECRET);
String token = getToken(operatorId, operatorSecret);
if (StringUtils.isBlank(token)) {
return null;
}
@@ -874,7 +949,7 @@ public class LianLianServiceImpl implements LianLianService {
String jsonString = JSONObject.toJSONString(json);
// 发送请求
String result = HttpRequestUtil.sendPost(token, jsonString, url, DATA_SECRET, DATA_SECRETIV, OPERATOR_ID, SIG_SECRET);
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
return result;
}
@@ -890,6 +965,17 @@ public class LianLianServiceImpl implements LianLianService {
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
// 通过站点id查询相关配置信息
ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderBasicInfo.getStationId()));
if (settingInfo == null) {
return null;
}
String operatorId = settingInfo.getOperatorId();
String operatorSecret = settingInfo.getOperatorSecret();
String signSecret = settingInfo.getSignSecret();
String dataSecret = settingInfo.getDataSecret();
String dataSecretIv = settingInfo.getDataSecretIv();
JSONObject json = new JSONObject();
json.put("StartChargeSeq", orderCode);
json.put("ConnectorID", orderBasicInfo.getPileConnectorCode());
@@ -902,12 +988,12 @@ public class LianLianServiceImpl implements LianLianService {
json.put("StopReason", 2); // 2BMS 停止充电
String jsonString = JSONObject.toJSONString(json);
String token = getToken(OPERATOR_ID, OPERATOR_SECRET);
String token = getToken(operatorId, operatorSecret);
if (token == null) {
return null;
}
// 发送请求
String result = HttpRequestUtil.sendPost(token, jsonString, url, DATA_SECRET, DATA_SECRETIV, OPERATOR_ID, SIG_SECRET);
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
return result;
}
@@ -954,13 +1040,27 @@ public class LianLianServiceImpl implements LianLianService {
JSONObject json = new JSONObject();
json.put("StartChargeSeq", orderCode);
String jsonString = JSONObject.toJSONString(json);
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
// 通过站点id查询相关配置信息
ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderBasicInfo.getStationId()));
if (settingInfo == null) {
return null;
}
String operatorId = settingInfo.getOperatorId();
String operatorSecret = settingInfo.getOperatorSecret();
String signSecret = settingInfo.getSignSecret();
String dataSecret = settingInfo.getDataSecret();
String dataSecretIv = settingInfo.getDataSecretIv();
// 获取令牌
String token = getToken(OPERATOR_ID, OPERATOR_SECRET);
String token = getToken(operatorId, operatorSecret);
if (StringUtils.isBlank(token)){
return null;
}
// 发送请求
String result = HttpRequestUtil.sendPost(token, jsonString, url, DATA_SECRET, DATA_SECRETIV, OPERATOR_ID, SIG_SECRET);
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
return result;
}
@@ -980,6 +1080,18 @@ public class LianLianServiceImpl implements LianLianService {
if (orderInfo == null || orderDetail == null) {
return null;
}
// 通过站点id查询相关配置信息
ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderInfo.getStationId()));
if (settingInfo == null) {
return null;
}
String operatorId = settingInfo.getOperatorId();
String operatorSecret = settingInfo.getOperatorSecret();
String signSecret = settingInfo.getSignSecret();
String dataSecret = settingInfo.getDataSecret();
String dataSecretIv = settingInfo.getDataSecretIv();
JSONObject json = new JSONObject();
json.put("CheckOrderSeq", orderCode);
json.put("StartTime", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderInfo.getChargeStartTime()));
@@ -997,13 +1109,13 @@ public class LianLianServiceImpl implements LianLianService {
json.put("ChargeOrders", list);
// 获取令牌
String token = getToken(OPERATOR_ID, OPERATOR_SECRET);
String token = getToken(operatorId, operatorSecret);
if (StringUtils.isBlank(token)){
return null;
}
String jsonString = JSONObject.toJSONString(json);
// 发送请求
String result = HttpRequestUtil.sendPost(token, jsonString, url, DATA_SECRET, DATA_SECRETIV, OPERATOR_ID, SIG_SECRET);
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
return result;
}