过流过压保护与费率主动下发
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.PileOrderService;
|
||||||
import com.xhpc.common.api.SmsService;
|
import com.xhpc.common.api.SmsService;
|
||||||
import com.xhpc.common.core.domain.R;
|
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.CacheOrderData;
|
||||||
import com.xhpc.common.data.redis.CacheRealtimeData;
|
import com.xhpc.common.data.redis.CacheRealtimeData;
|
||||||
import com.xhpc.common.data.up.RealtimeData;
|
import com.xhpc.common.data.up.RealtimeData;
|
||||||
@ -71,8 +70,10 @@ public class RealtimeDataLogic implements ServiceLogic {
|
|||||||
String statusplain = stable[statusInt];
|
String statusplain = stable[statusInt];
|
||||||
cacheGun.put("pileGunStatus", pvgstable[Integer.parseInt(realtimeData.getPileGunStatus())]);
|
cacheGun.put("pileGunStatus", pvgstable[Integer.parseInt(realtimeData.getPileGunStatus())]);
|
||||||
cacheGun.put("vehicleGunStatus", pvgstable[Integer.parseInt(realtimeData.getVehicleGunStatus())]);
|
cacheGun.put("vehicleGunStatus", pvgstable[Integer.parseInt(realtimeData.getVehicleGunStatus())]);
|
||||||
cacheGun.put("voltage", realtimeData.getWorkingVoltage());
|
double wv = reverseHexInt(realtimeData.getWorkingVoltage()) / 10.0;
|
||||||
cacheGun.put("current", realtimeData.getWorkingCurrent());
|
cacheGun.put("voltage", wv);
|
||||||
|
double wc = reverseHexInt(realtimeData.getWorkingCurrent()) / 10.0;
|
||||||
|
cacheGun.put("current", wc);
|
||||||
String hardwareFault = realtimeData.getHardwareFault();
|
String hardwareFault = realtimeData.getHardwareFault();
|
||||||
String hfs = toBits(hardwareFault);
|
String hfs = toBits(hardwareFault);
|
||||||
char[] hfcs = hfs.toCharArray();
|
char[] hfcs = hfs.toCharArray();
|
||||||
@ -116,17 +117,9 @@ public class RealtimeDataLogic implements ServiceLogic {
|
|||||||
if (realtimeDataList == null) {
|
if (realtimeDataList == null) {
|
||||||
realtimeDataList = new ArrayList<>();
|
realtimeDataList = new ArrayList<>();
|
||||||
}
|
}
|
||||||
StartChargingData startChargingData = new StartChargingData();
|
|
||||||
Integer balance = (Integer) cacheOrder.get("initBalance");
|
Integer balance = (Integer) cacheOrder.get("initBalance");
|
||||||
CacheRealtimeData cacheRealtimeData = translate(realtimeData);
|
CacheRealtimeData cacheRealtimeData = translate(realtimeData);
|
||||||
balance -= cacheRealtimeData.getAmountCharged();
|
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());
|
cacheRealtimeData.setCreateTime(DateUtil.now());
|
||||||
String lord = orderkey.concat(".lord");
|
String lord = orderkey.concat(".lord");
|
||||||
REDIS.setCacheObject(lord, cacheRealtimeData);
|
REDIS.setCacheObject(lord, cacheRealtimeData);
|
||||||
@ -149,6 +142,16 @@ public class RealtimeDataLogic implements ServiceLogic {
|
|||||||
cacheOrder.put("totalMoney", cacheRealtimeData.getAmountCharged() / 10000.0);
|
cacheOrder.put("totalMoney", cacheRealtimeData.getAmountCharged() / 10000.0);
|
||||||
cacheOrder.put("realtimeDataList", realtimeDataList);
|
cacheOrder.put("realtimeDataList", realtimeDataList);
|
||||||
pileOrderService.pileRimeOrder(orderNo);
|
pileOrderService.pileRimeOrder(orderNo);
|
||||||
|
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");
|
Integer stopSoc = (Integer) cacheOrder.get("stopSoc");
|
||||||
if (stopSoc != null && socInt >= stopSoc) {
|
if (stopSoc != null && socInt >= stopSoc) {
|
||||||
String alerted = (String) cacheOrder.get("socalerted");
|
String alerted = (String) cacheOrder.get("socalerted");
|
||||||
@ -182,6 +185,7 @@ public class RealtimeDataLogic implements ServiceLogic {
|
|||||||
cacheOrder.put("lordiss", "false");
|
cacheOrder.put("lordiss", "false");
|
||||||
pileOrderService.pileStop(orderNo, 4, "订单实时数据恢复");
|
pileOrderService.pileStop(orderNo, 4, "订单实时数据恢复");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Integer errorfreecnt = (Integer) cacheOrder.get("errorfreecnt");
|
Integer errorfreecnt = (Integer) cacheOrder.get("errorfreecnt");
|
||||||
errorfreecnt = errorfreecnt == null ? 1 : ++errorfreecnt;
|
errorfreecnt = errorfreecnt == null ? 1 : ++errorfreecnt;
|
||||||
|
|||||||
@ -36,7 +36,7 @@ public class RateModelTask {
|
|||||||
Collection<String> gks = REDIS.keys(gkPattern);
|
Collection<String> gks = REDIS.keys(gkPattern);
|
||||||
boolean charging = false;
|
boolean charging = false;
|
||||||
for (String gk : gks) {
|
for (String gk : gks) {
|
||||||
if (isInteger(REDIS.getCacheMapValue(gk, "status"))) {
|
if (gk.length() == 20 && isInteger(REDIS.getCacheMapValue(gk, "status"))) {
|
||||||
charging = true;
|
charging = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user