移除无用代码;防白嫖

This commit is contained in:
ZZ 2022-06-08 11:45:38 +08:00
parent c047d03fbf
commit 9eb7162561
2 changed files with 15 additions and 41 deletions

View File

@ -66,13 +66,13 @@ public class OrderDataLogic implements ServiceLogic {
cacheOrder.put("orderData", cacheOrderData);
cacheOrder.put("status", "已结束");
cacheOrder.put("stopReason", translate(cacheOrderData.getStopReason()));
cacheOrder.put("stopReasonHex", cacheOrderData.getStopReason());
REDIS.setCacheMap(orderkey, cacheOrder);
String gunkey = "gun:".concat(orderData.getPileNo()).concat(orderData.getGunId());
Map<String, Object> cacheGun = REDIS.getCacheMap(gunkey);
cacheGun.put("orderstoptime", cacheOrderData.getEndTime());
cacheGun.put("orderkey", null);
REDIS.setCacheMap(gunkey, cacheGun);
Long rdtime = (Long) cacheOrder.get("rdtime");
Map<String, Object> cachePile = REDIS.getCacheMap("pile:".concat(orderData.getPileNo()));
if (cachePile.get("version").equals("0C")) {
final String hex = orderData.getHex();

View File

@ -142,7 +142,6 @@ public class RealtimeDataLogic implements ServiceLogic {
}
cacheOrder.put("rbalance", balance);
cacheOrder.put("remainingTime", tr);
cacheOrder.put("rdtime", DateUtil.calendar().getTime().getTime());
cacheOrder.put("status", statusplain);
cacheOrder.put("totalPower", cacheRealtimeData.getChargingDegree() / 10000.0);
cacheOrder.put("totalMoney", cacheRealtimeData.getAmountCharged() / 10000.0);
@ -204,10 +203,10 @@ public class RealtimeDataLogic implements ServiceLogic {
errorfreecnt = errorfreecnt == null ? 1 : ++errorfreecnt;
if (errorfreecnt == 2) {
CacheRealtimeData cacheRData = REDIS.getCacheObject(orderkey.concat(".lord"));
R r = null;
R r;
if (cacheRData == null) {
r = pileOrderService.abnormalOrder(orderNo);
cacheOrder.put("abnormal", "1.1");//lord is null
cacheOrder.put("abnormal", "1.1 lord is null");
log.error("abnormal.1 order[{}]", orderNo);
} else {
CacheOrderData lordAsOd = new CacheOrderData(cacheRData, (String) cacheOrder.get("pileStartTime"),
@ -215,10 +214,11 @@ public class RealtimeDataLogic implements ServiceLogic {
cacheOrder.put("orderData", lordAsOd);
r = pileOrderService.pileEndOrder(orderNo);
REDIS.setCacheMap(orderkey, cacheOrder);
cacheOrder.put("abnormal", "1.2");//lord as orderData
cacheOrder.put("abnormal", "1.2 lord as orderData");
log.error("abnormal.1.2 order[{}]", orderNo);
cacheOrder.put("status", "已结束");
}
chargingController.stopCharging(pileNo, gunId, default_version);
cacheOrder.put("status", "空闲>2下发中止");
if (r == null || r.getCode() != 200) {
log.error("errorfreecnt r{}", JSONUtil.toJsonStr(r));
errorfreecnt = 1;
@ -228,43 +228,17 @@ public class RealtimeDataLogic implements ServiceLogic {
}
REDIS.setCacheMap(orderkey, cacheOrder);
} else {
if (statusInt == 3) {
chargingController.stopCharging(pileNo, gunId, default_version);
Integer bpcnt = (Integer) cacheGun.get("pleek.bp.cnt");
cacheGun.put("pleek.bp.cnt", bpcnt==null?1:bpcnt++);
cacheGun.put("pleek.bp.lt", DateUtil.now());
orderkey = (String) cacheGun.get("orderkey");
Integer idleCnt = (Integer) cacheGun.get("idleCnt");
if (orderkey != null && statusInt != 3) {
idleCnt = idleCnt == null ? 0 : idleCnt;
idleCnt++;
if (idleCnt >= 2) {
if (orderkey.length() > 0) {
Map<String, Object> problematicOrder = REDIS.getCacheMap(orderkey);
CacheRealtimeData cacheRealtimeData = REDIS.getCacheObject(orderkey.concat(".lord"));
if (problematicOrder != null && cacheRealtimeData != null) {
Integer startSoc = (Integer) problematicOrder.get("startSoc");
Integer endSoc = (Integer) problematicOrder.get("endSoc");
problematicOrder.put("orderData", new CacheOrderData(cacheRealtimeData,
(String) problematicOrder.get("startTime"),
startSoc == null ? 0 : startSoc, endSoc == null ? 0 : endSoc));
log.error("abnormal.2.1 order[{}]", orderNo);
cacheOrder.put("abnormal", "2.1");
cacheOrder.put("status", "已结束");
} else {
log.error("abnormal.2.2 order[{}]", orderNo);
cacheOrder.put("abnormal", "2.2");//not respond
String pushOrderKey = orderkey.replace("order:", "pushOrder:");
if (REDIS.getCacheMap(pushOrderKey) != null) {
REDIS.setCacheMapValue(pushOrderKey, "startChargeSeqStat", 4);
if (orderkey!=null) {
cacheGun.put("pleek.bp.lo", orderkey);
REDIS.setCacheMapValue(orderkey, "stopReason.pleek", "bp");
}
}
orderNo = orderkey.replace("order:", "");
pileOrderService.abnormalOrder(orderNo);
cacheGun.put("orderkey", null);
idleCnt = 0;
cacheGun.put("idleCnt", idleCnt);
}
}
} else {
idleCnt = 0;
cacheGun.put("idleCnt", idleCnt);
}
}
REDIS.setCacheMap(gunkey, cacheGun);
return new ServiceResult(false);