准确记录开始结束SOC

This commit is contained in:
ZZ 2021-08-27 14:10:53 +08:00
parent e20d918bd6
commit 2f8d0c3a90
2 changed files with 7 additions and 3 deletions

View File

@ -232,6 +232,8 @@ public class ChargingController {
cacheOrder.put("balance", balance);
cacheOrder.put("tel", startChargingData.getTel());
cacheOrder.put("stopSoc", startChargingData.getSoc());
cacheOrder.put("startSoc", 0);
cacheOrder.put("endSoc", 0);
REDIS.setCacheMap(orderkey, cacheOrder);
cacheGun.put("orderstarttime", DateUtil.format(Calendar.getInstance().getTime(), NORM_DATETIME_FORMAT));
cacheGun.put("orderstoptime", null);

View File

@ -106,8 +106,8 @@ public class RealtimeDataLogic implements ServiceLogic {
String lord = orderkey.concat(".lord");
REDIS.setCacheObject(lord, cacheRealtimeData);
Integer cacheStartSoc = (Integer) cacheOrder.get("startSoc");
if (cacheStartSoc == null) cacheOrder.put("startSoc", socInt);
cacheOrder.put("endSoc", socInt);
if (cacheStartSoc == 0 && socInt != 0) cacheOrder.put("startSoc", socInt);
if (socInt != 0) cacheOrder.put("endSoc", socInt);
cacheOrder.put("remainingTime", tr);
cacheOrder.put("status", statusplain);
cacheOrder.put("realtimeDataList", realtimeDataList);
@ -120,7 +120,9 @@ public class RealtimeDataLogic implements ServiceLogic {
if (alerted == null && tel != null) {
R r = chargingController.nativeStopCharging(pileNo, gunId, default_version);
if (r.getCode() == 200) {
smsService.sendNotice(tel, "【小华充电】尊敬的用户你的车辆已充电达至设定的SOC(".concat(stopSoc.toString()).concat("%)已自动停止充电,请您尽快将车辆挪走以方便他人使用充电桩,谢谢合作。"));
smsService.sendNotice(tel, "【小华充电】尊敬的用户你的车辆已充电达至设定的SOC("
.concat(stopSoc.toString())
.concat("%)已自动停止充电,请您尽快将车辆挪走以方便他人使用充电桩,谢谢合作。"));
cacheOrder.put("socalerted", "true");
REDIS.setCacheMap(orderkey, cacheOrder);
}