SOC停止充电
This commit is contained in:
parent
6b2cce56d8
commit
9fbf1bea1f
@ -16,6 +16,7 @@ public class StartChargingData {
|
||||
private String logicCardNo = "0000000000000000"; //逻辑卡号 16进制,无需补零
|
||||
private String physicCardNo = "0000000000000000"; //物理卡号 同上
|
||||
private String version = "0A"; //协议版本号(0A)
|
||||
private Integer soc;
|
||||
|
||||
public String getOrderNo() {
|
||||
|
||||
@ -97,4 +98,14 @@ public class StartChargingData {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public Integer getSoc() {
|
||||
|
||||
return soc;
|
||||
}
|
||||
|
||||
public void setSoc(Integer soc) {
|
||||
|
||||
this.soc = soc;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -231,6 +231,7 @@ public class ChargingController {
|
||||
cacheOrder.put("rateModelId", pileRateModelId);
|
||||
cacheOrder.put("balance", balance);
|
||||
cacheOrder.put("tel", startChargingData.getTel());
|
||||
cacheOrder.put("stopSoc", startChargingData.getSoc());
|
||||
REDIS.setCacheMap(orderkey, cacheOrder);
|
||||
cacheGun.put("orderstarttime", DateUtil.format(Calendar.getInstance().getTime(), NORM_DATETIME_FORMAT));
|
||||
cacheGun.put("orderstoptime", null);
|
||||
|
||||
@ -3,8 +3,10 @@ package com.xhpc.pp.logic;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.xhpc.common.api.PileOrderService;
|
||||
import com.xhpc.common.api.SmsService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.data.redis.CacheRealtimeData;
|
||||
import com.xhpc.common.data.up.RealtimeData;
|
||||
import com.xhpc.pp.controller.ChargingController;
|
||||
import com.xhpc.pp.tx.ServiceParameter;
|
||||
import com.xhpc.pp.tx.ServiceResult;
|
||||
import com.xhpc.pp.tx.logic.ServiceLogic;
|
||||
@ -22,6 +24,7 @@ import java.util.List;
|
||||
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.security.CacheDataUtils.reflectTranslate;
|
||||
import static com.xhpc.pp.utils.security.HexUtils.reverseHexInt;
|
||||
import static com.xhpc.pp.utils.security.HexUtils.toBits;
|
||||
@ -42,6 +45,8 @@ public class RealtimeDataLogic implements ServiceLogic {
|
||||
|
||||
@Autowired
|
||||
private PileOrderService pileOrderService;
|
||||
@Autowired
|
||||
private ChargingController chargingController;
|
||||
|
||||
@Override
|
||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||
@ -108,6 +113,19 @@ public class RealtimeDataLogic implements ServiceLogic {
|
||||
cacheOrder.put("realtimeDataList", realtimeDataList);
|
||||
REDIS.setCacheMap(orderkey, cacheOrder);
|
||||
pileOrderService.pileRimeOrder(orderNo);
|
||||
Integer stopSoc = (Integer) cacheOrder.get("stopSoc");
|
||||
if (stopSoc != null && socInt >= stopSoc) {
|
||||
String alerted = (String) cacheOrder.get("socalerted");
|
||||
String tel = (String) cacheOrder.get("tel");
|
||||
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("%)已自动停止充电,请您尽快将车辆挪走以方便他人使用充电桩,谢谢合作。"));
|
||||
cacheOrder.put("socalerted", "true");
|
||||
REDIS.setCacheMap(orderkey, cacheOrder);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((balance - cacheRealtimeData.getAmountCharged()) < 500) {
|
||||
String alerted = (String) cacheOrder.get("lt5alerted");
|
||||
String tel = (String) cacheOrder.get("tel");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user