소스 검색

alarmClient中报警记录、条目和批注相关方法实现

wangchenghong 3 년 전
부모
커밋
b3b5cf047a
13개의 변경된 파일622개의 추가작업 그리고 0개의 파일을 삭제
  1. 57 0
      AlarmDataStarter/src/main/java/com/persagy/apm/energyalarmstarter/alarmdata/model/dto/alarmcomment/AddAlarmCommentDTO.java
  2. 57 0
      AlarmDataStarter/src/main/java/com/persagy/apm/energyalarmstarter/alarmdata/model/dto/alarmrecord/AddAlarmRecordDTO.java
  3. 19 0
      AlarmDataStarter/src/main/java/com/persagy/apm/energyalarmstarter/alarmdata/model/dto/alarmrecord/BatchUpdateAlarmRecordDTO.java
  4. 57 0
      AlarmDataStarter/src/main/java/com/persagy/apm/energyalarmstarter/alarmdata/model/dto/alarmrecord/UpdateAlarmRecordDTO.java
  5. 50 0
      AlarmDataStarter/src/main/java/com/persagy/apm/energyalarmstarter/alarmdata/model/dto/common/QueryAlarmCommentDTO.java
  6. 50 0
      AlarmDataStarter/src/main/java/com/persagy/apm/energyalarmstarter/alarmdata/model/dto/common/QueryAlarmItemDTO.java
  7. 50 0
      AlarmDataStarter/src/main/java/com/persagy/apm/energyalarmstarter/alarmdata/model/dto/common/QueryAlarmRecordDTO.java
  8. 60 0
      AlarmDataStarter/src/main/java/com/persagy/apm/energyalarmstarter/alarmdata/model/vo/AlarmCommentItem.java
  9. 60 0
      AlarmDataStarter/src/main/java/com/persagy/apm/energyalarmstarter/alarmdata/model/vo/AlarmItem.java
  10. 60 0
      AlarmDataStarter/src/main/java/com/persagy/apm/energyalarmstarter/alarmdata/model/vo/AlarmRecordItem.java
  11. 30 0
      AlarmDataStarter/src/main/java/com/persagy/apm/energyalarmstarter/alarmdata/service/AlarmCommentServiceImpl.java
  12. 18 0
      AlarmDataStarter/src/main/java/com/persagy/apm/energyalarmstarter/alarmdata/service/AlarmItemServiceImpl.java
  13. 54 0
      AlarmDataStarter/src/main/java/com/persagy/apm/energyalarmstarter/alarmdata/service/AlarmRecordServiceImpl.java

+ 57 - 0
AlarmDataStarter/src/main/java/com/persagy/apm/energyalarmstarter/alarmdata/model/dto/alarmcomment/AddAlarmCommentDTO.java

@@ -0,0 +1,57 @@
+package com.persagy.apm.energyalarmstarter.alarmdata.model.dto.alarmconfig;
+
+import com.persagy.apm.energyalarmstarter.alarmdata.feign.AlarmUrlParam;
+import com.persagy.apm.energyalarmstarter.alarmdata.model.dto.AlarmCondition;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+/**
+ * 创建报警批注dto
+ *
+ * @author lixing
+ * @version V1.0 2021/9/15 9:10 下午
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class AddAlarmCommentDTO extends AlarmUrlParam {
+    /**
+     * 报警对象id
+     */
+    private String objId;
+    /**
+     * 设备类编码
+     */
+    private String classCode;
+    /**
+     * 报警类型编码
+     */
+    private String itemCode;
+    /**
+     * 报警系统编码
+     */
+    private String category;
+    /**
+     * 报警等级
+     */
+    private String level;
+    /**
+     * 备注
+     */
+    private String remark;
+    /**
+     * 报警条件
+     */
+    private AlarmCondition condition;
+    /**
+     * 屏蔽状态 1-open、0- 屏蔽
+     */
+    private Integer open;
+    /**
+     * 是否自定义 1-自定义、0-自动生成
+     */
+    private Integer userDefined;
+}

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

