瀏覽代碼

协作资源bug

lyhzzz 1 年之前
父節點
當前提交
07edd22fa1
共有 1 個文件被更改,包括 10 次插入4 次删除
  1. 10 4
      src/main/java/com/fdkankan/ucenter/service/impl/CameraServiceImpl.java

+ 10 - 4
src/main/java/com/fdkankan/ucenter/service/impl/CameraServiceImpl.java

@@ -376,10 +376,16 @@ public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implem
         List<ScenePlus> scenePlusList = scenePlusService.getListByCameraIds(cameraIds);
         sceneCooperationService.deleteCooperationList(sceneProList,scenePlusList);
 
-        List<Long> v3Ids = v3List.stream().map(SceneResource::getId).collect(Collectors.toList());
-        List<Long> v4Ids = v4List.stream().map(SceneResource::getId).collect(Collectors.toList());
-        sceneCooperationService.saveBatchByList(sceneProList,new ArrayList<>(),user.getId(),v3Ids);
-        sceneCooperationService.saveBatchByList(new ArrayList<>(),scenePlusList,user.getId(),v4Ids);
+        if(!v3List.isEmpty() && !sceneProList.isEmpty()){
+            List<Long> v3Ids = v3List.stream().map(SceneResource::getId).collect(Collectors.toList());
+            sceneCooperationService.saveBatchByList(sceneProList,new ArrayList<>(),user.getId(),v3Ids);
+        }
+
+        if(!v4List.isEmpty() && !scenePlusList.isEmpty()){
+            List<Long> v4Ids = v4List.stream().map(SceneResource::getId).collect(Collectors.toList());
+            sceneCooperationService.saveBatchByList(new ArrayList<>(),scenePlusList,user.getId(),v4Ids);
+        }
+
 
         fdkkLaserService.disableCooperation(detailMap, cameraMap);
         fdkkLaserService.enableCameraCooperation(detailMap, cameraMap, username);