update 联联平台请求启动充电接口

This commit is contained in:
Lemon
2023-05-31 14:43:58 +08:00
parent 20b95f4c3c
commit d8ef3022fa
5 changed files with 74 additions and 20 deletions

View File

@@ -60,7 +60,7 @@ public interface LianLianService {
* @param dto
* @return
*/
QueryStartChargeVO query_start_charge(QueryStartChargeDTO dto);
Map<String, String> query_start_charge(QueryStartChargeDTO dto);
/**
* 查询充电状态

View File

@@ -551,22 +551,25 @@ public class LianLianServiceImpl implements LianLianService {
*
* @param dto
*/
public QueryStartChargeVO query_start_charge(QueryStartChargeDTO dto) {
public Map<String, String> query_start_charge(QueryStartChargeDTO dto) {
// 通过传过来的订单号和枪口号生成订单
// String orderCode = dto.getStartChargeSeq();
String pileConnectorCode = dto.getConnectorID();
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(dto.getStartChargeSeq());
if (orderInfo != null) {
// 平台已存在订单
throw new BusinessException("", "平台已存在订单");
return null;
}
DockingPlatformConfig configInfo = dockingPlatformConfigService.getInfoByOperatorId(dto.getOperatorID());
if (configInfo == null) {
return null;
}
Map<String, Object> map = orderBasicInfoService.generateOrderForLianLian(dto);
String orderCode = (String) map.get("orderCode");
String transactionCode = (String) map.get("transactionCode");
OrderBasicInfo orderBasicInfo = (OrderBasicInfo) map.get("orderBasicInfo");
// 发送启机指令
StartChargingCommand command = StartChargingCommand.builder()
.pileSn(orderBasicInfo.getPileSn())
.connectorCode(orderBasicInfo.getConnectorCode())
@@ -589,8 +592,19 @@ public class LianLianServiceImpl implements LianLianService {
// 推送启动充电结果
pushStartChargeResult(orderCode);
return vo;
// 加密
Map<String, String> resultMap = Maps.newLinkedHashMap();
// 加密数据
byte[] encryptText = Cryptos.aesEncrypt(JSONObject.toJSONString(vo).getBytes(),
configInfo.getOperatorSecret().getBytes(), configInfo.getDataSecretIv().getBytes());
String encryptData = Encodes.encodeBase64(encryptText);
resultMap.put("Data", encryptData);
// 生成sig
String resultSign = GBSignUtils.sign(resultMap, configInfo.getOperatorSecret());
resultMap.put("Sig", resultSign);
return resultMap;
}