update 联联平台请求停止充电接口

This commit is contained in:
Lemon
2023-05-31 15:33:50 +08:00
parent f310d4f022
commit 40a46fc07b
3 changed files with 65 additions and 16 deletions

View File

@@ -73,7 +73,7 @@ public interface LianLianService {
* @param dto
* @return
*/
QueryStopChargeVO query_stop_charge(QueryStartChargeDTO dto);
Map<String, String> query_stop_charge(QueryStartChargeDTO dto);
/**
* 联联平台获取令牌

View File

@@ -682,7 +682,7 @@ public class LianLianServiceImpl implements LianLianService {
* @param dto
* @return
*/
public QueryStopChargeVO query_stop_charge(QueryStartChargeDTO dto) {
public Map<String, String> query_stop_charge(QueryStartChargeDTO dto) {
QueryStopChargeVO vo = new QueryStopChargeVO();
String orderCode = dto.getStartChargeSeq();
@@ -690,7 +690,11 @@ public class LianLianServiceImpl implements LianLianService {
// 根据订单号查询订单信息
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
if (orderInfo == null) {
throw new BusinessException("", "");
return null;
}
DockingPlatformConfig configInfo = dockingPlatformConfigService.getInfoByOperatorId(dto.getOperatorID());
if (configInfo == null) {
return null;
}
// 若状态为充电中,则发送停机指令
if (StringUtils.equals(OrderStatusEnum.IN_THE_CHARGING.getValue(), orderInfo.getOrderStatus())) {
@@ -703,7 +707,19 @@ public class LianLianServiceImpl implements LianLianService {
vo.setStartChargeSeq(orderCode);
vo.setStartChargeSeqStat(3); // 3-停止中
}
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;
}
/**