Browse Source

推送数据报文 添加报警类型

miaolijing 3 years ago
parent
commit
29385d529a

+ 3 - 3
src/main/java/com/persagy/apm/diagnose/indicatorrecord/service/impl/MonitorIndicatorRecordServiceImpl.java

@@ -355,7 +355,7 @@ public class MonitorIndicatorRecordServiceImpl implements IMonitorIndicatorRecor
 
             int indexOf = objIdAndAlarmItemCode.indexOf("_");
             String objId = objIdAndAlarmItemCode.substring(0, indexOf);
-
+            String alarmItemCode = objIdAndAlarmItemCode.substring(indexOf + 1);
 
             List<String> infCodeList = entry.getValue();
 
@@ -382,8 +382,8 @@ public class MonitorIndicatorRecordServiceImpl implements IMonitorIndicatorRecor
                 if (CollectionUtils.isEmpty(value) || value.size() != infCodeList.size()) {
                     continue;
                 }
-                String sentValue = CollectDataUtil.buildSendParam(value);
-                AlarmWebSocketServer.sendMsgToClients(projectDTO.getProjectId(), CollectDataUtil.buildSendParam(value));
+                String sentValue = CollectDataUtil.buildSendParam(value,alarmItemCode);
+                AlarmWebSocketServer.sendMsgToClients(projectDTO.getProjectId(), CollectDataUtil.buildSendParam(value,alarmItemCode));
                 log.info("指标发送报表服务数据:" + projectDTO.getProjectId()+";"+ sentValue);
                 endTime = DateUtils.str2Date(dateListEntry.getKey(), DateUtils.SDF_SECOND);
             }

+ 2 - 1
src/main/java/com/persagy/apm/diagnose/utils/CollectDataUtil.java

@@ -15,7 +15,7 @@ import java.util.List;
  */
 public class CollectDataUtil {
 
-    public static String buildSendParam(List<MonitorIndicatorRecord> recordList) throws Exception {
+    public static String buildSendParam(List<MonitorIndicatorRecord> recordList,String alarmItemCode) throws Exception {
 
         if (CollectionUtils.isEmpty(recordList)) {
             return null;
@@ -24,6 +24,7 @@ public class CollectDataUtil {
         MonitorIndicatorRecord record1 = recordList.get(0);
         String date = DateUtils.date2Str(record1.getDataTime(), "yyyyMMddHHmmss");
         stringBuilder.append(date).append(";");
+        stringBuilder.append(alarmItemCode).append(";");
         stringBuilder.append(record1.getObjId()).append(";");
 
         for (int i = 0; i < recordList.size(); i++) {