|
@@ -9,12 +9,14 @@ import com.googlecode.aviator.Expression;
|
|
|
import com.persagy.entity.AlarmDefine;
|
|
|
import com.persagy.entity.AlarmState;
|
|
|
import com.persagy.entity.Condition;
|
|
|
+import com.persagy.utils.StringUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -129,6 +131,9 @@ public class AlarmInfoCache {
|
|
|
* @version: V1.0
|
|
|
*/
|
|
|
public void putAlarmDefinitionById(String definitionId, AlarmDefine alarmDefine) {
|
|
|
+ if("0".equals(alarmDefine.getOpen())){
|
|
|
+ return;
|
|
|
+ }
|
|
|
Condition condition = alarmDefine.getCondition();
|
|
|
List<JSONObject> infoCodes = condition.getInfoCodes();
|
|
|
if(CollectionUtil.isEmpty(infoCodes)) {
|
|
@@ -225,21 +230,24 @@ public class AlarmInfoCache {
|
|
|
* @exception:
|
|
|
* @author: LuoGuangyi
|
|
|
* @company: Persagy Technology Co.,Ltd
|
|
|
- * @param alarmDefine:
|
|
|
+ * @param ad: 要删除掉的报警定义
|
|
|
* @return: void
|
|
|
* @since: 2020/10/26 20:34
|
|
|
* @version: V1.0
|
|
|
*/
|
|
|
- public void clearAlarmDefine(AlarmDefine alarmDefine) {
|
|
|
- String defineId = getAlarmDefineId(alarmDefine);
|
|
|
+ public void clearAlarmDefine(AlarmDefine ad) {
|
|
|
+ String defineId = getAlarmDefineId(ad);
|
|
|
+ AlarmDefine alarmDefine = alarmDefineMap.get(defineId);
|
|
|
+ if(!Objects.isNull(alarmDefine)) {
|
|
|
+ List<JSONObject> infoCodes = alarmDefine.getCondition().getInfoCodes();
|
|
|
+ infoCodes.stream().forEach(info->{
|
|
|
+ String meterId = info.getString("meterId");
|
|
|
+ String funcId = info.getString("funcId");
|
|
|
+ List<AlarmDefine> AlarmDefineList = infoAlarmMap.getOrDefault(getKey(meterId, funcId),new ArrayList<>());
|
|
|
+ infoAlarmMap.put(getKey(meterId, funcId), AlarmDefineList.stream().filter(adTmp -> !getAlarmDefineId(adTmp).equals(defineId)).collect(Collectors.toList()));
|
|
|
+ });
|
|
|
+ }
|
|
|
alarmDefineMap.remove(defineId);
|
|
|
- List<JSONObject> infoCodes = alarmDefine.getCondition().getInfoCodes();
|
|
|
- infoCodes.stream().forEach(info->{
|
|
|
- String meterId = info.getString("meterId");
|
|
|
- String funcId = info.getString("funcId");
|
|
|
- List<AlarmDefine> AlarmDefineList = infoAlarmMap.getOrDefault(getKey(meterId, funcId),new ArrayList<>());
|
|
|
- infoAlarmMap.put(getKey(meterId, funcId), AlarmDefineList.stream().filter(ad -> !getAlarmDefineId(ad).equals(defineId)).collect(Collectors.toList()));
|
|
|
- });
|
|
|
}
|
|
|
|
|
|
* @description:获取报警定义id,
|