lyhzzz 5 tháng trước cách đây
mục cha
commit
809a7044c2

+ 13 - 11
src/main/java/com/fdkankan/ucenter/service/impl/SceneCooperationServiceImpl.java

@@ -277,9 +277,17 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
 
     @Override
     public ProductOrder saveBatchCooperation(SceneCooperationParam param, String loginUserName) {
-        if(param.getUserNameList() == null || param.getUserNameList().isEmpty() || StringUtils.isEmpty(param.getSceneNum())){
+        if( StringUtils.isEmpty(param.getSceneNum())){
             throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
         }
+
+        String[] nums = param.getSceneNum().split(",");
+        List<String> numList =  Arrays.asList(nums);
+
+        if(param.getUserNameList() == null || param.getUserNameList().isEmpty()){
+            this.deleteCooperationList(numList,null);
+            return null;
+        }
         if(param.getUserNameList().contains( loginUserName)){
             throw new BusinessException(LoginConstant.FAILURE_CODE_3024, LoginConstant.FAILURE_MSG_3024);
         }
@@ -296,8 +304,7 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
             }
             users.add(user);
         }
-        String[] nums = param.getSceneNum().split(",");
-        List<String> numList =  Arrays.asList(nums);
+
 
         ProductOrder productOrder = checkNeedPay(numList, users, loginUser, param.getPayType(), param.getTimeZone(),null,param.getLang());
 
@@ -423,14 +430,14 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
     private void saveCooperationCommon(User LoginUser,String lang,List<User> userList,List<ScenePro> proList, List<ScenePlus> plusList,List<Camera >cameraList,String type){
 
         List<Long> userIds = userList.stream().map(User::getId).collect(Collectors.toList());
-        List<String> numList = new ArrayList<>();
+        Set<String> numList = new HashSet<>();
         List<String> v3List = proList.stream().map(ScenePro::getNum).collect(Collectors.toList());
         List<String> v4List = plusList.stream().map(ScenePlus::getNum).collect(Collectors.toList());
         numList.addAll(v3List);
         numList.addAll(v4List);
         List<SceneCooperation> addList =new ArrayList<>();
         if( !numList.isEmpty()){
-            addList = this.saveBatchByList(numList, userIds, type);
+            addList = this.saveBatchByList(new ArrayList<>(numList), userIds, type);
         }
         List<Long> collect3 = addList.stream().map(SceneCooperation::getUserId).collect(Collectors.toList());
         for (User user : userList) {
@@ -447,17 +454,12 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
             }
         }
 
-        List<ScenePro> collect1 = proList.stream().filter(e -> SceneSourceUtil.getLaserList().contains(e.getSceneSource())).collect(Collectors.toList());
-        List<ScenePlus> collect2 = plusList.stream().filter(e -> SceneSourceUtil.getLaserList().contains(e.getSceneSource())).collect(Collectors.toList());
-        List<String> numList1 = collect1.stream().map(ScenePro::getNum).collect(Collectors.toList());
-        List<String> numList2 = collect2.stream().map(ScenePlus::getNum).collect(Collectors.toList());
-        numList1.addAll(numList2);
         List<String> collect = userList.stream().map(User::getUserName).collect(Collectors.toList());
         List<String> snCodeList = new ArrayList<>();
         if(cameraList !=null ){
             snCodeList = cameraList.stream().map(Camera::getSnCode).collect(Collectors.toList());
         }
-        laserService.saveBatchCooperation(numList2,snCodeList,LoginUser.getUserName(),collect,type);
+        laserService.saveBatchCooperation(new ArrayList<>(numList),snCodeList,LoginUser.getUserName(),collect,type);
 
     }