过流过压保护与费率主动下发
This commit is contained in:
parent
53dd34c3e7
commit
a420cdc845
@ -6,7 +6,6 @@ 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.down.StartChargingData;
|
||||
import com.xhpc.common.data.redis.CacheOrderData;
|
||||
import com.xhpc.common.data.redis.CacheRealtimeData;
|
||||
import com.xhpc.common.data.up.RealtimeData;
|
||||
@ -71,8 +70,10 @@ public class RealtimeDataLogic implements ServiceLogic {
|
||||
String statusplain = stable[statusInt];
|
||||
cacheGun.put("pileGunStatus", pvgstable[Integer.parseInt(realtimeData.getPileGunStatus())]);
|
||||
cacheGun.put("vehicleGunStatus", pvgstable[Integer.parseInt(realtimeData.getVehicleGunStatus())]);
|
||||
cacheGun.put("voltage", realtimeData.getWorkingVoltage());
|
||||
cacheGun.put("current", realtimeData.getWorkingCurrent());
|
||||
double wv = reverseHexInt(realtimeData.getWorkingVoltage()) / 10.0;
|
||||
cacheGun.put("voltage", wv);
|
||||
double wc = reverseHexInt(realtimeData.getWorkingCurrent()) / 10.0;
|
||||
cacheGun.put("current", wc);
|
||||
String hardwareFault = realtimeData.getHardwareFault();
|
||||
String hfs = toBits(hardwareFault);
|
||||
char[] hfcs = hfs.toCharArray();
|
||||
@ -116,17 +117,9 @@ public class RealtimeDataLogic implements ServiceLogic {
|
||||
if (realtimeDataList == null) {
|
||||
realtimeDataList = new ArrayList<>();
|
||||
}
|
||||
StartChargingData startChargingData = new StartChargingData();
|
||||
Integer balance = (Integer) cacheOrder.get("initBalance");
|
||||
CacheRealtimeData cacheRealtimeData = translate(realtimeData);
|
||||
balance -= cacheRealtimeData.getAmountCharged();
|
||||
// startChargingData.setBalance(balance); //todo make pile work then uncomment
|
||||
// startChargingData.setLogicCardNo(cacheOrder.get("logicCardNo").toString());
|
||||
// startChargingData.setPhysicCardNo(cacheOrder.get("physicCardNo").toString());
|
||||
// startChargingData.setPileNo(cacheOrder.get("pileNo").toString());
|
||||
// startChargingData.setGunId(cacheOrder.get("gunId").toString());
|
||||
// Thread.sleep(300);
|
||||
// chargingController.nativeRefreshBalance(startChargingData);
|
||||
cacheRealtimeData.setCreateTime(DateUtil.now());
|
||||
String lord = orderkey.concat(".lord");
|
||||
REDIS.setCacheObject(lord, cacheRealtimeData);
|
||||
@ -149,38 +142,49 @@ public class RealtimeDataLogic implements ServiceLogic {
|
||||
cacheOrder.put("totalMoney", cacheRealtimeData.getAmountCharged() / 10000.0);
|
||||
cacheOrder.put("realtimeDataList", realtimeDataList);
|
||||
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) {
|
||||
HashMap<String, String> paramMap = new HashMap<>();
|
||||
paramMap.put("battery", stopSoc.toString());
|
||||
paramMap.put("phone", tel);
|
||||
paramMap.put("content", "【小华充电】尊敬的用户,你的车辆已充电达至设定的SOC(" + stopSoc + "%)" +
|
||||
"已自动停止充电,请您尽快将车辆挪走以方便他人使用充电桩,谢谢合作。");
|
||||
smsService.sendNotice(paramMap);
|
||||
cacheOrder.put("socalerted", "true");
|
||||
Integer vul = (Integer) cachePile.get("voltageUpperLimits");
|
||||
Integer cul = (Integer) cachePile.get("current");
|
||||
if (wc > cul || wv > vul) {
|
||||
R r = chargingController.nativeStopCharging(pileNo, gunId, default_version);
|
||||
if (r.getCode() == 200) {
|
||||
Integer vcpcnt = (Integer) cacheOrder.get("vcpcnt");
|
||||
cacheOrder.put("vcpcnt", vcpcnt == null ? 1 : vcpcnt++);
|
||||
log.error("{} alert: v[{}], c[{}]", orderNo, wv, wc);
|
||||
}
|
||||
} else {
|
||||
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) {
|
||||
HashMap<String, String> paramMap = new HashMap<>();
|
||||
paramMap.put("battery", stopSoc.toString());
|
||||
paramMap.put("phone", tel);
|
||||
paramMap.put("content", "【小华充电】尊敬的用户,你的车辆已充电达至设定的SOC(" + stopSoc + "%)" +
|
||||
"已自动停止充电,请您尽快将车辆挪走以方便他人使用充电桩,谢谢合作。");
|
||||
smsService.sendNotice(paramMap);
|
||||
cacheOrder.put("socalerted", "true");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (balance < 50000) {
|
||||
String alerted = (String) cacheOrder.get("lt5alerted");
|
||||
String tel = (String) cacheOrder.get("tel");
|
||||
if (alerted == null && tel != null) {
|
||||
HashMap<String, String> paramMap = new HashMap<>();
|
||||
paramMap.put("money", "5");
|
||||
paramMap.put("phone", tel);
|
||||
paramMap.put("content", "【小华充电】尊敬的用户,你的账户余额小于5元,为不影响您的正常充电,请您尽快充值交费,谢谢。");
|
||||
smsService.sendNotice(paramMap);
|
||||
cacheOrder.put("lt5alerted", "true");
|
||||
if (balance < 50000) {
|
||||
String alerted = (String) cacheOrder.get("lt5alerted");
|
||||
String tel = (String) cacheOrder.get("tel");
|
||||
if (alerted == null && tel != null) {
|
||||
HashMap<String, String> paramMap = new HashMap<>();
|
||||
paramMap.put("money", "5");
|
||||
paramMap.put("phone", tel);
|
||||
paramMap.put("content", "【小华充电】尊敬的用户,你的账户余额小于5元,为不影响您的正常充电,请您尽快充值交费,谢谢。");
|
||||
smsService.sendNotice(paramMap);
|
||||
cacheOrder.put("lt5alerted", "true");
|
||||
}
|
||||
}
|
||||
if ("true".equals(cacheOrder.get("lordiss"))) {
|
||||
cacheOrder.put("lordiss", "false");
|
||||
pileOrderService.pileStop(orderNo, 4, "订单实时数据恢复");
|
||||
}
|
||||
}
|
||||
if ("true".equals(cacheOrder.get("lordiss"))) {
|
||||
cacheOrder.put("lordiss", "false");
|
||||
pileOrderService.pileStop(orderNo, 4, "订单实时数据恢复");
|
||||
}
|
||||
} else {
|
||||
Integer errorfreecnt = (Integer) cacheOrder.get("errorfreecnt");
|
||||
|
||||
@ -36,7 +36,7 @@ public class RateModelTask {
|
||||
Collection<String> gks = REDIS.keys(gkPattern);
|
||||
boolean charging = false;
|
||||
for (String gk : gks) {
|
||||
if (isInteger(REDIS.getCacheMapValue(gk, "status"))) {
|
||||
if (gk.length() == 20 && isInteger(REDIS.getCacheMapValue(gk, "status"))) {
|
||||
charging = true;
|
||||
break;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user