修复QueryStopCharge接口的pushOrder逻辑
This commit is contained in:
parent
24a1d74cf2
commit
1917760e11
@ -19,7 +19,6 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
@ -82,16 +81,15 @@ public class QueryStopChargeController {
|
||||
String pileNum = connectorId.substring(0, connectorId.length() - 2);
|
||||
//从数据库中查询对应的桩的版本信息
|
||||
XhpcChargingPile pileInfo = XhpcChargingPileRepository.findBySerialNumber(pileNum).orElse(null);
|
||||
String versionNum = null;
|
||||
if (pileInfo != null) {
|
||||
versionNum = pileInfo.getCommunicationProtocolVersion();
|
||||
}
|
||||
|
||||
String versionNum = pileInfo.getCommunicationProtocolVersion() != null ? pileInfo.getCommunicationProtocolVersion() : "0A";
|
||||
//给对应的枪发送停止充电指令
|
||||
R r = powerPileService.stopCharging(xhOrderNo, pileNum, connectorId, versionNum);
|
||||
|
||||
// 判断停止指令发送是否成功
|
||||
if (r.getCode() != 200) {
|
||||
//向redis中放入停止充电指令没有下发成功的标识
|
||||
Map<String, Object> pushOrder = REDIS.getCacheMap("pushOrder:".concat(xhOrderNo));
|
||||
pushOrder.put("stopCommandSent", false);
|
||||
REDIS.setCacheMap("pushOrder:".concat(xhOrderNo), pushOrder);
|
||||
//充电订单状态
|
||||
queryStopChargeResponse.setStartChargeSeqStat(5);
|
||||
//操作结果
|
||||
@ -128,14 +126,17 @@ public class QueryStopChargeController {
|
||||
commonResponse.setRet("1");
|
||||
commonResponse.setMsg("请求停止充电失败");
|
||||
commonResponse.setData(data);
|
||||
|
||||
}
|
||||
|
||||
//设置该订单已经被停止的标识
|
||||
Map<String, Object> order = REDIS.getCacheMap("order:" + xhOrderNo);
|
||||
order.replace("status", "已结束");
|
||||
REDIS.setCacheMap("order:" + xhOrderNo, order);
|
||||
HashMap<String, Object> pushOrder = new HashMap<>(16);
|
||||
|
||||
Map<String, Object> pushOrder = REDIS.getCacheMap("pushOrder:".concat(xhOrderNo));
|
||||
pushOrder.put("stopCommandSent", true);
|
||||
pushOrder.put("operatorId3rdpty", startChargeSeq.substring(0, 9));
|
||||
REDIS.setCacheMap("pushOrder:".concat(xhOrderNo), pushOrder);
|
||||
|
||||
//充电订单状态
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user