lyhzzz 5 hónapja
szülő
commit
e1684efe0c

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

@@ -7,6 +7,7 @@ import com.fdkankan.ucenter.entity.SceneCooperationCount;
 import com.fdkankan.ucenter.mapper.ISceneCooperationCountMapper;
 import com.fdkankan.ucenter.service.ISceneCooperationCountService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
@@ -70,7 +71,9 @@ public class SceneCooperationCountServiceImpl extends ServiceImpl<ISceneCooperat
         }
         LambdaQueryWrapper<SceneCooperationCount> wrapper = new LambdaQueryWrapper<>();
         wrapper.in(SceneCooperationCount::getNum,numList);
-        wrapper.eq(SceneCooperationCount::getSceneType,sceneType);
+        if(StringUtils.isNotBlank(sceneType)){
+            wrapper.eq(SceneCooperationCount::getSceneType,sceneType);
+        }
         return this.list(wrapper);
     }
 

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

@@ -402,7 +402,13 @@ 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) {
         List<SceneCooperationCount> freeCountList = sceneCooperationCountService.getByNumList(numList,sceneType);
         HashMap<String,Integer> freeMap = new HashMap<>();
-        freeCountList.forEach(e -> freeMap.put(e.getNum(),e.getCount()));
+        for (SceneCooperationCount count : freeCountList) {
+            if(freeMap.get(count.getNum()) != null){
+                freeMap.put(count.getNum(),count.getCount());
+            }else {
+                freeMap.put(count.getNum(),freeMap.get(count.getNum() + count.getCount()));
+            }
+        }
 
         HashMap<String, List<User>> map = this.getByNumList(numList,sceneType);
         Integer totalCount = 0;