|
@@ -0,0 +1,66 @@
|
|
|
+package com.persagy.apm.energyalarmstarter.alarmengine.jms.model;
|
|
|
+
|
|
|
+import lombok.Getter;
|
|
|
+import lombok.Setter;
|
|
|
+
|
|
|
+import java.util.LinkedList;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 设备的报警条件信息
|
|
|
+ *
|
|
|
+ * @author lixing
|
|
|
+ * @version V1.0 2021/10/22 9:42 上午
|
|
|
+ **/
|
|
|
+public class ObjConditionInfo {
|
|
|
+
|
|
|
+ public ObjConditionInfo(String projectId) {
|
|
|
+ this.projectId = projectId;
|
|
|
+ this.conditions = new LinkedList<>();
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 项目id
|
|
|
+ */
|
|
|
+ @Setter
|
|
|
+ @Getter
|
|
|
+ private String projectId;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 报警条件列表[{itemCode, conditionId}]
|
|
|
+ */
|
|
|
+ @Setter
|
|
|
+ @Getter
|
|
|
+ private LinkedList<ItemCodeCondition> conditions;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设备报警条件列表中添加一个条件
|
|
|
+ *
|
|
|
+ * @param itemCodeCondition 条件对象
|
|
|
+ * @author lixing
|
|
|
+ * @version V1.0 2021/10/25 11:30 上午
|
|
|
+ */
|
|
|
+ public void addCondition(ItemCodeCondition itemCodeCondition) {
|
|
|
+ if (itemCodeCondition == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (conditions == null) {
|
|
|
+ conditions = new LinkedList<>();
|
|
|
+ }
|
|
|
+ // 如果存在相同报警类型的配置,删除之前的配置,添加新的配置
|
|
|
+ conditions.removeIf(condition -> itemCodeCondition.getItemCode().equals(condition.getItemCode()));
|
|
|
+ conditions.add(itemCodeCondition);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 移除设备关联的条件
|
|
|
+ *
|
|
|
+ * @param condition 要移除的条件
|
|
|
+ * @author lixing
|
|
|
+ * @version V1.0 2021/10/25 9:14 下午
|
|
|
+ */
|
|
|
+ public void removeCondition(ItemCodeCondition condition) {
|
|
|
+ if (conditions == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ conditions.removeIf(item -> item.getItemCode().equals(condition.getItemCode()));
|
|
|
+ }
|
|
|
+}
|