lyhzzz 5 mēneši atpakaļ
vecāks
revīzija
b9bd3aa56b

+ 1 - 3
src/main/java/com/fdkankan/ucenter/service/impl/SceneCooperationCountServiceImpl.java

@@ -71,9 +71,7 @@ public class SceneCooperationCountServiceImpl extends ServiceImpl<ISceneCooperat
         }
         LambdaQueryWrapper<SceneCooperationCount> wrapper = new LambdaQueryWrapper<>();
         wrapper.in(SceneCooperationCount::getNum,numList);
-        if(StringUtils.isNotBlank(sceneType)){
-            wrapper.eq(SceneCooperationCount::getSceneType,sceneType);
-        }
+        wrapper.eq(SceneCooperationCount::getSceneType,sceneType);
         return this.list(wrapper);
     }
 

+ 16 - 5
src/main/java/com/fdkankan/ucenter/service/impl/SceneCooperationServiceImpl.java

@@ -405,6 +405,21 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
 
 
     private ProductOrder checkNeedPay(List<String> numList, List<User> users,User loginUser,Integer payType,Integer timeZone,Long cameraId,String lang,String sceneType) {
+        Integer totalCount = 0;
+        if(StringUtils.isBlank(sceneType)){
+            totalCount += getTotalCount(numList,users,"mesh",cameraId);
+            totalCount += getTotalCount(numList,users,"laser",cameraId);
+        }else {
+            totalCount += getTotalCount(numList,users,sceneType,cameraId);
+        }
+        if(totalCount <=0){
+            return null;
+        }
+        return productOrderService.createOrder(totalCount, "cooperation", loginUser, payType, timeZone,cameraId,lang,sceneType);
+
+    }
+
+    private Integer getTotalCount(List<String> numList, List<User> users,String sceneType,Long cameraId){
         List<SceneCooperationCount> freeCountList = sceneCooperationCountService.getByNumList(numList,sceneType);
         HashMap<String,Integer> freeMap = new HashMap<>();
         for (SceneCooperationCount count : freeCountList) {
@@ -432,11 +447,7 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
             totalCount +=  (users.size() - freeCount );
 
         }
-        if(totalCount <=0){
-            return null;
-        }
-        return productOrderService.createOrder(totalCount, "cooperation", loginUser, payType, timeZone,cameraId,lang,sceneType);
-
+        return totalCount;
     }
 
     @Autowired