Przeglądaj źródła

feature 报警记录增加字段

lixingyhj@gmail.com 2 lat temu
rodzic
commit
adf3dd3056

+ 1 - 0
AlarmDataStarter/pom.xml

@@ -8,6 +8,7 @@
 	<modelVersion>4.0.0</modelVersion>
 
 	<artifactId>alarm-data-starter</artifactId>
+	<version>v4.5.0-SNAPSHOT</version>
 
 	<properties>
 		<maven.compiler.source>8</maven.compiler.source>

+ 57 - 0
AlarmDataStarter/src/main/java/com/persagy/apm/energyalarmstarter/alarmdata/enums/EnumAlarmTreatMode.java

@@ -0,0 +1,57 @@
+package com.persagy.apm.energyalarmstarter.alarmdata.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 报警处理方式
+ *
+ * @author lixing
+ * @version V1.0 2021/9/20 11:08 上午
+ **/
+@AllArgsConstructor
+public enum EnumAlarmTreatMode {
+    /**
+     * 报警处理方式
+     */
+    IGNORE(1, "忽略"),
+    ORDER(2, "转工单"),
+    CLOSE(3, "关闭"),
+    CONDITION_CHANGE(4, "变更条件关闭"),
+    BLOCK_OBJ(5, "屏蔽关闭");
+
+    @Setter
+    @Getter
+    private int type;
+
+    @Setter
+    private String desc;
+
+    public String getDesc() {
+        // 忽略和关闭在返回给前端时,返回屏蔽关闭
+        if (this.equals(EnumAlarmTreatMode.IGNORE) || this.equals(EnumAlarmTreatMode.CLOSE)) {
+            return BLOCK_OBJ.desc;
+        } else {
+            return desc;
+        }
+    }
+
+    /**
+     * 根据type获取到枚举对象
+     *
+     * @param type 枚举type值
+     * @return 枚举对象
+     * @author lixing
+     * @version V1.0 2021/5/31 4:06 下午
+     */
+    public static EnumAlarmTreatMode getByType(int type) {
+        EnumAlarmTreatMode[] enums = EnumAlarmTreatMode.values();
+        for (EnumAlarmTreatMode item : enums) {
+            if (type == item.getType()) {
+                return item;
+            }
+        }
+        return null;
+    }
+}

+ 1 - 1
AlarmDataStarter/src/main/java/com/persagy/apm/energyalarmstarter/alarmdata/feign/client/AlarmClient.java

@@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.RequestBody;
  * @version: V1.0
  */
 @FeignClient(name = "dmp-alarm" ,fallbackFactory = AlarmClientFallbackFactory.class,
-        configuration = AlarmClientConfig.class)
+        configuration = AlarmClientConfig.class, url="http://bz-develop.persagy.com/dmp-alarm")
 public interface AlarmClient {
     /**
      * @description: 查询报警定义

+ 24 - 0
AlarmDataStarter/src/main/java/com/persagy/apm/energyalarmstarter/alarmdata/model/dto/alarmrecord/QueryAlarmRecordDTO.java

@@ -2,7 +2,10 @@ package com.persagy.apm.energyalarmstarter.alarmdata.model.dto.alarmrecord;
 
 import com.alibaba.fastjson.JSONObject;
 import com.fasterxml.jackson.annotation.JsonInclude;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
 import com.persagy.apm.energyalarmstarter.alarmdata.enums.EnumAlarmListType;
+import com.persagy.apm.energyalarmstarter.alarmdata.enums.EnumAlarmTreatMode;
 import com.persagy.apm.energyalarmstarter.alarmdata.model.dto.common.UrlParamDTO;
 import com.persagy.apm.energyalarmstarter.alarmdata.utils.DateUtils;
 import lombok.AccessLevel;
@@ -13,6 +16,7 @@ import org.springframework.util.CollectionUtils;
 
 import java.util.Date;
 import java.util.List;
+import java.util.Set;
 
 /**
  * 报警记录
@@ -61,6 +65,10 @@ public class QueryAlarmRecordDTO extends UrlParamDTO {
      */
     private List<Integer> state;
     /**
+     * 当前/历史报警
+     */
+    private Integer alarmState;
+    /**
      * 报警性质
      */
     private List<Integer> nature;
@@ -145,4 +153,20 @@ public class QueryAlarmRecordDTO extends UrlParamDTO {
         }
         return null;
     }
+
+
+    /**
+      * 对处理方式特殊处理,查询屏蔽关闭的报警需要查询处理方式为忽略、关闭、屏蔽关闭三种处理方式的报警
+      *
+      * @Author lixing
+      * @Date 2022/9/9 10:49
+      */
+    public List<Integer> getTreatMode() {
+        Set<Integer> treatModeSet = Sets.newHashSet(this.treatMode);
+        if (treatModeSet.contains(EnumAlarmTreatMode.BLOCK_OBJ.getType())) {
+            treatModeSet.add(EnumAlarmTreatMode.IGNORE.getType());
+            treatModeSet.add(EnumAlarmTreatMode.CLOSE.getType());
+        }
+        return Lists.newArrayList(treatModeSet);
+    }
 }

+ 4 - 0
AlarmDataStarter/src/main/java/com/persagy/apm/energyalarmstarter/alarmdata/model/dto/alarmrecord/UpdateAlarmRecordDTO.java

@@ -27,6 +27,10 @@ public class UpdateAlarmRecordDTO extends UrlParamDTO {
      */
     private String name;
     /**
+     * 报警对象名称
+     */
+    private String objName;
+    /**
      * 备注
      */
     private String remark;

+ 14 - 0
AlarmDataStarter/src/main/java/com/persagy/apm/energyalarmstarter/alarmdata/model/vo/AlarmRecordItem.java

@@ -28,6 +28,10 @@ public class AlarmRecordItem {
      */
     private String objId;
     /**
+     * 报警对象名称
+     */
+    private String objName;
+    /**
      * 设备类编码
      */
     private String classCode;
@@ -115,4 +119,14 @@ public class AlarmRecordItem {
      * 报警处理完成时间
      */
     private Date treatEndTime;
+
+    /**
+     * 报警处理人
+     */
+    private String handler;
+
+    /**
+     * 报警处理时间
+     */
+    private Date handleTime;
 }

+ 5 - 1
readme.md

@@ -5,4 +5,8 @@
 
 # v4.0.0
 ## 2022-06-07
-1. 升级passCloud框架,修改spring-boot版本号
+1. 升级passCloud框架,修改spring-boot版本号
+
+# v4.5.0
+- 对应标准产品v4.5.0
+- 报警记录查询参数增加alarmState