@@ -0,0 +1,57 @@
+package com.persagy.apm.energyalarmstarter.alarmdata.model.dto.alarmconfig;
+
+import com.persagy.apm.energyalarmstarter.alarmdata.feign.AlarmUrlParam;
+import com.persagy.apm.energyalarmstarter.alarmdata.model.dto.AlarmCondition;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+/**
+ * 创建报警记录dto
+ *
+ * @author lixing
+ * @version V1.0 2021/9/15 9:10 下午
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class AddAlarmRecordDTO extends AlarmUrlParam {
+    /**
+     * 报警对象id
+     */
+    private String objId;
+    /**
+     * 设备类编码
+     */
+    private String classCode;
+    /**
+     * 报警类型编码
+     */
+    private String itemCode;
+    /**
+     * 报警系统编码
+     */
+    private String category;
+    /**
+     * 报警等级
+     */
+    private String level;
+    /**
+     * 备注
+     */
+    private String remark;
+    /**
+     * 报警条件
+     */
+    private AlarmCondition condition;
+    /**
+     * 屏蔽状态 1-open、0- 屏蔽
+     */
+    private Integer open;
+    /**
+     * 是否自定义 1-自定义、0-自动生成
+     */
+    private Integer userDefined;
+}

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

@@ -0,0 +1,19 @@
+package com.persagy.apm.energyalarmstarter.alarmdata.model.dto.alarmconfig;
+
+import com.persagy.apm.energyalarmstarter.alarmdata.feign.AlarmUrlParam;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+/**
+ * 批量更新报警记录dto
+ *
+ * @author lixing
+ * @version V1.0 2021/9/15 9:10 下午
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class BatchUpdateAlarmRecordDTO extends AlarmUrlParam {
+    private List<UpdateAlarmRecordDTO> alarmRecords;
+}

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

@@ -0,0 +1,57 @@
+package com.persagy.apm.energyalarmstarter.alarmdata.model.dto.alarmconfig;
+
+import com.persagy.apm.energyalarmstarter.alarmdata.feign.AlarmUrlParam;
+import com.persagy.apm.energyalarmstarter.alarmdata.model.dto.AlarmCondition;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+/**
+ * 创建报警记录dto
+ *
+ * @author lixing
+ * @version V1.0 2021/9/15 9:10 下午
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class UpdateAlarmRecordDTO extends AlarmUrlParam {
+    /**
+     * 报警对象id
+     */
+    private String objId;
+    /**
+     * 设备类编码
+     */
+    private String classCode;
+    /**
+     * 报警类型编码
+     */
+    private String itemCode;
+    /**
+     * 报警系统编码
+     */
+    private String category;
+    /**
+     * 报警等级
+     */
+    private String level;
+    /**
+     * 备注
+     */
+    private String remark;
+    /**
+     * 报警条件
+     */
+    private AlarmCondition condition;
+    /**
+     * 屏蔽状态 1-open、0- 屏蔽
+     */
+    private Integer open;
+    /**
+     * 是否自定义 1-自定义、0-自动生成
+     */
+    private Integer userDefined;
+}

+ 50 - 0
AlarmDataStarter/src/main/java/com/persagy/apm/energyalarmstarter/alarmdata/model/dto/common/QueryAlarmCommentDTO.java

@@ -0,0 +1,50 @@
+package com.persagy.apm.energyalarmstarter.alarmdata.model.dto.common;
+
+import com.persagy.apm.energyalarmstarter.alarmdata.feign.AlarmUrlParam;
+
+import java.util.List;
+
+/**
+ * 报警批注
+ *
+ * @author lixing
+ * @version V1.0 2021/9/16 9:33 上午
+ **/
+public class QueryAlarmCommentDTO extends AlarmUrlParam {
+    /**
+     * 报警批注id
+     */
+    private List<String> id;
+    /**
+     * 报警对象id
+     */
+    private List<String> objId;
+    /**
+     * 设备类编码
+     */
+    private List<String> classCode;
+    /**
+     * 报警类型编码
+     */
+    private List<String> itemCode;
+    /**
+     * 报警系统编码
+     */
+    private List<String> category;
+    /**
+     * 报警等级
+     */
+    private List<String> level;
+    /**
+     * 备注
+     */
+    private String remark;
+    /**
+     * 屏蔽状态 1-open、0- 屏蔽
+     */
+    private Integer open;
+    /**
+     * 是否自定义 1-自定义、0-自动生成
+     */
+    private Integer userDefined;
+}

