mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-22 20:15:06 +08:00
发送停止充电指令时,校验交易流水号是否一致
This commit is contained in:
@@ -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