From 3172289d4fe0ad0983e12d977ac4bae0ceef03f0 Mon Sep 17 00:00:00 2001 From: ZZ Date: Mon, 9 Aug 2021 17:10:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=8E=89=E7=BA=BF=E6=A3=80?= =?UTF-8?q?=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/xhpc/pp/logic/RegisterLogic.java | 1 + .../main/java/com/xhpc/pp/server/ChargingPileServer.java | 9 +++++++++ 2 files changed, 10 insertions(+) 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