::重构::gunkey变量统一

This commit is contained in:
ZZ 2021-08-03 17:59:02 +08:00
parent 8dc79f02f4
commit 6d85f00fac
5 changed files with 13 additions and 13 deletions

View File

@ -82,8 +82,8 @@ public class ChargingController {
ClientHandler clientHandler = ChargingPileServer.getHandler(pileNo);
if (clientHandler == null) return R.fail("充电桩没有连接到上次注册的服务器");
try {
String gunKey = "gun:".concat(pileNo).concat(startChargingData.getGunId());
String skey = gunKey.concat(".seqhex");
String gunkey = "gun:".concat(pileNo).concat(startChargingData.getGunId());
String skey = gunkey.concat(".seqhex");
String seq = seqHex(skey);
byte[] msg = translateSucc(startChargingData, seq);
clientHandler.sendClientBinary(msg);

View File

@ -28,10 +28,10 @@ public class HBLogic implements ServiceLogic {
String gunId = (String) req.get("gunId");
String gunStatus = (String) req.get("gunStatus");
int gunStatusInt = Integer.parseInt(gunStatus);
String gunKey = "gun:".concat(pileNo).concat(gunId);
Map<String, Integer> cacheGun = REDIS.getCacheMap(gunKey);
String gunkey = "gun:".concat(pileNo).concat(gunId);
Map<String, Integer> cacheGun = REDIS.getCacheMap(gunkey);
cacheGun.put("status", gunStatusInt);
REDIS.setCacheMap(gunKey, cacheGun);
REDIS.setCacheMap(gunkey, cacheGun);
String resultStr = "680D00000004".concat(pileNo).concat(gunId).concat(ServiceResult.HEX_OK);
resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr));
return new ServiceResult(HexUtils.toBytes(resultStr), ServiceResult.OK);

View File

@ -34,11 +34,11 @@ public class RealtimeDataLogic implements ServiceLogic {
String status = realtimeData.getStatus();
realtimeData.setCreateBy("SYSTEM");
realtimeData.setCreateTime(Calendar.getInstance().getTime());
String pileGun = pileNo.concat(gunId);
Map<String, Object> cacheGun = REDIS.getCacheMap(pileGun);
String gunkey = "gun:".concat(pileNo).concat(gunId);
Map<String, Object> cacheGun = REDIS.getCacheMap(gunkey);
cacheGun.put("status", status);
cacheGun.put("soc", realtimeData.getSoc());
REDIS.setCacheMap(pileGun, cacheGun);
REDIS.setCacheMap(gunkey, cacheGun);
String orderNo = realtimeData.getOrderNo();
Map<String, Object> order = REDIS.getCacheMap(orderNo);
List<RealtimeData> realtimeDataList = (List<RealtimeData>) order.get("realtimeDataList");

View File

@ -39,10 +39,10 @@ public class RegisterLogic implements ServiceLogic {
int gunNum = Integer.parseInt(req.get("gunNum").toString());
for (int gunN = 1; gunN <= gunNum; gunN++) {
String gunId = String.format("%02d", (int) gunN);
String gunKey = "gun:".concat(pileNo.concat(gunId));
Map<String, Object> cacheGun = REDIS.getCacheMap(gunKey);
String gunkey = "gun:".concat(pileNo.concat(gunId));
Map<String, Object> cacheGun = REDIS.getCacheMap(gunkey);
cacheGun.put("svcSrv", getLocalIPAndPort());
REDIS.setCacheMap(gunKey, cacheGun);
REDIS.setCacheMap(gunkey, cacheGun);
}
String resultStr = "680C00000002".concat(pileNo).concat(hexCode);
resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr));

View File

@ -113,8 +113,8 @@ public class ChargingPileBinaryHandler implements ClientBinaryHandler {
int gunNum = Integer.parseInt(req.get("gunNum").toString());
for (int gunN = 1; gunN <= gunNum; gunN++) {
String gunId = String.format("%02d", (int) gunN);
String gunKey = pileNo.concat(gunId);
cachePileGunSvcSrv("svcSrvGun:", gunKey);
String gunkey = pileNo.concat(gunId);
cachePileGunSvcSrv("svcSrvGun:", gunkey);
}
log.info("pile registering >>>> [{}] ", pileNo);
}