lyhzzz 6 月之前
父節點
當前提交
6e1acceea3

+ 4 - 0
src/main/java/com/fdkankan/ucenter/service/impl/SceneCooperationCountServiceImpl.java

@@ -1,5 +1,6 @@
 package com.fdkankan.ucenter.service.impl;
 
+import com.alibaba.druid.sql.visitor.functions.Concat;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.fdkankan.ucenter.entity.SceneCooperationCount;
@@ -61,6 +62,9 @@ public class SceneCooperationCountServiceImpl extends ServiceImpl<ISceneCooperat
 
     @Override
     public List<SceneCooperationCount> getByNumList(List<String> numList) {
+        if(numList == null || numList.isEmpty()){
+            return new ArrayList<>();
+        }
         LambdaQueryWrapper<SceneCooperationCount> wrapper = new LambdaQueryWrapper<>();
         wrapper.in(SceneCooperationCount::getNum,numList);
         return this.list(wrapper);

+ 7 - 0
src/main/java/com/fdkankan/ucenter/service/impl/SceneCooperationServiceImpl.java

@@ -394,9 +394,16 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
         HashMap<String,Integer> freeMap = new HashMap<>();
         freeCountList.forEach(e -> freeMap.put(e.getNum(),e.getCount()));
 
+        HashMap<String, List<User>> map = this.getByNumList(numList);
         Integer totalCount = 0;
         for (String num : numList) {
             Integer freeCount = freeMap.get(num) == null ? 1 :freeMap.get(num);
+
+            List<User> dbUserList = map.get(num);
+            if(dbUserList != null && !dbUserList.isEmpty()){
+                freeCount = freeCount - dbUserList.size();
+            }
+
             totalCount +=  users.size() - freeCount ;
 
         }