mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-05 18:40:14 +08:00
发送停止充电指令时,校验交易流水号是否一致
This commit is contained in:
@@ -204,7 +204,7 @@ public class OrderService {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_ORDER_PILE_MAPPING_ERROR);
|
||||
}
|
||||
// push远程停机指令
|
||||
pileRemoteService.remoteStopCharging(dto.getPileSn(), dto.getConnectorCode());
|
||||
pileRemoteService.remoteStopCharging(dto.getPileSn(), dto.getConnectorCode(), orderBasicInfo.getTransactionCode());
|
||||
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ public class OrderService {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_ORDER_MEMBER_NOT_MATCH_ERROR);
|
||||
}
|
||||
// 发送停止指令
|
||||
pileRemoteService.remoteStopCharging(orderInfo.getPileSn(), orderInfo.getConnectorCode());
|
||||
pileRemoteService.remoteStopCharging(orderInfo.getPileSn(), orderInfo.getConnectorCode(), orderInfo.getTransactionCode());
|
||||
log.info("订单号:{}发送停机指令成功", dto.getOrderCode());
|
||||
}
|
||||
|
||||
@@ -721,7 +721,7 @@ public class OrderService {
|
||||
orderLogic.settleOrder(data, orderBasicInfo);
|
||||
|
||||
// 发送停止充电指令
|
||||
pileRemoteService.remoteStopCharging(orderBasicInfo.getPileSn(), orderBasicInfo.getConnectorCode());
|
||||
pileRemoteService.remoteStopCharging(orderBasicInfo.getPileSn(), orderBasicInfo.getConnectorCode(), orderBasicInfo.getTransactionCode());
|
||||
|
||||
log.info("人工结算订单-end orderCode:{}", dto.getOrderCode());
|
||||
return true;
|
||||
|
||||
@@ -95,7 +95,7 @@ public class PileRemoteController extends BaseController {
|
||||
if (StringUtils.isBlank(dto.getPileSn()) || StringUtils.isBlank(dto.getConnectorCode())) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||
}
|
||||
pileRemoteService.remoteStopCharging(dto.getPileSn(), dto.getConnectorCode());
|
||||
pileRemoteService.remoteStopCharging(dto.getPileSn(), dto.getConnectorCode(), null);
|
||||
ajaxResult = AjaxResult.success();
|
||||
} catch (BusinessException e) {
|
||||
ajaxResult = AjaxResult.error(e.getCode(), e.getMessage());
|
||||
|
||||
@@ -119,6 +119,6 @@ public class RealTimeMonitorData {
|
||||
private String dateTime;
|
||||
|
||||
public String getPileConnectorCode() {
|
||||
return this.pileSn + this.getConnectorCode();
|
||||
return this.pileSn + this.connectorCode;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.jsowell.pile.service;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.jsowell.common.constant.CacheConstants;
|
||||
import com.jsowell.common.core.redis.RedisCache;
|
||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
@@ -38,7 +40,8 @@ public class PileRemoteService {
|
||||
@Autowired
|
||||
private PileFirmwareInfoService pileFirmwareInfoService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
/**
|
||||
* 获取充电桩实时数据信息
|
||||
*
|
||||
@@ -89,9 +92,13 @@ public class PileRemoteService {
|
||||
/**
|
||||
* 远程停止充电
|
||||
*/
|
||||
public void remoteStopCharging(String pileSn, String connectorCode) {
|
||||
public void remoteStopCharging(String pileSn, String connectorCode, String transactionCode) {
|
||||
// TODO 获取充电桩0x13数据,校验交易流水号是否一致
|
||||
|
||||
String pileIsChargingKey = CacheConstants.PILE_IS_CHARGING + pileSn + connectorCode;
|
||||
String redisResult = redisCache.getCacheObject(pileIsChargingKey);
|
||||
if (!StringUtils.equals(redisResult, transactionCode)) {
|
||||
return;
|
||||
}
|
||||
StopChargingCommand command = StopChargingCommand.builder()
|
||||
.pileSn(pileSn)
|
||||
.connectorCode(connectorCode)
|
||||
|
||||
@@ -569,7 +569,7 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
||||
redisCache.hset(redisKey, DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:00", now), jsonMsg);
|
||||
|
||||
// 把充电桩正在充电中的状态存到redis
|
||||
String pileIsChargingKey = CacheConstants.PILE_IS_CHARGING + realTimeMonitorData.getPileSn();
|
||||
String pileIsChargingKey = CacheConstants.PILE_IS_CHARGING + realTimeMonitorData.getPileConnectorCode();
|
||||
redisCache.setCacheObject(pileIsChargingKey, realTimeMonitorData.getTransactionCode(), 12);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user