瀏覽代碼

修改报警发生次数的bug

lixing 3 年之前
父節點
當前提交
ac477a4647

+ 6 - 3
src/main/java/com/persagy/apm/alarmservice/group/alarmrecord/service/AlarmRecordWrapper.java

@@ -327,20 +327,22 @@ public class AlarmRecordWrapper {
             ));
         }
         /* 近30天报警触发次数 */
-        Integer count = getAlarmCountInMonth(alarmRecordItem.getTriggerTime(), alarmRecordItem.getItemCode());
+        Integer count = getAlarmCountInMonth(
+                alarmRecordItem.getTriggerTime(), alarmRecordItem.getItemCode(), alarmRecordItem.getObjId());
         alarmRecordItemVO.setAlarmCountInMonth(count);
     }
 
     /**
-     * 指定报警类型在指定日期前一个月内发生报警的次数
+     * 指定报警对象报警类型在指定日期前一个月内发生报警的次数
      *
      * @param date     指定日期
      * @param itemCode 指定报警类型
+     * @param objId    指定报警对象
      * @return 发生报警的次数
      * @author lixing
      * @version V1.0 2021/9/22 3:43 下午
      */
-    public Integer getAlarmCountInMonth(Date date, String itemCode) throws Exception {
+    public Integer getAlarmCountInMonth(Date date, String itemCode, String objId) throws Exception {
         if (date == null || StringUtils.isBlank(itemCode)) {
             return 0;
         }
@@ -349,6 +351,7 @@ public class AlarmRecordWrapper {
                 DateUtils.getMonthOff(date, -1));
         queryAlarmRecordDTO.setTriggerDurationEnd(date);
         queryAlarmRecordDTO.setItemCode(Lists.newArrayList(itemCode));
+        queryAlarmRecordDTO.setObjId(Lists.newArrayList(objId));
         return alarmRecordService.queryCount(queryAlarmRecordDTO);
     }