Browse Source

fix过滤引擎

thing_master
siyang 1 year ago
parent
commit
12b67ac7d8
  1. 7
      modules/filter-rule/src/main/java/com/thing/filter/rule/listener/FilterLogSaveEventListener.java

7
modules/filter-rule/src/main/java/com/thing/filter/rule/listener/FilterLogSaveEventListener.java

@ -241,12 +241,13 @@ public class FilterLogSaveEventListener {
Set<FilterLogEntity> unMergedLogs = new HashSet<>(); Set<FilterLogEntity> unMergedLogs = new HashSet<>();
for (FilterLogEntity currentLog : logs) { for (FilterLogEntity currentLog : logs) {
Set<String> thingAttrs; Set<String> thingAttrs;
if(onlyMergeMissThingAttr){
if (onlyMergeMissThingAttr) {
thingAttrs = currentLog.getMissingThingAttrs(); thingAttrs = currentLog.getMissingThingAttrs();
if (CollectionUtils.isEmpty(thingAttrs)) { if (CollectionUtils.isEmpty(thingAttrs)) {
mergedLogs.add(currentLog);
continue; continue;
} }
}else {
} else {
thingAttrs = currentLog.getDefThingAttrs(); thingAttrs = currentLog.getDefThingAttrs();
} }
thingAttrs.forEach( thingAttrs.forEach(
@ -271,7 +272,9 @@ public class FilterLogSaveEventListener {
} }
}); });
} }
if (!unMergedLogs.isEmpty()) {
mergedLogs.addAll(unMergedLogs); mergedLogs.addAll(unMergedLogs);
}
return mergedLogs.stream().filter(Objects::nonNull).collect(Collectors.toSet()); return mergedLogs.stream().filter(Objects::nonNull).collect(Collectors.toSet());
} }

Loading…
Cancel
Save