Browse Source

提交怀疑问题

zk 3 weeks ago
parent
commit
bb60cfc396
1 changed files with 14 additions and 13 deletions
  1. 14 13
      src/main/java/com/shcd/boat/service/impl/ShipSealOffServiceImpl.java

+ 14 - 13
src/main/java/com/shcd/boat/service/impl/ShipSealOffServiceImpl.java

@@ -604,19 +604,20 @@ public  class ShipSealOffServiceImpl implements ShipSealOffService {
             List<String> keys = cacheKeys.stream().collect(Collectors.toList());
             List<String> filteredKeys = keys.stream().filter(key -> !key.contains("_zy")).map(s->s.replace(type.getWarningType()+"_",""))
                     .collect(Collectors.toList());
-            LambdaQueryWrapper<ShipSealOffInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
-            lambdaQueryWrapper.ne(ShipSealOffInfo::getWarningVerifyStatus, "待核实");
-            lambdaQueryWrapper.in(ShipSealOffInfo::getMmsi, filteredKeys);
-            lambdaQueryWrapper.eq(ShipSealOffInfo::getWarningType, type.getWarningType());
-            lambdaQueryWrapper.eq(ShipSealOffInfo::getDelFlag, "0");
-            List<ShipSealOffInfo> shipSealOffInfos= shipSealOffInfoService.list(lambdaQueryWrapper);
-            if (shipSealOffInfos!=null && shipSealOffInfos.size()>0)
-            {
-                List<String> mmsis=shipSealOffInfos.stream().map(ShipSealOffInfo::getMmsi).collect(Collectors.toList());
-                log.info("=== 1.1 查询到 存在缓存中的数据已经确认过的数据,开始清除相关缓存,清除船舶为:"+mmsis.toString());
-                mmsis.forEach(i->{
-                    redisUtilTemplate.deleteObject(i);
-                });
+            if(filteredKeys!=null && filteredKeys.size()>0) {
+                LambdaQueryWrapper<ShipSealOffInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+                lambdaQueryWrapper.ne(ShipSealOffInfo::getWarningVerifyStatus, "待核实");
+                lambdaQueryWrapper.in(ShipSealOffInfo::getMmsi, filteredKeys);
+                lambdaQueryWrapper.eq(ShipSealOffInfo::getWarningType, type.getWarningType());
+                lambdaQueryWrapper.eq(ShipSealOffInfo::getDelFlag, "0");
+                List<ShipSealOffInfo> shipSealOffInfos = shipSealOffInfoService.list(lambdaQueryWrapper);
+                if (shipSealOffInfos != null && shipSealOffInfos.size() > 0) {
+                    List<String> mmsis = shipSealOffInfos.stream().map(ShipSealOffInfo::getMmsi).collect(Collectors.toList());
+                    log.info("=== 1.1 查询到 存在缓存中的数据已经确认过的数据,开始清除相关缓存,清除船舶为:" + mmsis.toString());
+                    mmsis.forEach(i -> {
+                        redisUtilTemplate.deleteObject(i);
+                    });
+                }
             }
         }