From 69f2cec277f57916662f6b615fe3a39ae714018f Mon Sep 17 00:00:00 2001 From: panshuling321 Date: Wed, 24 Aug 2022 11:25:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=94=99=E8=AF=AF=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=A4=84=E7=90=86=E4=B9=8B=E5=89=8D=E5=AF=B9?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=A0=BC=E5=BC=8F=E7=9A=84=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xhpc/evcs/api/QueryStationStatusController.java | 1 - .../NotificationChargeOrderInfo4BonusTask.java | 5 +++++ .../notification/NotificationChargeOrderInfoTask.java | 8 +++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/QueryStationStatusController.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/QueryStationStatusController.java index 46181882..cba28ffb 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/QueryStationStatusController.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/QueryStationStatusController.java @@ -22,7 +22,6 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfo4BonusTask.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfo4BonusTask.java index 179ac956..66ec3bb1 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfo4BonusTask.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfo4BonusTask.java @@ -76,6 +76,11 @@ public class NotificationChargeOrderInfo4BonusTask extends CoreDispatcher { if (operatorIdEvcs == null) { Long chargingStationId = xhpcHistoryOrder.getChargingStationId(); XhpcChargingStation station = chargingStationRepo.findById(chargingStationId).orElse(null); + if(station == null){ + logger.error("station[{}] is not exits", chargingStationId); + return false; + } + String stationOperatorIdEvcs = station.getOperatorIdEvcs(); if (stationOperatorIdEvcs == null) { logger.error("station[{}] operator id evcs not set", chargingStationId); diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfoTask.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfoTask.java index 0ba116cc..470f7d7f 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfoTask.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfoTask.java @@ -45,7 +45,13 @@ public class NotificationChargeOrderInfoTask extends CoreDispatcher { Collection orderKeys = REDIS.keys("order:*"); Instant now = Instant.now(); for (String okey : orderKeys) { - Date otime = DateUtil.orderNo2Date(okey.substring(6)); + String orderNo = okey.substring(6); + if(orderNo.length() < 32){ + logger.error("orderNo[{}] is error", orderNo); + continue; + } + + Date otime = DateUtil.orderNo2Date(orderNo); if (Duration.between(otime.toInstant(), now).toHours() > 24 * 3) { REDIS.deleteObject(okey); REDIS.deleteObject(okey.replace("order", "pushOrder"));