|
@@ -6,7 +6,6 @@ import com.cn.esermis.constant.Constant;
|
6
|
6
|
import com.cn.esermis.model.BootNettyChannel;
|
7
|
7
|
import com.cn.esermis.server.PublisherService;
|
8
|
8
|
import com.cn.esermis.utils.HJ212MsgUtils;
|
9
|
|
-import io.netty.buffer.ByteBuf;
|
10
|
9
|
import io.netty.buffer.Unpooled;
|
11
|
10
|
import io.netty.channel.ChannelHandler;
|
12
|
11
|
import io.netty.channel.ChannelHandlerContext;
|
|
@@ -14,6 +13,7 @@ import io.netty.channel.ChannelInboundHandlerAdapter;
|
14
|
13
|
import io.netty.handler.timeout.IdleStateEvent;
|
15
|
14
|
import io.netty.util.CharsetUtil;
|
16
|
15
|
import lombok.extern.log4j.Log4j2;
|
|
16
|
+import org.apache.commons.lang3.ObjectUtils;
|
17
|
17
|
import org.springframework.stereotype.Component;
|
18
|
18
|
|
19
|
19
|
import javax.annotation.PostConstruct;
|
|
@@ -77,12 +77,12 @@ public class BootNettyChannelInboundHandlerAdapter extends ChannelInboundHandler
|
77
|
77
|
return;
|
78
|
78
|
}
|
79
|
79
|
String message = msg.toString();
|
80
|
|
- if (message.contains(Constant.MINUTE_STR) || message.contains(Constant.HOUR_STR)) {
|
|
80
|
+// if (message.contains(Constant.MINUTE_STR) || message.contains(Constant.HOUR_STR)) {
|
81
|
81
|
log.info("=============" + (new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(new Date()) + "=============");
|
82
|
82
|
log.info("收到数据:" + message);
|
83
|
83
|
String reply = HJ212MsgUtils.reply(message);
|
84
|
84
|
ctx.writeAndFlush(reply);
|
85
|
|
- }
|
|
85
|
+// }
|
86
|
86
|
if (message.contains("&&")) {
|
87
|
87
|
String[] split = message.split("&&");
|
88
|
88
|
if (split.length == 3) {
|
|
@@ -90,7 +90,9 @@ public class BootNettyChannelInboundHandlerAdapter extends ChannelInboundHandler
|
90
|
90
|
if ((jsonObject!=null && jsonObject.getString(Constant.CN).equals(Constant.MINUTE))
|
91
|
91
|
||(jsonObject!=null && jsonObject.getString(Constant.CN).equals(Constant.HOUR))){
|
92
|
92
|
// adapter.publisherService.pubMsg(jsonObject);
|
93
|
|
- adapter.redisQueueService.sendMessage(Constant.SERVER, jsonObject);
|
|
93
|
+ if (ObjectUtils.notEqual(jsonObject.get("CN"),Constant.MINUTE_STR)){
|
|
94
|
+ adapter.redisQueueService.sendMessage(Constant.SERVER, jsonObject);
|
|
95
|
+ }
|
94
|
96
|
}
|
95
|
97
|
} else {
|
96
|
98
|
if (dataMap.get(ctx.channel().id().toString()) != null) {
|
|
@@ -99,7 +101,9 @@ public class BootNettyChannelInboundHandlerAdapter extends ChannelInboundHandler
|
99
|
101
|
JSONObject jsonObject = HJ212MsgUtils.dealMsg2(startStr);
|
100
|
102
|
if ((jsonObject!=null && jsonObject.getString(Constant.CN).equals(Constant.MINUTE))
|
101
|
103
|
|| (jsonObject!=null && jsonObject.getString(Constant.CN).equals(Constant.HOUR))){
|
102
|
|
- adapter.redisQueueService.sendMessage(Constant.SERVER, jsonObject);
|
|
104
|
+ if (ObjectUtils.notEqual(jsonObject.get("CN"),Constant.MINUTE_STR)) {
|
|
105
|
+ adapter.redisQueueService.sendMessage(Constant.SERVER, jsonObject);
|
|
106
|
+ }
|
103
|
107
|
// adapter.publisherService.pubMsg(jsonObject);
|
104
|
108
|
}
|
105
|
109
|
dataMap.remove(ctx.channel().id().toString());
|