diff --git a/evcs-modules/evcs-common/src/main/java/com/xhpc/evcs/dto/EquipChargeStatus.java b/evcs-modules/evcs-common/src/main/java/com/xhpc/evcs/dto/EquipChargeStatus.java index dacd0162..0be6aad6 100644 --- a/evcs-modules/evcs-common/src/main/java/com/xhpc/evcs/dto/EquipChargeStatus.java +++ b/evcs-modules/evcs-common/src/main/java/com/xhpc/evcs/dto/EquipChargeStatus.java @@ -42,17 +42,17 @@ public class EquipChargeStatus { @JsonProperty("ConnectorStatus") private Integer connectorStatus = 1; @JsonProperty("CurrentA") - private Double currentA = 15.0; + private Double currentA = 0.0; @JsonProperty("CurrentB") - private Double currentB = 15.0; + private Double currentB = 0.0; @JsonProperty("CurrentC") - private Double currentC = 15.0; + private Double currentC = 0.0; @JsonProperty("VoltageA") - private Double voltageA = 220.0; + private Double voltageA = 0.0; @JsonProperty("VoltageB") - private Double voltageB = 220.0; + private Double voltageB = 0.0; @JsonProperty("VoltageC") - private Double voltageC = 220.0; + private Double voltageC = 0.0; @JsonProperty("Soc") private Double soc = 0.0; @JsonProperty("StartTime") diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/PowerPileService.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/PowerPileService.java index 944b6f5e..d4542958 100644 --- a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/PowerPileService.java +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/PowerPileService.java @@ -27,8 +27,10 @@ public interface PowerPileService { R stopCharging(@PathVariable("orderNo") String orderNo, @PathVariable("pileNo") String pileNo, @PathVariable("gunId") String gunId, @PathVariable("version") String version); - @PostMapping("/pile/whitelist/add/{stationId}") - R addPileWhitelist(@PathVariable("stationId") Long stationId, @RequestBody Set pileNoSet); + @PostMapping("/pile/whitelist/add/{stationId}/{version}") + R addPileWhitelist(@PathVariable("stationId") Long stationId, + @PathVariable("version") String version, + @RequestBody Set pileNoSet); @DeleteMapping("/pile/whitelist/delete/{stationId}") R deletePileWhitelist(@PathVariable("stationId") Long stationId, @RequestBody Set pileNoSet); diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/PowerPileFallbackFactory.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/PowerPileFallbackFactory.java index e341ee23..a43cb6a9 100644 --- a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/PowerPileFallbackFactory.java +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/PowerPileFallbackFactory.java @@ -41,7 +41,7 @@ public class PowerPileFallbackFactory implements FallbackFactory pileNoSet) { + public R addPileWhitelist(Long stationId, String version, Set pileNoSet) { return R.fail("增加充电桩白名单失败:" + cause.getMessage()); } diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/controller/PileController.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/controller/PileController.java index 46747ab4..f275a4b1 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/controller/PileController.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/controller/PileController.java @@ -19,8 +19,10 @@ import static com.xhpc.pp.server.ChargingPileServer.removeHandler; @Slf4j public class PileController { - @PostMapping("pile/whitelist/add/{stationId}") - public Object addWhitelist(@PathVariable("stationId") Long stationId, @RequestBody Set pileNoSet) { + @PostMapping("pile/whitelist/add/{stationId}/{version}") + public Object addWhitelist(@PathVariable("stationId") Long stationId, + @PathVariable("version") String version, + @RequestBody Set pileNoSet) { Set pileWhitelist = REDIS.getCacheSet("PILE_WHITELIST"); pileWhitelist.addAll(pileNoSet); @@ -42,6 +44,7 @@ public class PileController { String pkey = "pile:".concat(pileNo); Map cachePile = REDIS.getCacheMap(pkey); cachePile.put("stationId", stationId); + cachePile.put("version", version); REDIS.setCacheMap(pkey, cachePile); } return R.ok(); 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 feb21fbe..52a15ced 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 @@ -26,8 +26,7 @@ import java.util.Map; import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS; import static com.xhpc.pp.server.ChargingPileServer.default_version; -import static com.xhpc.pp.utils.HexUtils.reverseHexInt; -import static com.xhpc.pp.utils.HexUtils.toBits; +import static com.xhpc.pp.utils.HexUtils.*; import static com.xhpc.pp.utils.security.CacheDataUtils.reflectTranslate; @Lazy @@ -37,17 +36,18 @@ public class RealtimeDataLogic implements ServiceLogic { @Autowired private SmsService smsService; + @Autowired + private PileOrderService pileOrderService; + @Autowired + private ChargingController chargingController; private static Logger log = LoggerFactory.getLogger(RealtimeDataLogic.class); public static final String[] stable = {"离线", "故障", "空闲", "充电中"}; public static final String[] pvgstable = {"否", "是", "未知"}; - private static final String[] hftable = {"急停按钮动作故障", "无可用整流模块", "出风口温度过高", "交流防雷故障", "交直流模块DC20通信中断", "绝缘检测模块FC08通信中断", "电度表通信中断", "读卡器通信中断", "RC10通信中断", "风扇调速板故障", "直流熔断器故障", "高压接触器故障", "门打开"}; + private static final String[] hftable = {"急停按钮动作故障", "无可用整流模块", "出风口温度过高", "交流防雷故障", "交直流模块DC20通信中断", "绝缘检测模块FC08通信中断", + "电度表通信中断", "读卡器通信中断", "RC10通信中断", "风扇调速板故障", "直流熔断器故障", "高压接触器故障", "门打开"}; - @Autowired - private PileOrderService pileOrderService; - @Autowired - private ChargingController chargingController; @Override public ServiceResult service(ServiceParameter sp) throws Exception { @@ -97,7 +97,6 @@ public class RealtimeDataLogic implements ServiceLogic { cacheGun.put("statusInt", statusInt); cacheGun.put("status", statusOrSOC); cacheGun.put("remainingTime", tr); - REDIS.setCacheMap(gunkey, cacheGun); String stationTermStatusKey = "stationTerminalStatus:".concat(cachePile.get("stationId").toString()); Map cacheTerminalStatusMap = REDIS.getCacheMap(stationTermStatusKey); cacheTerminalStatusMap.put(terminalId, statusOrSOC); @@ -134,7 +133,6 @@ public class RealtimeDataLogic implements ServiceLogic { cacheOrder.put("totalPower", cacheRealtimeData.getChargingDegree() / 10000.0); cacheOrder.put("totalMoney", cacheRealtimeData.getAmountCharged() / 10000.0); cacheOrder.put("realtimeDataList", realtimeDataList); - REDIS.setCacheMap(orderkey, cacheOrder); pileOrderService.pileRimeOrder(orderNo); Integer stopSoc = (Integer) cacheOrder.get("stopSoc"); if (stopSoc != null && socInt >= stopSoc) { @@ -147,7 +145,6 @@ public class RealtimeDataLogic implements ServiceLogic { .concat(stopSoc.toString()) .concat("%)已自动停止充电,请您尽快将车辆挪走以方便他人使用充电桩,谢谢合作。")); cacheOrder.put("socalerted", "true"); - REDIS.setCacheMap(orderkey, cacheOrder); } } } @@ -157,18 +154,29 @@ public class RealtimeDataLogic implements ServiceLogic { if (alerted == null && tel != null) { smsService.sendNotice(tel, "【小华充电】尊敬的用户,你的账户余额小于5元,为不影响您的正常充电,请您尽快充值交费,谢谢。"); cacheOrder.put("lt5alerted", "true"); - REDIS.setCacheMap(orderkey, cacheOrder); } } if ("true".equals(cacheOrder.get("lordiss"))) { cacheOrder.put("lordiss", "false"); pileOrderService.pileStop(orderNo, 4, "订单实时数据恢复"); - REDIS.setCacheMap(orderkey, cacheOrder); } REDIS.setCacheMap(orderkey, cacheOrder); } else { - //todo invoke 异常订单 + Integer idleCnt = (Integer) cacheGun.get("idleCnt"); + idleCnt = idleCnt == null ? 0 : idleCnt; + idleCnt++; + orderkey = (String) cacheGun.get("orderkey"); + if (idleCnt > 3 && orderkey != null) { + Map problematicOrder = REDIS.getCacheMap(orderkey); + Object orderData = problematicOrder.get("orderData"); + String status = (String) problematicOrder.get("status"); + if (!isInteger(status) && !status.equals("充电中") && orderData == null) { + pileOrderService.abnormalOrder(orderNo); + } + } + cacheGun.put("idleCnt", idleCnt); } + REDIS.setCacheMap(gunkey, cacheGun); return new ServiceResult(false); }