diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/HBLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/HBLogic.java index b0a5e00f..ddff1aeb 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/HBLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/HBLogic.java @@ -27,15 +27,11 @@ public class HBLogic implements ServiceLogic { String pileNo = (String) req.get("pileNo"); String gunId = (String) req.get("gunId"); String gunStatus = (String) req.get("gunStatus"); - int gunStatusInt = 0; - if (ServiceResult.HEX_FAIL.equals(gunStatus)) - gunStatusInt = 1; - String gunKey = pileNo.concat(gunId); + int gunStatusInt = Integer.parseInt(gunStatus); + String gunKey = "gun:".concat(pileNo).concat(gunId); Map cacheGun = REDIS.getCacheMap(gunKey); - int cacheGunStatus = cacheGun.get(gunKey); - if ((1 == cacheGunStatus && 0 == gunStatusInt) || (0 == cacheGunStatus && 1 == gunStatusInt)) { - cacheGun.put(gunKey, gunStatusInt); - } + cacheGun.put("status", gunStatusInt); + 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);