gao.qiang 2 hónapja
szülő
commit
e3de877c66

+ 9 - 3
business-service/src/main/java/com/ozs/service/service/impl/MsgAlarmServiceImpl.java

@@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.ObjectUtils;
+import org.springframework.util.StringUtils;
 
 import java.util.*;
 import java.util.stream.Collectors;
@@ -170,9 +171,14 @@ public class MsgAlarmServiceImpl extends ServiceImpl<MsgAlarmMapper, MsgAlarm> i
         Set<BaseCameraVO> alarmSet = redisService.getSetMembers(Constants.ALARM_SET);
         log.info("-----------alarmSet------" + alarmSet);
         if (!ObjectUtils.isEmpty(alarmSet)) {
-            Set<String> cameraCodeSet = alarmSet.stream()
-                    .map(BaseCameraVO::getCameraCode)
-                    .collect(Collectors.toSet());
+            Set<String> cameraCodeSet = new HashSet<>();
+            alarmSet.forEach(camera -> {
+                if (!ObjectUtils.isEmpty(camera)) {
+                    if (!StringUtils.isEmpty(camera.getCameraCode())) {
+                        cameraCodeSet.add(camera.getCameraCode());
+                    }
+                }
+            });
             log.info("-----------cameraCodeSet------" + cameraCodeSet);
             QueryWrapper<BaseCameraManagement> queryWrapper = new QueryWrapper<>();
             log.info("-----------Constants.ALARM_SET------" + Constants.ALARM_SET);