修复错误,增加处理之前对数据格式的判断

This commit is contained in:
panshuling321 2022-08-24 11:25:11 +08:00
parent fb67bc5597
commit 69f2cec277
3 changed files with 12 additions and 2 deletions

View File

@ -22,7 +22,6 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;

View File

@ -76,6 +76,11 @@ public class NotificationChargeOrderInfo4BonusTask extends CoreDispatcher {
if (operatorIdEvcs == null) { if (operatorIdEvcs == null) {
Long chargingStationId = xhpcHistoryOrder.getChargingStationId(); Long chargingStationId = xhpcHistoryOrder.getChargingStationId();
XhpcChargingStation station = chargingStationRepo.findById(chargingStationId).orElse(null); XhpcChargingStation station = chargingStationRepo.findById(chargingStationId).orElse(null);
if(station == null){
logger.error("station[{}] is not exits", chargingStationId);
return false;
}
String stationOperatorIdEvcs = station.getOperatorIdEvcs(); String stationOperatorIdEvcs = station.getOperatorIdEvcs();
if (stationOperatorIdEvcs == null) { if (stationOperatorIdEvcs == null) {
logger.error("station[{}] operator id evcs not set", chargingStationId); logger.error("station[{}] operator id evcs not set", chargingStationId);

View File

@ -45,7 +45,13 @@ public class NotificationChargeOrderInfoTask extends CoreDispatcher {
Collection<String> orderKeys = REDIS.keys("order:*"); Collection<String> orderKeys = REDIS.keys("order:*");
Instant now = Instant.now(); Instant now = Instant.now();
for (String okey : orderKeys) { 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) { if (Duration.between(otime.toInstant(), now).toHours() > 24 * 3) {
REDIS.deleteObject(okey); REDIS.deleteObject(okey);
REDIS.deleteObject(okey.replace("order", "pushOrder")); REDIS.deleteObject(okey.replace("order", "pushOrder"));