完善掉线检测

This commit is contained in:
ZZ 2021-08-09 17:10:54 +08:00
parent 119fd1b872
commit 3172289d4f
2 changed files with 10 additions and 0 deletions

View File

@ -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));

View File

@ -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<String> cachePileNoSet = REDIS.getCacheSet("svcSrvPile:".concat(getLocalIPAndPort()));
for (String pno : cachePileNoSet) {
String pkey = "pile:".concat(pno);
Map<String, Object> cachePile = REDIS.getCacheMap(pkey);
cachePile.put("status", DISCONNECTED);
REDIS.setCacheMap(pkey, cachePile);
}
}
@Autowired