+ 50 - 0
AlarmDataStarter/src/main/java/com/persagy/apm/energyalarmstarter/alarmdata/model/dto/common/QueryAlarmItemDTO.java

@@ -0,0 +1,50 @@
+package com.persagy.apm.energyalarmstarter.alarmdata.model.dto.common;
+
+import com.persagy.apm.energyalarmstarter.alarmdata.feign.AlarmUrlParam;
+
+import java.util.List;
+
+/**
+ * 报警条目
+ *
+ * @author lixing
+ * @version V1.0 2021/9/16 9:33 上午
+ **/
+public class QueryAlarmItemDTO extends AlarmUrlParam {
+    /**
+     * 报警条目id
+     */
+    private List<String> id;
+    /**
+     * 报警对象id
+     */
+    private List<String> objId;
+    /**
+     * 设备类编码
+     */
+    private List<String> classCode;
+    /**
+     * 报警类型编码
+     */
+    private List<String> itemCode;
+    /**
+     * 报警系统编码
+     */
+    private List<String> category;
+    /**
+     * 报警等级
+     */
+    private List<String> level;
+    /**
+     * 备注
+     */
+    private String remark;
+    /**
+     * 屏蔽状态 1-open、0- 屏蔽
+     */
+    private Integer open;
+    /**
+     * 是否自定义 1-自定义、0-自动生成
+     */
+    private Integer userDefined;
+}

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

@@ -0,0 +1,50 @@
+package com.persagy.apm.energyalarmstarter.alarmdata.model.dto.common;
+
+import com.persagy.apm.energyalarmstarter.alarmdata.feign.AlarmUrlParam;
+
+import java.util.List;
+
+/**
+ * 报警记录
+ *
+ * @author lixing
+ * @version V1.0 2021/9/16 9:33 上午
+ **/
+public class QueryAlarmRecordDTO extends AlarmUrlParam {
+    /**
+     * 报警记录id
+     */
+    private List<String> id;
+    /**
+     * 报警对象id
+     */
+    private List<String> objId;
+    /**
+     * 设备类编码
+     */
+    private List<String> classCode;
+    /**
+     * 报警类型编码
+     */
+    private List<String> itemCode;
+    /**
+     * 报警系统编码
+     */
+    private List<String> category;
+    /**
+     * 报警等级
+     */
+    private List<String> level;
+    /**
+     * 备注
+     */
+    private String remark;
+    /**
+     * 屏蔽状态 1-open、0- 屏蔽
+     */
+    private Integer open;
+    /**
+     * 是否自定义 1-自定义、0-自动生成
+     */
+    private Integer userDefined;
+}

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

@@ -0,0 +1,60 @@
+package com.persagy.apm.energyalarmstarter.alarmdata.model.vo;
+
+import com.persagy.apm.energyalarmstarter.alarmdata.model.dto.AlarmCondition;
+
+/**
+ * 报警批注
+ *
+ * @author lixing
+ * @version V1.0 2021/9/16 9:33 上午
+ **/
+public class AlarmCommentItem {
+    /**
+     * 报警批注id
+     */
+    private String id;
+    /**
+     * 报警对象id
+     */
+    private String objId;
+    /**
+     * 设备类编码
+     */
+    private String classCode;
+    /**
+     * 项目id
+     */
+    private String projectId;
+    /**
+     * 报警类型编码
+     */
+    private String itemCode;
+    /**
+     * 报警系统编码
+     */
+    private String category;
+    /**
+     * 报警等级
+     */
+    private String level;
+    /**
+     * 备注
+     */
+    private String remark;
+    /**
+     * 报警条件
+     */
+    private AlarmCondition condition;
+    /**
+     * 屏蔽状态 1-open、0- 屏蔽
+     */
+    private Integer open;
+    /**
+     * 是否自定义 1-自定义、0-自动生成
+     */
+    private Integer userDefined;
+    /**
+     * 集团编码
+     */
+    private String groupCode;
+}

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

