|
@@ -3,6 +3,9 @@ package com.persagy.dmp.starter.alarm.communication.netty;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.persagy.dmp.starter.alarm.communication.mq.model.DmpMessage;
|
|
|
+import com.persagy.dmp.starter.alarm.feign.DmpResult;
|
|
|
+import com.persagy.dmp.starter.alarm.feign.client.AlarmClient;
|
|
|
+import com.persagy.dmp.starter.alarm.service.BaseService;
|
|
|
import com.persagy.dmp.starter.alarm.service.NettyAlarmService;
|
|
|
import com.persagy.dmp.starter.alarm.util.StringUtil;
|
|
|
import io.netty.channel.Channel;
|
|
@@ -37,6 +40,14 @@ public class NettyAlarmMsgBaseHandler extends ChannelInboundHandlerAdapter {
|
|
|
|
|
|
@Autowired
|
|
|
private NettyAlarmService nettyAlarmService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private AlarmClient alarmClient;
|
|
|
+
|
|
|
+ private BaseService baseService = new BaseService();
|
|
|
+
|
|
|
+ private final Integer limitCout = 1000;
|
|
|
+
|
|
|
/**
|
|
|
* 装每个客户端的地址及对应的管道
|
|
|
*/
|
|
@@ -129,7 +140,26 @@ public class NettyAlarmMsgBaseHandler extends ChannelInboundHandlerAdapter {
|
|
|
|
|
|
data.put("userId", "system");
|
|
|
|
|
|
- JSONArray alarmConfigs = nettyAlarmService.queryAlarmConfig(data);
|
|
|
+ /* 报警设置结果集若较大会发生超时问题导致报警引擎无法正常获取报警设置信息,现改成分页获取模式*/
|
|
|
+ data.put("onlyCount", true);
|
|
|
+
|
|
|
+ DmpResult<JSONArray> queryResult = alarmClient.queryAlarmConfig(baseService.getAlarmUrlParam(data), baseService.getRequestBody(data));
|
|
|
+ Integer resultCount = queryResult.getCount();
|
|
|
+ log.info("===========>共{}条报警定义!", resultCount);
|
|
|
+ int divide = resultCount / limitCout;
|
|
|
+ JSONArray alarmConfigs = new JSONArray();
|
|
|
+ if (divide > 1) {
|
|
|
+ for (int i = 1; i <= divide; i++) {
|
|
|
+ data.put("onlyCount", false);
|
|
|
+ data.put("page", i);
|
|
|
+ data.put("size", limitCout);
|
|
|
+ alarmConfigs.addAll(nettyAlarmService.queryAlarmConfig(data));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ data.remove("onlyCount");
|
|
|
+ alarmConfigs = nettyAlarmService.queryAlarmConfig(data);
|
|
|
+ }
|
|
|
+ log.info("===========>报警定义信息获取完成!共{}条!", alarmConfigs);
|
|
|
if (alarmConfigs == null || alarmConfigs.size() <= 0) {
|
|
|
return;
|
|
|
}
|