Browse Source

截图定时优化

wyyay 9 months ago
parent
commit
7f7b8f11a7

+ 4 - 1
business-service/src/main/java/com/ozs/service/service/impl/MsgAlarmServiceImpl.java

@@ -15,6 +15,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ozs.service.service.RedisService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
 
 import java.util.*;
 import java.util.stream.Collectors;
@@ -157,6 +158,7 @@ public class MsgAlarmServiceImpl extends ServiceImpl<MsgAlarmMapper, MsgAlarm> i
     @Override
     public void getNormalBaseCameraManagementsCache(String setType) {
         Set<BaseCameraVO> alarmSet = redisService.getSetMembers(Constants.ALARM_SET);
+        if(!CollectionUtils.isEmpty(alarmSet)) {
         Set<String> cameraCodeSet = alarmSet.stream()
                 .map(BaseCameraVO::getCameraCode)
                 .collect(Collectors.toSet());
@@ -166,12 +168,13 @@ public class MsgAlarmServiceImpl extends ServiceImpl<MsgAlarmMapper, MsgAlarm> i
             queryWrapper.notIn("camera_code", cameraCodeSet);
             Set<BaseCameraManagement> set = baseCameraManagementMapper.selectList(queryWrapper).stream().collect(Collectors.toSet());
             set.forEach(item -> {
-                BaseCameraVO  baseCameraVO=new BaseCameraVO();
+                BaseCameraVO baseCameraVO = new BaseCameraVO();
                 baseCameraVO.setCameraCode(item.getCameraCode());
                 baseCameraVO.setChannel(item.getChannel());
                 redisService.addToSet(Constants.NORMAL_SET, baseCameraVO);
             });
         }
+        }
     }
 
     @Override