@@ -0,0 +1,60 @@
+package com.persagy.apm.energyalarmstarter.alarmdata.model.vo;
+
+import com.persagy.apm.energyalarmstarter.alarmdata.model.dto.AlarmCondition;
+
+/**
+ * 报警条目
+ *
+ * @author lixing
+ * @version V1.0 2021/9/16 9:33 上午
+ **/
+public class AlarmItem {
+    /**
+     * 报警条目id
+     */
+    private String id;
+    /**
+     * 报警对象id
+     */
+    private String objId;
+    /**
+     * 设备类编码
+     */
+    private String classCode;
+    /**
+     * 项目id
+     */
+    private String projectId;
+    /**
+     * 报警类型编码
+     */
+    private String itemCode;
+    /**
+     * 报警系统编码
+     */
+    private String category;
+    /**
+     * 报警等级
+     */
+    private String level;
+    /**
+     * 备注
+     */
+    private String remark;
+    /**
+     * 报警条件
+     */
+    private AlarmCondition condition;
+    /**
+     * 屏蔽状态 1-open、0- 屏蔽
+     */
+    private Integer open;
+    /**
+     * 是否自定义 1-自定义、0-自动生成
+     */
+    private Integer userDefined;
+    /**
+     * 集团编码
+     */
+    private String groupCode;
+}

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

@@ -0,0 +1,60 @@
+package com.persagy.apm.energyalarmstarter.alarmdata.model.vo;
+
+import com.persagy.apm.energyalarmstarter.alarmdata.model.dto.AlarmCondition;
+
+/**
+ * 报警记录
+ *
+ * @author lixing
+ * @version V1.0 2021/9/16 9:33 上午
+ **/
+public class AlarmRecordItem {
+    /**
+     * 报警记录id
+     */
+    private String id;
+    /**
+     * 报警对象id
+     */
+    private String objId;
+    /**
+     * 设备类编码
+     */
+    private String classCode;
+    /**
+     * 项目id
+     */
+    private String projectId;
+    /**
+     * 报警类型编码
+     */
+    private String itemCode;
+    /**
+     * 报警系统编码
+     */
+    private String category;
+    /**
+     * 报警等级
+     */
+    private String level;
+    /**
+     * 备注
+     */
+    private String remark;
+    /**
+     * 报警条件
+     */
+    private AlarmCondition condition;
+    /**
+     * 屏蔽状态 1-open、0- 屏蔽
+     */
+    private Integer open;
+    /**
+     * 是否自定义 1-自定义、0-自动生成
+     */
+    private Integer userDefined;
+    /**
+     * 集团编码
+     */
+    private String groupCode;
+}

+ 30 - 0
AlarmDataStarter/src/main/java/com/persagy/apm/energyalarmstarter/alarmdata/service/AlarmCommentServiceImpl.java

@@ -10,4 +10,34 @@ import org.springframework.stereotype.Service;
  **/
 @Service
 public class AlarmCommentServiceImpl {
+
+    @Autowired
+    AlarmClient alarmClient;
+
+    /**
+     * 查询报警批注
+     * @param queryAlarmCommentDTO 入参
+     * @return 报警批注列表
+     * @throws Exception
+     */
+    public DmpResult<List<AlarmCommentItem>> query(QueryAlarmCommentDTO queryAlarmCommentDTO) throws Exception {
+        QueryDTO<QueryAlarmCommentDTO> queryDTO = new QueryDTO<>();
+        queryDTO.setCriteria(queryAlarmCommentDTO);
+        JSONObject jsonObject = Obj2JSONObject.convert(queryDTO);
+        DmpResult<JSONArray> result = alarmClient.queryAlarmComment(queryAlarmCommentDTO.fetchParams(), jsonObject);
+        return DmpResultUtil.multiConvert(result, AlarmCommentItem.class);
+    }
+
+    /**
+     * 创建报警批注
+     * @param addAlarmCommentDTO 入参
+     * @return 报警批注id
+     * @throws Exception
+     */
+    public DmpResult<DmpUpsertVO> create(AddAlarmCommentDTO addAlarmCommentDTO) throws Exception{
+        JSONObject jsonObject = Obj2JSONObject.convert(addAlarmCommentDTO);
+        DmpResult<JSONObject> alarmComment = alarmClient.createAlarmComment(addAlarmCommentDTO.fetchParams(), jsonObject);
+        return DmpResultUtil.singleConvert(alarmComment, DmpUpsertVO.class);
+    }
+
 }

+ 18 - 0
AlarmDataStarter/src/main/java/com/persagy/apm/energyalarmstarter/alarmdata/service/AlarmItemServiceImpl.java

