空闲计数器重置

This commit is contained in:
ZZ 2021-10-21 15:59:33 +08:00
parent 062e0c769f
commit df5db7c729

View File

@ -163,20 +163,23 @@ public class RealtimeDataLogic implements ServiceLogic {
} }
REDIS.setCacheMap(orderkey, cacheOrder); REDIS.setCacheMap(orderkey, cacheOrder);
} else { } else {
Integer idleCnt = (Integer) cacheGun.get("idleCnt");
idleCnt = idleCnt == null ? 0 : idleCnt;
idleCnt++;
orderkey = (String) cacheGun.get("orderkey"); orderkey = (String) cacheGun.get("orderkey");
if (idleCnt > 3 && orderkey != null) { if (orderkey != null) {
Map<String, Object> problematicOrder = REDIS.getCacheMap(orderkey); Integer idleCnt = (Integer) cacheGun.get("idleCnt");
Object orderData = problematicOrder.get("orderData"); idleCnt = idleCnt == null ? 0 : idleCnt;
String status = (String) problematicOrder.get("status"); idleCnt++;
if (!isInteger(status) && !status.equals("充电中") && orderData == null) { if (idleCnt > 3 && orderkey != null) {
pileOrderService.abnormalOrder(orderNo); Map<String, Object> problematicOrder = REDIS.getCacheMap(orderkey);
cacheGun.put("orderkey", null); Object orderData = problematicOrder.get("orderData");
String status = (String) problematicOrder.get("status");
if (!isInteger(status) && !status.equals("充电中") && orderData == null) {
pileOrderService.abnormalOrder(orderNo);
cacheGun.put("orderkey", null);
idleCnt = 0;
}
} }
cacheGun.put("idleCnt", idleCnt);
} }
cacheGun.put("idleCnt", idleCnt);
} }
REDIS.setCacheMap(gunkey, cacheGun); REDIS.setCacheMap(gunkey, cacheGun);
return new ServiceResult(false); return new ServiceResult(false);