推迟对时至注册响应下发后

This commit is contained in:
ZZ 2021-08-17 17:12:05 +08:00
parent 71de55915f
commit a8f0416be7

View File

@ -94,13 +94,6 @@ public class ChargingPileBinaryHandler implements ClientBinaryHandler {
String pilekey = "pile:".concat(pileNo); String pilekey = "pile:".concat(pileNo);
if (SERVICE_REGISTER.equals(serviceName) && OK.equals(resultCode)) { if (SERVICE_REGISTER.equals(serviceName) && OK.equals(resultCode)) {
regHandler(handler, pileNo, req); regHandler(handler, pileNo, req);
Date date = Calendar.getInstance().getTime();
String timebin = getTimeBin(seqHex(pilekey.concat("seqhex")), pileNo, date);
Map<String, Object> cachePile = REDIS.getCacheMap(pilekey);
cachePile.put("configTime", DateUtil.format(date, UTC_PATTERN));
REDIS.setCacheMap(pilekey, cachePile);
log.info("server send time config msg >>>> ({}) |{}|", pileNo, timebin);
handler.sendClientBinary(HexUtils.toBytes(timebin));
} else if (SERVICE_RMCR.equals(serviceName) && OK.equals(resultCode)) { } else if (SERVICE_RMCR.equals(serviceName) && OK.equals(resultCode)) {
setCachePileRM(pilekey); setCachePileRM(pilekey);
} }
@ -109,6 +102,14 @@ public class ChargingPileBinaryHandler implements ClientBinaryHandler {
handler.sendClientBinary(result.getBinary()); handler.sendClientBinary(result.getBinary());
if (SERVICE_RMR.equals(serviceName) && OK.equals(resultCode)) { if (SERVICE_RMR.equals(serviceName) && OK.equals(resultCode)) {
setCachePileRM(pilekey); setCachePileRM(pilekey);
} else if (SERVICE_REGISTER.equals(serviceName) && OK.equals(resultCode)) {
Date date = Calendar.getInstance().getTime();
String timebin = getTimeBin(seqHex(pilekey.concat("seqhex")), pileNo, date);
Map<String, Object> cachePile = REDIS.getCacheMap(pilekey);
cachePile.put("configTime", DateUtil.format(date, UTC_PATTERN));
REDIS.setCacheMap(pilekey, cachePile);
log.info("server send time config msg >>>> ({}) |{}|", pileNo, timebin);
handler.sendClientBinary(HexUtils.toBytes(timebin));
} }
} }
} }