充电桩500ms响应保护

This commit is contained in:
ZZ 2021-10-12 17:19:45 +08:00
parent 2423204e12
commit c34091f8cf
2 changed files with 5 additions and 2 deletions

View File

@ -223,6 +223,8 @@ public class ChargingController {
return R.fail("充电桩连接已断开,请稍后再试一次");
}
try {
String pileKey = "pile:".concat(pileNo);
if (CacheDataUtils.hori(pileKey)) return R.fail("充电桩正在忙碌,请重试");
String gunkey = "gun:".concat(pileNo).concat(startChargingData.getGunId());
Map<String, Object> cacheGun = REDIS.getCacheMap(gunkey);
String gunstatus = (String) cacheGun.get("status");
@ -269,8 +271,9 @@ public class ChargingController {
return R.fail("充电桩没有连接到上次注册的服务器,请稍后再试一次");
}
try {
String pileKey = "pile:".concat(pileNo);
if (CacheDataUtils.hori(pileKey)) return R.fail("充电桩正在忙碌,请重试");
String gunkey = "gun:".concat(pileNo).concat(gunId);
if (CacheDataUtils.hori(gunkey)) return R.fail("充电桩正在忙碌,请稍后再试");
String skey = gunkey.concat(".seqhex");
String seq = seqHex(skey);
byte[] msg = translateStop(pileNo, gunId, version, seq);

View File

@ -57,7 +57,7 @@ public class CacheDataUtils {
if (HORI != null) {
return true;
}
REDIS.setCacheObject(hori, "protection film", 3000L, TimeUnit.MILLISECONDS);
REDIS.setCacheObject(hori, "protection film", 500L, TimeUnit.MILLISECONDS);
return false;
}