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