tf after reg; log rmv ost to debug at prod/test env
This commit is contained in:
parent
261173783d
commit
f2e711390c
@ -8,7 +8,6 @@ import com.xhpc.common.data.up.RealtimeData;
|
||||
import com.xhpc.pp.tx.ServiceParameter;
|
||||
import com.xhpc.pp.tx.ServiceResult;
|
||||
import com.xhpc.pp.tx.logic.ServiceLogic;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -117,11 +116,13 @@ public class RealtimeDataLogic implements ServiceLogic {
|
||||
Long orderstarttime = (Long) cacheGun.get("orderstarttime");
|
||||
Long orderstoptime = (Long) cacheGun.get("orderstoptime");
|
||||
orderkey = (String) cacheGun.get("orderkey");
|
||||
log.info("--0s order rtd--");
|
||||
if (orderstarttime != null && orderkey != null && realtimeDataList == null && Calendar.getInstance().getTimeInMillis() - orderstarttime > 90 * 1000) {
|
||||
pileOrderService.pileStartup(orderNo, 2, "终端90秒内没有响应");
|
||||
cacheGun.remove("orderkey");
|
||||
cacheGun.remove("orderstarttime");
|
||||
REDIS.setCacheMap(gunkey, cacheGun);
|
||||
log.info("--rmv ost--");
|
||||
} else if (orderstoptime != null && orderkey != null && Calendar.getInstance().getTimeInMillis() - orderstoptime > 90 * 1000) {
|
||||
pileOrderService.pileStop(orderNo, 2, "终端90秒内没有响应");
|
||||
cacheGun.remove("orderstoptime");
|
||||
|
||||
@ -92,7 +92,10 @@ public class ChargingPileBinaryHandler implements ClientBinaryHandler {
|
||||
ServiceResult result = servicemainLogic.process(sp);
|
||||
String resultCode = result.getCode();
|
||||
String pilekey = "pile:".concat(pileNo);
|
||||
Map<String, Object> cachePile = REDIS.getCacheMap(pilekey);
|
||||
if (SERVICE_REGISTER.equals(serviceName) && OK.equals(resultCode)) {
|
||||
cachePile.put("tf", false);
|
||||
REDIS.setCacheMap(pilekey, cachePile);
|
||||
regHandler(handler, pileNo, req);
|
||||
} else if (SERVICE_RMCR.equals(serviceName) && OK.equals(resultCode)) {
|
||||
setCachePileRM(pilekey);
|
||||
@ -102,14 +105,18 @@ public class ChargingPileBinaryHandler implements ClientBinaryHandler {
|
||||
handler.sendClientBinary(result.getBinary());
|
||||
if (SERVICE_RMR.equals(serviceName) && OK.equals(resultCode)) {
|
||||
setCachePileRM(pilekey);
|
||||
} else if (SERVICE_REGISTER.equals(serviceName) && OK.equals(resultCode)) {
|
||||
Date date = Calendar.getInstance().getTime();
|
||||
String timebin = getTimeBin(seqHex(pilekey.concat("seqhex")), pileNo, date);
|
||||
Map<String, Object> cachePile = REDIS.getCacheMap(pilekey);
|
||||
cachePile.put("configTime", DateUtil.format(date, UTC_SIMPLE_PATTERN));
|
||||
REDIS.setCacheMap(pilekey, cachePile);
|
||||
log.info("server send time config msg >>>> ({}) |{}|", pileNo, timebin);
|
||||
handler.sendClientBinary(HexUtils.toBytes(timebin));
|
||||
} else if (SERVICE_HB.equals(serviceName) && OK.equals(resultCode)) {
|
||||
Boolean timeconfigured = (Boolean) cachePile.get("tf");
|
||||
if (!timeconfigured) {
|
||||
Date date = Calendar.getInstance().getTime();
|
||||
String timebin = getTimeBin(seqHex(pilekey.concat("seqhex")), pileNo, date);
|
||||
cachePile.put("configTime", DateUtil.format(date, UTC_SIMPLE_PATTERN));
|
||||
REDIS.setCacheMap(pilekey, cachePile);
|
||||
log.info("server send time config msg >>>> ({}) |{}|", pileNo, timebin);
|
||||
handler.sendClientBinary(HexUtils.toBytes(timebin));
|
||||
cachePile.put("tf", true);
|
||||
REDIS.setCacheMap(pilekey, cachePile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user