diff --git a/jcpp-infrastructure-cache/src/main/java/sanbing/jcpp/infrastructure/cache/VersionedCaffeineCache.java b/jcpp-infrastructure-cache/src/main/java/sanbing/jcpp/infrastructure/cache/VersionedCaffeineCache.java index 9e7ede6..84d25ba 100644 --- a/jcpp-infrastructure-cache/src/main/java/sanbing/jcpp/infrastructure/cache/VersionedCaffeineCache.java +++ b/jcpp-infrastructure-cache/src/main/java/sanbing/jcpp/infrastructure/cache/VersionedCaffeineCache.java @@ -12,7 +12,7 @@ import java.io.Serializable; public abstract class VersionedCaffeineCache extends CaffeineTransactionalCache implements VersionedCache { - public VersionedCaffeineCache(CacheManager cacheManager, String cacheName) { + protected VersionedCaffeineCache(CacheManager cacheManager, String cacheName) { super(cacheManager, cacheName); } diff --git a/jcpp-infrastructure-queue/src/main/java/sanbing/jcpp/infrastructure/queue/AbstractQueueConsumerTemplate.java b/jcpp-infrastructure-queue/src/main/java/sanbing/jcpp/infrastructure/queue/AbstractQueueConsumerTemplate.java index 88914e8..07375ce 100644 --- a/jcpp-infrastructure-queue/src/main/java/sanbing/jcpp/infrastructure/queue/AbstractQueueConsumerTemplate.java +++ b/jcpp-infrastructure-queue/src/main/java/sanbing/jcpp/infrastructure/queue/AbstractQueueConsumerTemplate.java @@ -60,7 +60,7 @@ public abstract class AbstractQueueConsumerTemplate imple List records; long startNanos = System.nanoTime(); if (stopped) { - log.error("poll invoked but consumer stopped for topic " + topic, new RuntimeException("stacktrace")); + log.error("poll invoked but consumer stopped for topic {}", topic, new RuntimeException("stacktrace")); return emptyList(); } if (!subscribed && partitions == null && subscribeQueue.isEmpty()) { @@ -68,7 +68,7 @@ public abstract class AbstractQueueConsumerTemplate imple } if (consumerLock.isLocked()) { - log.error("poll. consumerLock is locked. will wait with no timeout. it looks like a race conditions or deadlock topic " + topic, new RuntimeException("stacktrace")); + log.error("poll. consumerLock is locked. will wait with no timeout. it looks like a race conditions or deadlock topic {}", topic, new RuntimeException("stacktrace")); } consumerLock.lock(); @@ -132,7 +132,7 @@ public abstract class AbstractQueueConsumerTemplate imple @Override public void commit() { if (consumerLock.isLocked()) { - log.error("commit. consumerLock is locked. will wait with no timeout. it looks like a race conditions or deadlock topic " + topic, new RuntimeException("stacktrace")); + log.error("commit. consumerLock is locked. will wait with no timeout. it looks like a race conditions or deadlock topic {}", topic, new RuntimeException("stacktrace")); } consumerLock.lock(); try { diff --git a/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/AbstractYunKuaiChongCmdExe.java b/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/AbstractYunKuaiChongCmdExe.java index 0d98b61..84ea84f 100644 --- a/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/AbstractYunKuaiChongCmdExe.java +++ b/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/AbstractYunKuaiChongCmdExe.java @@ -57,10 +57,10 @@ public class AbstractYunKuaiChongCmdExe { return TOP_BYTE; case PEAK: return PEAK_BYTE; - case FLAT: - return FLAT_BYTE; case VALLEY: return VALLEY_BYTE; + default: + return FLAT_BYTE; } } } diff --git a/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/v150/YunKuaiChongV15ProtocolMessageProcessor.java b/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/v150/YunKuaiChongV15ProtocolMessageProcessor.java index 04d18c8..66f4b8b 100644 --- a/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/v150/YunKuaiChongV15ProtocolMessageProcessor.java +++ b/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/v150/YunKuaiChongV15ProtocolMessageProcessor.java @@ -34,8 +34,8 @@ import static sanbing.jcpp.infrastructure.util.codec.ByteUtil.checkCrcSum; @Slf4j public class YunKuaiChongV15ProtocolMessageProcessor extends ProtocolMessageProcessor { - private final Map UPLINK_CMD_EXE_MAP = new ConcurrentHashMap<>(); - private final Map DOWNLINK_CMD_EXE_MAP = new ConcurrentHashMap<>(); + private final Map uplinkCmdExeMap = new ConcurrentHashMap<>(); + private final Map downlinkCmdExeMap = new ConcurrentHashMap<>(); public YunKuaiChongV15ProtocolMessageProcessor(Forwarder forwarder, ProtocolContext protocolContext) { super(forwarder, protocolContext); @@ -46,8 +46,10 @@ public class YunKuaiChongV15ProtocolMessageProcessor extends ProtocolMessageProc byte cmd = clazz.getAnnotation(YunKuaiChongCmd.class).value(); try { YunKuaiChongUplinkCmdExe yunKuaiChongUplinkCmdExe = (YunKuaiChongUplinkCmdExe) clazz.getDeclaredConstructor().newInstance(); - UPLINK_CMD_EXE_MAP.put(cmd, yunKuaiChongUplinkCmdExe); - } catch (InstantiationException | IllegalAccessException | InvocationTargetException | + uplinkCmdExeMap.put(cmd, yunKuaiChongUplinkCmdExe); + } catch (InstantiationException | + IllegalAccessException | + InvocationTargetException | NoSuchMethodException e) { throw new RuntimeException(e); } @@ -58,8 +60,10 @@ public class YunKuaiChongV15ProtocolMessageProcessor extends ProtocolMessageProc byte cmd = clazz.getAnnotation(YunKuaiChongCmd.class).value(); try { YunKuaiChongDownlinkCmdExe yunKuaiChongDownlinkCmdExe = (YunKuaiChongDownlinkCmdExe) clazz.getDeclaredConstructor().newInstance(); - DOWNLINK_CMD_EXE_MAP.put(cmd, yunKuaiChongDownlinkCmdExe); - } catch (InstantiationException | IllegalAccessException | InvocationTargetException | + downlinkCmdExeMap.put(cmd, yunKuaiChongDownlinkCmdExe); + } catch (InstantiationException | + IllegalAccessException | + InvocationTargetException | NoSuchMethodException e) { throw new RuntimeException(e); } @@ -184,7 +188,7 @@ public class YunKuaiChongV15ProtocolMessageProcessor extends ProtocolMessageProc } private void exeCmd(YunKuaiChongUplinkMessage message, TcpSession session) { - YunKuaiChongUplinkCmdExe uplinkCmdExe = UPLINK_CMD_EXE_MAP.get((byte) message.getCmd()); + YunKuaiChongUplinkCmdExe uplinkCmdExe = uplinkCmdExeMap.get((byte) message.getCmd()); if (uplinkCmdExe == null) { @@ -197,7 +201,7 @@ public class YunKuaiChongV15ProtocolMessageProcessor extends ProtocolMessageProc } private void exeCmd(YunKuaiChongDwonlinkMessage message, TcpSession session) { - YunKuaiChongDownlinkCmdExe downlinkCmdExe = DOWNLINK_CMD_EXE_MAP.get((byte) message.getCmd()); + YunKuaiChongDownlinkCmdExe downlinkCmdExe = downlinkCmdExeMap.get((byte) message.getCmd()); if (downlinkCmdExe == null) { diff --git a/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/v150/cmd/YunKuaiChongV150BmsHandshakeULCmd.java b/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/v150/cmd/YunKuaiChongV150BmsHandshakeULCmd.java index b5126a3..36f35f8 100644 --- a/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/v150/cmd/YunKuaiChongV150BmsHandshakeULCmd.java +++ b/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/v150/cmd/YunKuaiChongV150BmsHandshakeULCmd.java @@ -44,12 +44,12 @@ public class YunKuaiChongV150BmsHandshakeULCmd extends YunKuaiChongUplinkCmdExe byte[] pileCodeBytes = new byte[7]; byteBuf.readBytes(pileCodeBytes); String pileCode = BCDUtil.toString(pileCodeBytes); - additionalInfo.put("桩编号", tradeNo); + additionalInfo.put("桩编号", pileCode); // 3.抢号 byte gunCodeByte = byteBuf.readByte(); String gunCode = BCDUtil.toString(gunCodeByte); - additionalInfo.put("抢号", tradeNo); + additionalInfo.put("抢号", gunCode); // 4.BMS 通信协议版本号 byte[] bmsConnectVersionBytes = new byte[3]; diff --git a/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/v150/cmd/YunKuaiChongV150QueryPricingModelAckDLCmd.java b/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/v150/cmd/YunKuaiChongV150QueryPricingModelAckDLCmd.java index 3094e62..8c6a732 100644 --- a/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/v150/cmd/YunKuaiChongV150QueryPricingModelAckDLCmd.java +++ b/jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/v150/cmd/YunKuaiChongV150QueryPricingModelAckDLCmd.java @@ -7,7 +7,6 @@ package sanbing.jcpp.protocol.yunkuaichong.v150.cmd; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import lombok.extern.slf4j.Slf4j; -import sanbing.jcpp.infrastructure.util.jackson.JacksonUtil; import sanbing.jcpp.proto.gen.ProtocolProto.FlagPriceProto; import sanbing.jcpp.proto.gen.ProtocolProto.PeriodProto; import sanbing.jcpp.proto.gen.ProtocolProto.PricingModelProto; @@ -16,7 +15,6 @@ import sanbing.jcpp.protocol.ProtocolContext; import sanbing.jcpp.protocol.listener.tcp.TcpSession; import sanbing.jcpp.protocol.yunkuaichong.YunKuaiChongDownlinkCmdExe; import sanbing.jcpp.protocol.yunkuaichong.YunKuaiChongDwonlinkMessage; -import sanbing.jcpp.protocol.yunkuaichong.YunKuaiChongUplinkMessage; import sanbing.jcpp.protocol.yunkuaichong.annotation.YunKuaiChongCmd; import java.math.BigDecimal; @@ -46,8 +44,6 @@ public class YunKuaiChongV150QueryPricingModelAckDLCmd extends YunKuaiChongDownl QueryPricingResponse queryPricingResponse = yunKuaiChongDwonlinkMessage.getMsg().getQueryPricingResponse(); - YunKuaiChongUplinkMessage requestData = JacksonUtil.fromBytes(yunKuaiChongDwonlinkMessage.getMsg().getRequestData().toByteArray(), YunKuaiChongUplinkMessage.class); - long pricingId = queryPricingResponse.getPricingId(); String pileCode = queryPricingResponse.getPileCode(); PricingModelProto pricingModel = queryPricingResponse.getPricingModel();