diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationStopChargeResultTask.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationStopChargeResultTask.java index dad5b675..de0cecd8 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationStopChargeResultTask.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationStopChargeResultTask.java @@ -55,26 +55,28 @@ public class NotificationStopChargeResultTask extends CoreDispatcher { Boolean isStopNotified = (Boolean) pushOrder.get("isStopNotified"); if (isStopNotified == null || !isStopNotified) { String internetSerialNumber = (String) pushOrder.get("internetSerialNumber"); - String operatorId3rdpty = internetSerialNumber.substring(0, 9); - AuthSecretToken authSecretTokenOut = - authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType(operatorId3rdpty, - SECRET_TOKEN_TYPE_OUT).orElse(null); - CommonRequest commonRequest = new CommonRequest<>(); - ChargeResultRequest chargeResultRequest = new ChargeResultRequest(); - chargeResultRequest.setStartChargeSeq(internetSerialNumber); - //使用指定包装类封装数据 - chargeResultRequest.setConnectorID(orderkey.substring(0, 16)); - chargeResultRequest.setStartChargeSeqStat(4); - chargeResultRequest.setSuccStat(0); - chargeResultRequest.setFailReason(3); - //将其转换为json - String jsonData = JSONUtil.toJSONString(chargeResultRequest); - commonRequest.setData(jsonData); - String result = ok(commonRequest, "/notification_stop_charge_result", authSecretTokenOut); - ChargeResultResponse chargeResultResponse = DTOJsonHelper.parseResponseData(result, - ChargeResultResponse.class, authSecretTokenOut); - pushOrder.put("isStopNotified", true); - REDIS.setCacheMap(pushOrderKey, pushOrder); + if (internetSerialNumber != null) { + String operatorId3rdpty = internetSerialNumber.substring(0, 9); + AuthSecretToken authSecretTokenOut = + authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType(operatorId3rdpty, + SECRET_TOKEN_TYPE_OUT).orElse(null); + CommonRequest commonRequest = new CommonRequest<>(); + ChargeResultRequest chargeResultRequest = new ChargeResultRequest(); + chargeResultRequest.setStartChargeSeq(internetSerialNumber); + //使用指定包装类封装数据 + chargeResultRequest.setConnectorID(orderkey.substring(0, 16)); + chargeResultRequest.setStartChargeSeqStat(4); + chargeResultRequest.setSuccStat(0); + chargeResultRequest.setFailReason(3); + //将其转换为json + String jsonData = JSONUtil.toJSONString(chargeResultRequest); + commonRequest.setData(jsonData); + String result = ok(commonRequest, "/notification_stop_charge_result", authSecretTokenOut); + ChargeResultResponse chargeResultResponse = DTOJsonHelper.parseResponseData(result, + ChargeResultResponse.class, authSecretTokenOut); + pushOrder.put("isStopNotified", true); + REDIS.setCacheMap(pushOrderKey, pushOrder); + } } } } diff --git a/xhpc-modules/xhpc-order/src/main/resources/bootstrap.yml b/xhpc-modules/xhpc-order/src/main/resources/bootstrap.yml index 5571b791..dde4d751 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/bootstrap.yml +++ b/xhpc-modules/xhpc-order/src/main/resources/bootstrap.yml @@ -14,10 +14,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: 127.0.0.1:8848 + server-addr: 172.31.183.135:8848 config: # 配置中心地址 - server-addr: 127.0.0.1:8848 + server-addr: 172.31.183.135:8848 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RealtimeDataLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RealtimeDataLogic.java index fdc8fab0..6cb56ef7 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RealtimeDataLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RealtimeDataLogic.java @@ -230,7 +230,10 @@ public class RealtimeDataLogic implements ServiceLogic { } else { log.error("abnormal.2.2 order[{}]", orderNo); cacheOrder.put("abnormal", "2.2");//not respond - REDIS.setCacheMapValue(orderkey.replace("order:", "pushOrder:"), "startChargeSeqStat", 4); + String pushOrderKey = orderkey.replace("order:", "pushOrder:"); + if (REDIS.getCacheMap(pushOrderKey) != null) { + REDIS.setCacheMapValue(pushOrderKey, "startChargeSeqStat", 4); + } } orderNo = orderkey.replace("order:", ""); pileOrderService.abnormalOrder(orderNo); diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RemoteStartReplyDataLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RemoteStartReplyDataLogic.java index bcd896e2..6a7c7e68 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RemoteStartReplyDataLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RemoteStartReplyDataLogic.java @@ -56,6 +56,8 @@ public class RemoteStartReplyDataLogic implements ServiceLogic { Map cacheGun = REDIS.getCacheMap(gunkey); REDIS.setCacheMap(orderkey, cacheOrder); REDIS.setCacheMap(gunkey, cacheGun); + String pushOrderKey = orderkey.replace("order:", "pushOrder:"); + Map pushOrder = REDIS.getCacheMap(pushOrderKey); if (HEX_01.equals(remoteStartReplyData.getStartResult())) { final String orderstarttime = DateUtil.format(Calendar.getInstance().getTime(), NORM_DATETIME_FORMAT); cacheGun.put("orderstarttime", orderstarttime); @@ -65,11 +67,15 @@ public class RemoteStartReplyDataLogic implements ServiceLogic { REDIS.setCacheMap(gunkey, cacheGun); REDIS.setCacheMap(orderkey, cacheOrder); pileOrderService.pileStartup(orderNo, 1, "启动充电成功"); - REDIS.setCacheMapValue(orderkey.replace("order:", "pushOrder:"), "startChargeSeqStat", 2); + if (pushOrder != null) { + REDIS.setCacheMapValue(pushOrderKey, "startChargeSeqStat", 2); + } } else { - REDIS.setCacheMapValue(orderkey.replace("order:", "pushOrder:"), "startChargeSeqStat", 4); final String remark = frs.get(remoteStartReplyData.getFailReason()); pileOrderService.pileStartup(orderNo, 2, remark == null ? "未知错误" : remark); + if (pushOrder != null) { + REDIS.setCacheMapValue(pushOrderKey, "startChargeSeqStat", 4); + } } return new ServiceResult(false); }