try to solve socket lost then recon successfully issue

This commit is contained in:
ZZ 2022-03-22 16:22:24 +08:00
parent 2ce68c04b9
commit 11f142e34b
2 changed files with 8 additions and 5 deletions

View File

@ -35,7 +35,6 @@ import java.util.Map;
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
import static com.xhpc.common.data.redis.StaticBeanUtil.seqHex;
import static com.xhpc.pp.logic.RegisterLogic.REGISTERED;
import static com.xhpc.pp.server.ChargingPileServer.*;
import static com.xhpc.pp.utils.HexUtils.toHexInt;
@ -158,10 +157,10 @@ public class ChargingController {
if (cachePile.isEmpty()) {
r = R.fail("充电桩未注册");
}
String status = cachePile.get("status");
if (!REGISTERED.equals(status)) {
r = R.fail("充电桩离线");
}
// String status = cachePile.get("status");
// if (!REGISTERED.equals(status)) {
// r = R.fail("充电桩离线");
// }
String gunkey = "gun:".concat(connectorId);
final Map<String, Object> cacheGun = REDIS.getCacheMap(gunkey);
// if (cacheGun.get("orderkey") == null || !cacheGun.get("orderkey").toString().endsWith(orderNo) || !orderNo.contains

View File

@ -1,10 +1,12 @@
package com.xhpc.pp.logic;
import com.xhpc.pp.server.ChargingPileServer;
import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic;
import com.xhpc.pp.utils.HexUtils;
import com.xhpc.pp.utils.security.CRCCalculator;
import org.quickserver.net.server.ClientHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy;
@ -38,6 +40,8 @@ public class HBLogic implements ServiceLogic {
if ("离线".equals(status) || "故障".equals(status)) {
cacheGun.put("status", stable[gunStatus]);
}
ClientHandler handler = ChargingPileServer.getHandler(pileNo);
if (handler == null) return new ServiceResult(ServiceResult.FAIL);
REDIS.setCacheMap(gunkey, cacheGun);
String skey = gunkey.concat(".seqhex");
String seq = seqHex(skey);