Commit bb40d8de308c4bad887246d040b93d1a0e32d72a

Authored by 云中非
1 parent e7b68325

fix: 告警清除逻辑优化

@@ -200,30 +200,28 @@ class ReactState { @@ -200,30 +200,28 @@ class ReactState {
200 if (triggerState.containsKey(deviceId)) { 200 if (triggerState.containsKey(deviceId)) {
201 return triggerState.get(cacheKey); 201 return triggerState.get(cacheKey);
202 } 202 }
203 - if (alarmAction.getDeviceId().contains(deviceId)) {  
204 - TriggerState state = null;  
205 - ActionAlarmDTO alarm = JacksonUtil.convertValue(alarmAction.getDoContext(), ActionAlarmDTO.class);  
206 - if (alarm != null && alarm.getClearRule() != null) {  
207 - for(TriggerDTO rule:alarm.getClearRule()){  
208 - if(!(ScopeEnum.PART.equals(rule.getEntityType()) && !rule.getEntityId().contains(deviceId))  
209 - || !alarmAction.getDeviceId().contains(deviceId)){  
210 - return null;  
211 - } 203 + TriggerState state = null;
  204 + ActionAlarmDTO alarm = JacksonUtil.convertValue(alarmAction.getDoContext(), ActionAlarmDTO.class);
  205 + if (alarm != null && alarm.getClearRule() != null) {
  206 + for(TriggerDTO rule:alarm.getClearRule()){
  207 + if((ScopeEnum.PART.equals(rule.getEntityType()) && !rule.getEntityId().contains(deviceId))
  208 + || !alarmAction.getDeviceId().contains(deviceId)){
  209 + return null;
  210 + }
212 211
213 - for (AlarmConditionFilter filter : rule.getTriggerCondition().getCondition().getCondition()) {  
214 - String tempKey =filter.getKey().getKey();  
215 - if(key.equals(tempKey)){  
216 - state = createTriggerState(deviceId, rule.getTriggerCondition());  
217 - triggerState.put(cacheKey, state);  
218 - break;  
219 - }  
220 - }  
221 - if(state != null){ 212 + for (AlarmConditionFilter filter : rule.getTriggerCondition().getCondition().getCondition()) {
  213 + String tempKey =filter.getKey().getKey();
  214 + if(key.equals(tempKey)){
  215 + state = createTriggerState(deviceId, rule.getTriggerCondition());
  216 + triggerState.put(cacheKey, state);
222 break; 217 break;
223 } 218 }
224 } 219 }
225 - return state; 220 + if(state != null){
  221 + break;
  222 + }
226 } 223 }
  224 + return state;
227 } 225 }
228 return null; 226 return null;
229 227