完善掉线检测
This commit is contained in:
parent
119fd1b872
commit
3172289d4f
@ -57,6 +57,7 @@ public class RegisterLogic implements ServiceLogic {
|
|||||||
cacheGun.put("svcSrv", localIPAndPort);
|
cacheGun.put("svcSrv", localIPAndPort);
|
||||||
REDIS.setCacheMap(gunkey, cacheGun);
|
REDIS.setCacheMap(gunkey, cacheGun);
|
||||||
}
|
}
|
||||||
|
log.info("pile (re)registered ({}) ", pileNo);
|
||||||
}
|
}
|
||||||
String resultStr = "680C00000002".concat(pileNo).concat(hexCode);
|
String resultStr = "680C00000002".concat(pileNo).concat(hexCode);
|
||||||
resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr));
|
resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr));
|
||||||
|
|||||||
@ -20,7 +20,9 @@ import javax.annotation.PostConstruct;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static com.xhpc.pp.config.EarlierBeanConf.getLocalIPAndPort;
|
||||||
import static com.xhpc.pp.logic.RegisterLogic.DISCONNECTED;
|
import static com.xhpc.pp.logic.RegisterLogic.DISCONNECTED;
|
||||||
|
|
||||||
|
|
||||||
@ -48,6 +50,13 @@ public class ChargingPileServer {
|
|||||||
public void init() {
|
public void init() {
|
||||||
|
|
||||||
REDIS = redisService;
|
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
|
@Autowired
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user