diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RegisterLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RegisterLogic.java index d8cc0f1a..4094a263 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RegisterLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RegisterLogic.java @@ -57,6 +57,7 @@ public class RegisterLogic implements ServiceLogic { cacheGun.put("svcSrv", localIPAndPort); REDIS.setCacheMap(gunkey, cacheGun); } + log.info("pile (re)registered ({}) ", pileNo); } String resultStr = "680C00000002".concat(pileNo).concat(hexCode); resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr)); diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/server/ChargingPileServer.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/server/ChargingPileServer.java index de10558f..446f6dcc 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/server/ChargingPileServer.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/server/ChargingPileServer.java @@ -20,7 +20,9 @@ import javax.annotation.PostConstruct; import java.io.IOException; import java.util.HashMap; import java.util.Map; +import java.util.Set; +import static com.xhpc.pp.config.EarlierBeanConf.getLocalIPAndPort; import static com.xhpc.pp.logic.RegisterLogic.DISCONNECTED; @@ -48,6 +50,13 @@ public class ChargingPileServer { public void init() { REDIS = redisService; + Set cachePileNoSet = REDIS.getCacheSet("svcSrvPile:".concat(getLocalIPAndPort())); + for (String pno : cachePileNoSet) { + String pkey = "pile:".concat(pno); + Map cachePile = REDIS.getCacheMap(pkey); + cachePile.put("status", DISCONNECTED); + REDIS.setCacheMap(pkey, cachePile); + } } @Autowired