Browse Source

场景批量协作

lyhzzz 1 year ago
parent
commit
99643c3906

+ 15 - 1
src/main/java/com/fdkankan/ucenter/service/impl/SceneCooperationServiceImpl.java

@@ -237,13 +237,27 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
         List<ScenePlus> plusList = scenePlusService.getListByNums(numList);
         List<ScenePlus> plusList = scenePlusService.getListByNums(numList);
         this.deleteCooperationList(proList,plusList);
         this.deleteCooperationList(proList,plusList);
 
 
+        List<SceneResource> v3List = new ArrayList<>();
+        List<SceneResource> v4List = new ArrayList<>();
         List<Long> resourceIdList = new ArrayList<>();
         List<Long> resourceIdList = new ArrayList<>();
         if (StringUtils.isNotEmpty(param.getResourceIds())) {
         if (StringUtils.isNotEmpty(param.getResourceIds())) {
             for (String rId : param.getResourceIds().split(",")) {
             for (String rId : param.getResourceIds().split(",")) {
                 resourceIdList.add(Long.valueOf(rId));
                 resourceIdList.add(Long.valueOf(rId));
             }
             }
+            List<SceneResource> sceneResources = sceneResourceService.listByIds(resourceIdList);
+            v3List = sceneResources.stream().filter(entity -> entity.getVersion().equals("v3")).collect(Collectors.toList());
+            v4List = sceneResources.stream().filter(entity -> entity.getVersion().equals("v4")).collect(Collectors.toList());
         }
         }
-        this.saveBatchByList(proList,plusList,user.getId(),resourceIdList);
+
+        if(!v3List.isEmpty() && !proList.isEmpty()){
+            List<Long> v3Ids = v3List.stream().map(SceneResource::getId).collect(Collectors.toList());
+            this.saveBatchByList(proList,new ArrayList<>(),user.getId(),v3Ids);
+        }
+        if(!v4List.isEmpty() && !plusList.isEmpty()){
+            List<Long> v4Ids = v4List.stream().map(SceneResource::getId).collect(Collectors.toList());
+            this.saveBatchByList(new ArrayList<>(),plusList,user.getId(),v4Ids);
+        }
+
         if("aws".equals(NacosProperty.uploadType)){
         if("aws".equals(NacosProperty.uploadType)){
             mailTemplateService.sendSceneCooperation(proList,plusList,param.getUserName(),param.getLang());
             mailTemplateService.sendSceneCooperation(proList,plusList,param.getUserName(),param.getLang());
         }
         }