::重构::gunkey变量统一
This commit is contained in:
parent
8dc79f02f4
commit
6d85f00fac
@ -82,8 +82,8 @@ public class ChargingController {
|
|||||||
ClientHandler clientHandler = ChargingPileServer.getHandler(pileNo);
|
ClientHandler clientHandler = ChargingPileServer.getHandler(pileNo);
|
||||||
if (clientHandler == null) return R.fail("充电桩没有连接到上次注册的服务器");
|
if (clientHandler == null) return R.fail("充电桩没有连接到上次注册的服务器");
|
||||||
try {
|
try {
|
||||||
String gunKey = "gun:".concat(pileNo).concat(startChargingData.getGunId());
|
String gunkey = "gun:".concat(pileNo).concat(startChargingData.getGunId());
|
||||||
String skey = gunKey.concat(".seqhex");
|
String skey = gunkey.concat(".seqhex");
|
||||||
String seq = seqHex(skey);
|
String seq = seqHex(skey);
|
||||||
byte[] msg = translateSucc(startChargingData, seq);
|
byte[] msg = translateSucc(startChargingData, seq);
|
||||||
clientHandler.sendClientBinary(msg);
|
clientHandler.sendClientBinary(msg);
|
||||||
|
|||||||
@ -28,10 +28,10 @@ public class HBLogic implements ServiceLogic {
|
|||||||
String gunId = (String) req.get("gunId");
|
String gunId = (String) req.get("gunId");
|
||||||
String gunStatus = (String) req.get("gunStatus");
|
String gunStatus = (String) req.get("gunStatus");
|
||||||
int gunStatusInt = Integer.parseInt(gunStatus);
|
int gunStatusInt = Integer.parseInt(gunStatus);
|
||||||
String gunKey = "gun:".concat(pileNo).concat(gunId);
|
String gunkey = "gun:".concat(pileNo).concat(gunId);
|
||||||
Map<String, Integer> cacheGun = REDIS.getCacheMap(gunKey);
|
Map<String, Integer> cacheGun = REDIS.getCacheMap(gunkey);
|
||||||
cacheGun.put("status", gunStatusInt);
|
cacheGun.put("status", gunStatusInt);
|
||||||
REDIS.setCacheMap(gunKey, cacheGun);
|
REDIS.setCacheMap(gunkey, cacheGun);
|
||||||
String resultStr = "680D00000004".concat(pileNo).concat(gunId).concat(ServiceResult.HEX_OK);
|
String resultStr = "680D00000004".concat(pileNo).concat(gunId).concat(ServiceResult.HEX_OK);
|
||||||
resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr));
|
resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr));
|
||||||
return new ServiceResult(HexUtils.toBytes(resultStr), ServiceResult.OK);
|
return new ServiceResult(HexUtils.toBytes(resultStr), ServiceResult.OK);
|
||||||
|
|||||||
@ -34,11 +34,11 @@ public class RealtimeDataLogic implements ServiceLogic {
|
|||||||
String status = realtimeData.getStatus();
|
String status = realtimeData.getStatus();
|
||||||
realtimeData.setCreateBy("SYSTEM");
|
realtimeData.setCreateBy("SYSTEM");
|
||||||
realtimeData.setCreateTime(Calendar.getInstance().getTime());
|
realtimeData.setCreateTime(Calendar.getInstance().getTime());
|
||||||
String pileGun = pileNo.concat(gunId);
|
String gunkey = "gun:".concat(pileNo).concat(gunId);
|
||||||
Map<String, Object> cacheGun = REDIS.getCacheMap(pileGun);
|
Map<String, Object> cacheGun = REDIS.getCacheMap(gunkey);
|
||||||
cacheGun.put("status", status);
|
cacheGun.put("status", status);
|
||||||
cacheGun.put("soc", realtimeData.getSoc());
|
cacheGun.put("soc", realtimeData.getSoc());
|
||||||
REDIS.setCacheMap(pileGun, cacheGun);
|
REDIS.setCacheMap(gunkey, cacheGun);
|
||||||
String orderNo = realtimeData.getOrderNo();
|
String orderNo = realtimeData.getOrderNo();
|
||||||
Map<String, Object> order = REDIS.getCacheMap(orderNo);
|
Map<String, Object> order = REDIS.getCacheMap(orderNo);
|
||||||
List<RealtimeData> realtimeDataList = (List<RealtimeData>) order.get("realtimeDataList");
|
List<RealtimeData> realtimeDataList = (List<RealtimeData>) order.get("realtimeDataList");
|
||||||
|
|||||||
@ -39,10 +39,10 @@ public class RegisterLogic implements ServiceLogic {
|
|||||||
int gunNum = Integer.parseInt(req.get("gunNum").toString());
|
int gunNum = Integer.parseInt(req.get("gunNum").toString());
|
||||||
for (int gunN = 1; gunN <= gunNum; gunN++) {
|
for (int gunN = 1; gunN <= gunNum; gunN++) {
|
||||||
String gunId = String.format("%02d", (int) gunN);
|
String gunId = String.format("%02d", (int) gunN);
|
||||||
String gunKey = "gun:".concat(pileNo.concat(gunId));
|
String gunkey = "gun:".concat(pileNo.concat(gunId));
|
||||||
Map<String, Object> cacheGun = REDIS.getCacheMap(gunKey);
|
Map<String, Object> cacheGun = REDIS.getCacheMap(gunkey);
|
||||||
cacheGun.put("svcSrv", getLocalIPAndPort());
|
cacheGun.put("svcSrv", getLocalIPAndPort());
|
||||||
REDIS.setCacheMap(gunKey, cacheGun);
|
REDIS.setCacheMap(gunkey, cacheGun);
|
||||||
}
|
}
|
||||||
String resultStr = "680C00000002".concat(pileNo).concat(hexCode);
|
String resultStr = "680C00000002".concat(pileNo).concat(hexCode);
|
||||||
resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr));
|
resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr));
|
||||||
|
|||||||
@ -113,8 +113,8 @@ public class ChargingPileBinaryHandler implements ClientBinaryHandler {
|
|||||||
int gunNum = Integer.parseInt(req.get("gunNum").toString());
|
int gunNum = Integer.parseInt(req.get("gunNum").toString());
|
||||||
for (int gunN = 1; gunN <= gunNum; gunN++) {
|
for (int gunN = 1; gunN <= gunNum; gunN++) {
|
||||||
String gunId = String.format("%02d", (int) gunN);
|
String gunId = String.format("%02d", (int) gunN);
|
||||||
String gunKey = pileNo.concat(gunId);
|
String gunkey = pileNo.concat(gunId);
|
||||||
cachePileGunSvcSrv("svcSrvGun:", gunKey);
|
cachePileGunSvcSrv("svcSrvGun:", gunkey);
|
||||||
}
|
}
|
||||||
log.info("pile registering >>>> [{}] ", pileNo);
|
log.info("pile registering >>>> [{}] ", pileNo);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user