@@ -10,4 +10,22 @@ import org.springframework.stereotype.Service;
  **/
 @Service
 public class AlarmItemServiceImpl {
+
+    @Autowired
+    AlarmClient alarmClient;
+
+    /**
+     * 查询报警条目
+     * @param queryAlarmItemDTO 入参
+     * @return 报警批注列表
+     * @throws Exception
+     */
+    public DmpResult<List<AlarmItem>> query(QueryAlarmItemDTO queryAlarmItemDTO) throws Exception {
+        QueryDTO<QueryAlarmItemDTO> queryDTO = new QueryDTO<>();
+        queryDTO.setCriteria(queryAlarmItemDTO);
+        JSONObject jsonObject = Obj2JSONObject.convert(queryDTO);
+        DmpResult<JSONArray> result = alarmClient.queryAlarmItem(queryAlarmItemDTO.fetchParams(), jsonObject);
+        return DmpResultUtil.multiConvert(result, AlarmItem.class);
+    }
+
 }

+ 54 - 0
AlarmDataStarter/src/main/java/com/persagy/apm/energyalarmstarter/alarmdata/service/AlarmRecordServiceImpl.java

@@ -11,4 +11,58 @@ import org.springframework.stereotype.Service;
  **/
 @Service
 public class AlarmRecordServiceImpl {
+
+    @Autowired
+    AlarmClient alarmClient;
+
+    /**
+     * 查询报警记录
+     * @param queryAlarmRecordDTO 入参
+     * @return 报警记录列表
+     * @throws Exception
+     */
+    public DmpResult<List<AlarmRecordItem>> query(QueryAlarmRecordDTO queryAlarmRecordDTO) throws Exception {
+        QueryDTO<QueryAlarmRecordDTO> queryDTO = new QueryDTO<>();
+        queryDTO.setCriteria(queryAlarmRecordDTO);
+        JSONObject jsonObject = Obj2JSONObject.convert(queryDTO);
+        DmpResult<JSONArray> result = alarmClient.queryAlarmRecord(queryAlarmRecordDTO.fetchParams(), jsonObject);
+        return DmpResultUtil.multiConvert(result, AlarmRecordItem.class);
+    }
+
+    /**
+     * 创建报警记录
+     * @param addAlarmRecordDTO 入参
+     * @return 报警记录id
+     * @throws Exception
+     */
+    public DmpResult<DmpUpsertVO> create(AddAlarmRecordDTO addAlarmRecordDTO) throws Exception{
+        JSONObject jsonObject = Obj2JSONObject.convert(addAlarmRecordDTO);
+        DmpResult<JSONObject> alarmRecord = alarmClient.createAlarmRecord(addAlarmRecordDTO.fetchParams(), jsonObject);
+        return DmpResultUtil.singleConvert(alarmRecord, DmpUpsertVO.class);
+    }
+
+    /**
+     * 更新报警记录
+     * @param updateAlarmRecordDTO 入参
+     * @return 报警记录id
+     * @throws Exception
+     */
+    public DmpResult<DmpUpsertVO> update(UpdateAlarmRecordDTO updateAlarmRecordDTO) throws Exception{
+        JSONObject jsonObject = Obj2JSONObject.convert(updateAlarmRecordDTO);
+        DmpResult<JSONObject> alarmRecord = alarmClient.updateAlarmRecord(updateAlarmRecordDTO.fetchParams(), jsonObject);
+        return DmpResultUtil.singleConvert(alarmRecord, DmpUpsertVO.class);
+    }
+
+    /**
+     * 批量更新报警记录
+     * @param batchUpdateAlarmRecordDTO 入参
+     * @return 报警记录ids
+     * @throws Exception
+     */
+    public DmpResult<DmpBatchUpsertVO> batchUpdate(BatchUpdateAlarmRecordDTO batchUpdateAlarmRecordDTO) throws Exception {
+        JSONObject jsonObject = Obj2JSONObject.convert(batchUpdateAlarmRecordDTO);
+        DmpResult<JSONObject> result = alarmClient.batchUpdateAlarmRecord(batchUpdateAlarmRecordDTO.fetchParams(), jsonObject);
+        return DmpResultUtil.singleConvert(result, DmpBatchUpsertVO.class);
+    }
+
 }