diff --git a/jsowell-netty/src/main/java/com/jsowell/netty/handler/yunkuaichong/AbstractYkcHandler.java b/jsowell-netty/src/main/java/com/jsowell/netty/handler/yunkuaichong/AbstractYkcHandler.java index ff2ce1d79..1b8d13342 100644 --- a/jsowell-netty/src/main/java/com/jsowell/netty/handler/yunkuaichong/AbstractYkcHandler.java +++ b/jsowell-netty/src/main/java/com/jsowell/netty/handler/yunkuaichong/AbstractYkcHandler.java @@ -9,6 +9,7 @@ import com.jsowell.common.enums.ykc.PileChannelEntity; import com.jsowell.common.util.BytesUtil; import com.jsowell.common.util.CRC16Util; import com.jsowell.common.util.DateUtils; +import com.jsowell.common.util.YKCUtils; import io.netty.channel.ChannelHandlerContext; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; @@ -91,9 +92,11 @@ public abstract class AbstractYkcHandler implements InitializingBean { protected boolean verifyTheDuplicateRequest(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext ctx) { // 获取序列号域 int serialNumber = BytesUtil.bytesToIntLittle(ykcDataProtocol.getSerialNumber()); + // 获取帧类型 + String frameTypeStr = YKCUtils.frameType2Str(ykcDataProtocol.getFrameType()); // 获取channelId String channelId = ctx.channel().id().asShortText(); - String redisKey = "Request_" + channelId + "_" + serialNumber; + String redisKey = "Request_" + channelId + "_" + frameTypeStr; Boolean result = redisCache.setnx(redisKey, ykcDataProtocol.getHEXString(), 30); // result返回false说明没有设置成功,就是说已经有相同请求了,所以返回true重复 return !result;