缓存加入桩协议版本;异常订单判定逻辑
This commit is contained in:
parent
055edbc56b
commit
c804922be3
@ -42,17 +42,17 @@ public class EquipChargeStatus {
|
|||||||
@JsonProperty("ConnectorStatus")
|
@JsonProperty("ConnectorStatus")
|
||||||
private Integer connectorStatus = 1;
|
private Integer connectorStatus = 1;
|
||||||
@JsonProperty("CurrentA")
|
@JsonProperty("CurrentA")
|
||||||
private Double currentA = 15.0;
|
private Double currentA = 0.0;
|
||||||
@JsonProperty("CurrentB")
|
@JsonProperty("CurrentB")
|
||||||
private Double currentB = 15.0;
|
private Double currentB = 0.0;
|
||||||
@JsonProperty("CurrentC")
|
@JsonProperty("CurrentC")
|
||||||
private Double currentC = 15.0;
|
private Double currentC = 0.0;
|
||||||
@JsonProperty("VoltageA")
|
@JsonProperty("VoltageA")
|
||||||
private Double voltageA = 220.0;
|
private Double voltageA = 0.0;
|
||||||
@JsonProperty("VoltageB")
|
@JsonProperty("VoltageB")
|
||||||
private Double voltageB = 220.0;
|
private Double voltageB = 0.0;
|
||||||
@JsonProperty("VoltageC")
|
@JsonProperty("VoltageC")
|
||||||
private Double voltageC = 220.0;
|
private Double voltageC = 0.0;
|
||||||
@JsonProperty("Soc")
|
@JsonProperty("Soc")
|
||||||
private Double soc = 0.0;
|
private Double soc = 0.0;
|
||||||
@JsonProperty("StartTime")
|
@JsonProperty("StartTime")
|
||||||
|
|||||||
@ -27,8 +27,10 @@ public interface PowerPileService {
|
|||||||
R stopCharging(@PathVariable("orderNo") String orderNo, @PathVariable("pileNo") String pileNo,
|
R stopCharging(@PathVariable("orderNo") String orderNo, @PathVariable("pileNo") String pileNo,
|
||||||
@PathVariable("gunId") String gunId, @PathVariable("version") String version);
|
@PathVariable("gunId") String gunId, @PathVariable("version") String version);
|
||||||
|
|
||||||
@PostMapping("/pile/whitelist/add/{stationId}")
|
@PostMapping("/pile/whitelist/add/{stationId}/{version}")
|
||||||
R addPileWhitelist(@PathVariable("stationId") Long stationId, @RequestBody Set<String> pileNoSet);
|
R addPileWhitelist(@PathVariable("stationId") Long stationId,
|
||||||
|
@PathVariable("version") String version,
|
||||||
|
@RequestBody Set<String> pileNoSet);
|
||||||
|
|
||||||
@DeleteMapping("/pile/whitelist/delete/{stationId}")
|
@DeleteMapping("/pile/whitelist/delete/{stationId}")
|
||||||
R deletePileWhitelist(@PathVariable("stationId") Long stationId, @RequestBody Set<String> pileNoSet);
|
R deletePileWhitelist(@PathVariable("stationId") Long stationId, @RequestBody Set<String> pileNoSet);
|
||||||
|
|||||||
@ -41,7 +41,7 @@ public class PowerPileFallbackFactory implements FallbackFactory<PowerPileServic
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R addPileWhitelist(Long stationId, Set<String> pileNoSet) {
|
public R addPileWhitelist(Long stationId, String version, Set<String> pileNoSet) {
|
||||||
|
|
||||||
return R.fail("增加充电桩白名单失败:" + cause.getMessage());
|
return R.fail("增加充电桩白名单失败:" + cause.getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,8 +19,10 @@ import static com.xhpc.pp.server.ChargingPileServer.removeHandler;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class PileController {
|
public class PileController {
|
||||||
|
|
||||||
@PostMapping("pile/whitelist/add/{stationId}")
|
@PostMapping("pile/whitelist/add/{stationId}/{version}")
|
||||||
public Object addWhitelist(@PathVariable("stationId") Long stationId, @RequestBody Set<String> pileNoSet) {
|
public Object addWhitelist(@PathVariable("stationId") Long stationId,
|
||||||
|
@PathVariable("version") String version,
|
||||||
|
@RequestBody Set<String> pileNoSet) {
|
||||||
|
|
||||||
Set<String> pileWhitelist = REDIS.getCacheSet("PILE_WHITELIST");
|
Set<String> pileWhitelist = REDIS.getCacheSet("PILE_WHITELIST");
|
||||||
pileWhitelist.addAll(pileNoSet);
|
pileWhitelist.addAll(pileNoSet);
|
||||||
@ -42,6 +44,7 @@ public class PileController {
|
|||||||
String pkey = "pile:".concat(pileNo);
|
String pkey = "pile:".concat(pileNo);
|
||||||
Map<String, Object> cachePile = REDIS.getCacheMap(pkey);
|
Map<String, Object> cachePile = REDIS.getCacheMap(pkey);
|
||||||
cachePile.put("stationId", stationId);
|
cachePile.put("stationId", stationId);
|
||||||
|
cachePile.put("version", version);
|
||||||
REDIS.setCacheMap(pkey, cachePile);
|
REDIS.setCacheMap(pkey, cachePile);
|
||||||
}
|
}
|
||||||
return R.ok();
|
return R.ok();
|
||||||
|
|||||||
@ -26,8 +26,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||||
import static com.xhpc.pp.server.ChargingPileServer.default_version;
|
import static com.xhpc.pp.server.ChargingPileServer.default_version;
|
||||||
import static com.xhpc.pp.utils.HexUtils.reverseHexInt;
|
import static com.xhpc.pp.utils.HexUtils.*;
|
||||||
import static com.xhpc.pp.utils.HexUtils.toBits;
|
|
||||||
import static com.xhpc.pp.utils.security.CacheDataUtils.reflectTranslate;
|
import static com.xhpc.pp.utils.security.CacheDataUtils.reflectTranslate;
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@ -37,17 +36,18 @@ public class RealtimeDataLogic implements ServiceLogic {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SmsService smsService;
|
private SmsService smsService;
|
||||||
|
@Autowired
|
||||||
|
private PileOrderService pileOrderService;
|
||||||
|
@Autowired
|
||||||
|
private ChargingController chargingController;
|
||||||
|
|
||||||
private static Logger log = LoggerFactory.getLogger(RealtimeDataLogic.class);
|
private static Logger log = LoggerFactory.getLogger(RealtimeDataLogic.class);
|
||||||
|
|
||||||
public static final String[] stable = {"离线", "故障", "空闲", "充电中"};
|
public static final String[] stable = {"离线", "故障", "空闲", "充电中"};
|
||||||
public static final String[] pvgstable = {"否", "是", "未知"};
|
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
|
@Override
|
||||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||||
@ -97,7 +97,6 @@ public class RealtimeDataLogic implements ServiceLogic {
|
|||||||
cacheGun.put("statusInt", statusInt);
|
cacheGun.put("statusInt", statusInt);
|
||||||
cacheGun.put("status", statusOrSOC);
|
cacheGun.put("status", statusOrSOC);
|
||||||
cacheGun.put("remainingTime", tr);
|
cacheGun.put("remainingTime", tr);
|
||||||
REDIS.setCacheMap(gunkey, cacheGun);
|
|
||||||
String stationTermStatusKey = "stationTerminalStatus:".concat(cachePile.get("stationId").toString());
|
String stationTermStatusKey = "stationTerminalStatus:".concat(cachePile.get("stationId").toString());
|
||||||
Map<String, Object> cacheTerminalStatusMap = REDIS.getCacheMap(stationTermStatusKey);
|
Map<String, Object> cacheTerminalStatusMap = REDIS.getCacheMap(stationTermStatusKey);
|
||||||
cacheTerminalStatusMap.put(terminalId, statusOrSOC);
|
cacheTerminalStatusMap.put(terminalId, statusOrSOC);
|
||||||
@ -134,7 +133,6 @@ public class RealtimeDataLogic implements ServiceLogic {
|
|||||||
cacheOrder.put("totalPower", cacheRealtimeData.getChargingDegree() / 10000.0);
|
cacheOrder.put("totalPower", cacheRealtimeData.getChargingDegree() / 10000.0);
|
||||||
cacheOrder.put("totalMoney", cacheRealtimeData.getAmountCharged() / 10000.0);
|
cacheOrder.put("totalMoney", cacheRealtimeData.getAmountCharged() / 10000.0);
|
||||||
cacheOrder.put("realtimeDataList", realtimeDataList);
|
cacheOrder.put("realtimeDataList", realtimeDataList);
|
||||||
REDIS.setCacheMap(orderkey, cacheOrder);
|
|
||||||
pileOrderService.pileRimeOrder(orderNo);
|
pileOrderService.pileRimeOrder(orderNo);
|
||||||
Integer stopSoc = (Integer) cacheOrder.get("stopSoc");
|
Integer stopSoc = (Integer) cacheOrder.get("stopSoc");
|
||||||
if (stopSoc != null && socInt >= stopSoc) {
|
if (stopSoc != null && socInt >= stopSoc) {
|
||||||
@ -147,7 +145,6 @@ public class RealtimeDataLogic implements ServiceLogic {
|
|||||||
.concat(stopSoc.toString())
|
.concat(stopSoc.toString())
|
||||||
.concat("%)已自动停止充电,请您尽快将车辆挪走以方便他人使用充电桩,谢谢合作。"));
|
.concat("%)已自动停止充电,请您尽快将车辆挪走以方便他人使用充电桩,谢谢合作。"));
|
||||||
cacheOrder.put("socalerted", "true");
|
cacheOrder.put("socalerted", "true");
|
||||||
REDIS.setCacheMap(orderkey, cacheOrder);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -157,18 +154,29 @@ public class RealtimeDataLogic implements ServiceLogic {
|
|||||||
if (alerted == null && tel != null) {
|
if (alerted == null && tel != null) {
|
||||||
smsService.sendNotice(tel, "【小华充电】尊敬的用户,你的账户余额小于5元,为不影响您的正常充电,请您尽快充值交费,谢谢。");
|
smsService.sendNotice(tel, "【小华充电】尊敬的用户,你的账户余额小于5元,为不影响您的正常充电,请您尽快充值交费,谢谢。");
|
||||||
cacheOrder.put("lt5alerted", "true");
|
cacheOrder.put("lt5alerted", "true");
|
||||||
REDIS.setCacheMap(orderkey, cacheOrder);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ("true".equals(cacheOrder.get("lordiss"))) {
|
if ("true".equals(cacheOrder.get("lordiss"))) {
|
||||||
cacheOrder.put("lordiss", "false");
|
cacheOrder.put("lordiss", "false");
|
||||||
pileOrderService.pileStop(orderNo, 4, "订单实时数据恢复");
|
pileOrderService.pileStop(orderNo, 4, "订单实时数据恢复");
|
||||||
REDIS.setCacheMap(orderkey, cacheOrder);
|
|
||||||
}
|
}
|
||||||
REDIS.setCacheMap(orderkey, cacheOrder);
|
REDIS.setCacheMap(orderkey, cacheOrder);
|
||||||
} else {
|
} 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<String, Object> 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);
|
return new ServiceResult(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user