|
|
@@ -73,27 +73,26 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNumEntit
|
|
|
public void addBatch(Integer caseId, List<SceneNumParam> sceneNumParam) {
|
|
|
|
|
|
// this.deleteByCaseId(caseId);
|
|
|
- List<String> addNumList = this.updateByNumList(caseId, sceneNumParam);
|
|
|
- if(addNumList == null || addNumList.size()<=0){
|
|
|
+ HashMap<Integer,List<String>> addMap = this.updateByNumList(caseId, sceneNumParam);
|
|
|
+ if(addMap == null || addMap.size()<=0){
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
List<CaseNumEntity> newCaseNums = new ArrayList<>();
|
|
|
|
|
|
- HashMap<Integer,HashSet<String>> map = new HashMap<>();
|
|
|
- for (SceneNumParam numParam : sceneNumParam) {
|
|
|
- if(map.get(numParam.getType()) == null){
|
|
|
- HashSet<String> set = new HashSet<>(numParam.getNumList());
|
|
|
- map.put(numParam.getType(),set);
|
|
|
- }else {
|
|
|
- map.get(numParam.getType()).addAll(numParam.getNumList());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- for (Integer type : map.keySet()) {
|
|
|
- HashSet<String> nulList = map.get(type);
|
|
|
- List<String> numList = new ArrayList<>(nulList);
|
|
|
- HashSet<String> setNum = new HashSet<>(numList);
|
|
|
+// HashMap<Integer,HashSet<String>> map = new HashMap<>();
|
|
|
+// for (SceneNumParam numParam : sceneNumParam) {
|
|
|
+// if(map.get(numParam.getType()) == null){
|
|
|
+// HashSet<String> set = new HashSet<>(numParam.getNumList());
|
|
|
+// map.put(numParam.getType(),set);
|
|
|
+// }else {
|
|
|
+// map.get(numParam.getType()).addAll(numParam.getNumList());
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+ for (Integer type : addMap.keySet()) {
|
|
|
+ List<String> nulList = addMap.get(type);
|
|
|
+ HashSet<String> setNum = new HashSet<>(nulList);
|
|
|
for (String num : setNum) {
|
|
|
CaseNumEntity caseNumEntity = new CaseNumEntity();
|
|
|
caseNumEntity.setCaseId(caseId);
|
|
|
@@ -114,12 +113,13 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNumEntit
|
|
|
|
|
|
|
|
|
|
|
|
- private synchronized List<String> updateByNumList(Integer caseId, List<SceneNumParam> sceneNumParam) {
|
|
|
- List<String> addList = new ArrayList<>();
|
|
|
+ private synchronized HashMap<Integer,List<String>> updateByNumList(Integer caseId, List<SceneNumParam> sceneNumParam) {
|
|
|
+ HashMap<Integer,List<String>> addMap = new HashMap<>();
|
|
|
HashMap<Integer,List<String>> delMap = new HashMap<>();
|
|
|
for (SceneNumParam param : sceneNumParam) {
|
|
|
Integer type = param.getType();
|
|
|
List<String> numList = param.getNumList();
|
|
|
+
|
|
|
LambdaQueryWrapper<CaseNumEntity> wrapper = new LambdaQueryWrapper<>();
|
|
|
wrapper.eq(CaseNumEntity::getCaseId,caseId);
|
|
|
wrapper.eq(CaseNumEntity::getNumType,type);
|
|
|
@@ -134,8 +134,8 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNumEntit
|
|
|
}
|
|
|
for (String num : numList) {
|
|
|
if(!hanNumList.contains(num)){
|
|
|
- log.info("list:{},{}",hanNumList,num);
|
|
|
- addList.add(num);
|
|
|
+ addMap.computeIfAbsent(param.getType(), k -> new ArrayList<>());
|
|
|
+ addMap.get(param.getType()).add(num);
|
|
|
}
|
|
|
}
|
|
|
if(!delList.isEmpty()){
|
|
|
@@ -148,7 +148,7 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNumEntit
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return addList;
|
|
|
+ return addMap;
|
|
|
}
|
|
|
|
|
|
@Override
|