lyhzzz il y a 5 mois
Parent
commit
2f50120f7c

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

@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import java.util.stream.Collectors;
@@ -32,9 +33,10 @@ public class SceneCooperationCountServiceImpl extends ServiceImpl<ISceneCooperat
         }
         List<SceneCooperationCount> sceneCooperationCounts = this.getByNumList(numList);
         Set<String> dbNumList = sceneCooperationCounts.stream().map(SceneCooperationCount::getNum).collect(Collectors.toSet());
+        Set<String> addNumList = new HashSet<>(numList);
 
         List<SceneCooperationCount> saveList = new ArrayList<>();
-        for (String num : numList) {
+        for (String num : addNumList) {
             if(!dbNumList.contains(num)){
                 SceneCooperationCount count = new SceneCooperationCount();
                 count.setNum(num);
@@ -46,7 +48,7 @@ public class SceneCooperationCountServiceImpl extends ServiceImpl<ISceneCooperat
             this.saveBatch(saveList);
         }
 
-        List<Integer> updateList = new ArrayList<>();
+        Set<Integer> updateList = new HashSet<>();
         for (SceneCooperationCount sceneCooperationCount : sceneCooperationCounts) {
             if(sceneCooperationCount.getCount() < size){
                 updateList.add(sceneCooperationCount.getId());