diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/OrderDataLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/OrderDataLogic.java index 7f7fc0cc..d4b26367 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/OrderDataLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/OrderDataLogic.java @@ -66,13 +66,13 @@ public class OrderDataLogic implements ServiceLogic { cacheOrder.put("orderData", cacheOrderData); cacheOrder.put("status", "已结束"); cacheOrder.put("stopReason", translate(cacheOrderData.getStopReason())); + cacheOrder.put("stopReasonHex", cacheOrderData.getStopReason()); REDIS.setCacheMap(orderkey, cacheOrder); String gunkey = "gun:".concat(orderData.getPileNo()).concat(orderData.getGunId()); Map cacheGun = REDIS.getCacheMap(gunkey); cacheGun.put("orderstoptime", cacheOrderData.getEndTime()); cacheGun.put("orderkey", null); REDIS.setCacheMap(gunkey, cacheGun); - Long rdtime = (Long) cacheOrder.get("rdtime"); Map cachePile = REDIS.getCacheMap("pile:".concat(orderData.getPileNo())); if (cachePile.get("version").equals("0C")) { final String hex = orderData.getHex(); 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 6b6350e5..bd0a7f84 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 @@ -142,7 +142,6 @@ public class RealtimeDataLogic implements ServiceLogic { } cacheOrder.put("rbalance", balance); cacheOrder.put("remainingTime", tr); - cacheOrder.put("rdtime", DateUtil.calendar().getTime().getTime()); cacheOrder.put("status", statusplain); cacheOrder.put("totalPower", cacheRealtimeData.getChargingDegree() / 10000.0); cacheOrder.put("totalMoney", cacheRealtimeData.getAmountCharged() / 10000.0); @@ -204,10 +203,10 @@ public class RealtimeDataLogic implements ServiceLogic { errorfreecnt = errorfreecnt == null ? 1 : ++errorfreecnt; if (errorfreecnt == 2) { CacheRealtimeData cacheRData = REDIS.getCacheObject(orderkey.concat(".lord")); - R r = null; + R r; if (cacheRData == null) { r = pileOrderService.abnormalOrder(orderNo); - cacheOrder.put("abnormal", "1.1");//lord is null + cacheOrder.put("abnormal", "1.1 lord is null"); log.error("abnormal.1 order[{}]", orderNo); } else { CacheOrderData lordAsOd = new CacheOrderData(cacheRData, (String) cacheOrder.get("pileStartTime"), @@ -215,10 +214,11 @@ public class RealtimeDataLogic implements ServiceLogic { cacheOrder.put("orderData", lordAsOd); r = pileOrderService.pileEndOrder(orderNo); REDIS.setCacheMap(orderkey, cacheOrder); - cacheOrder.put("abnormal", "1.2");//lord as orderData + cacheOrder.put("abnormal", "1.2 lord as orderData"); log.error("abnormal.1.2 order[{}]", orderNo); - cacheOrder.put("status", "已结束"); } + chargingController.stopCharging(pileNo, gunId, default_version); + cacheOrder.put("status", "空闲>2下发中止"); if (r == null || r.getCode() != 200) { log.error("errorfreecnt r{}", JSONUtil.toJsonStr(r)); errorfreecnt = 1; @@ -228,42 +228,16 @@ public class RealtimeDataLogic implements ServiceLogic { } REDIS.setCacheMap(orderkey, cacheOrder); } else { - orderkey = (String) cacheGun.get("orderkey"); - Integer idleCnt = (Integer) cacheGun.get("idleCnt"); - if (orderkey != null && statusInt != 3) { - idleCnt = idleCnt == null ? 0 : idleCnt; - idleCnt++; - if (idleCnt >= 2) { - if (orderkey.length() > 0) { - Map problematicOrder = REDIS.getCacheMap(orderkey); - CacheRealtimeData cacheRealtimeData = REDIS.getCacheObject(orderkey.concat(".lord")); - if (problematicOrder != null && cacheRealtimeData != null) { - Integer startSoc = (Integer) problematicOrder.get("startSoc"); - Integer endSoc = (Integer) problematicOrder.get("endSoc"); - problematicOrder.put("orderData", new CacheOrderData(cacheRealtimeData, - (String) problematicOrder.get("startTime"), - startSoc == null ? 0 : startSoc, endSoc == null ? 0 : endSoc)); - log.error("abnormal.2.1 order[{}]", orderNo); - cacheOrder.put("abnormal", "2.1"); - cacheOrder.put("status", "已结束"); - } else { - log.error("abnormal.2.2 order[{}]", orderNo); - cacheOrder.put("abnormal", "2.2");//not respond - String pushOrderKey = orderkey.replace("order:", "pushOrder:"); - if (REDIS.getCacheMap(pushOrderKey) != null) { - REDIS.setCacheMapValue(pushOrderKey, "startChargeSeqStat", 4); - } - } - orderNo = orderkey.replace("order:", ""); - pileOrderService.abnormalOrder(orderNo); - cacheGun.put("orderkey", null); - idleCnt = 0; - cacheGun.put("idleCnt", idleCnt); - } + if (statusInt == 3) { + chargingController.stopCharging(pileNo, gunId, default_version); + Integer bpcnt = (Integer) cacheGun.get("pleek.bp.cnt"); + cacheGun.put("pleek.bp.cnt", bpcnt==null?1:bpcnt++); + cacheGun.put("pleek.bp.lt", DateUtil.now()); + orderkey = (String) cacheGun.get("orderkey"); + if (orderkey!=null) { + cacheGun.put("pleek.bp.lo", orderkey); + REDIS.setCacheMapValue(orderkey, "stopReason.pleek", "bp"); } - } else { - idleCnt = 0; - cacheGun.put("idleCnt", idleCnt); } } REDIS.setCacheMap(gunkey, cacheGun);