|
@@ -8,6 +8,7 @@ import com.fdkankan.fusion.common.ResultCode;
|
|
|
import com.fdkankan.fusion.common.ResultData;
|
|
|
import com.fdkankan.fusion.common.util.*;
|
|
|
import com.fdkankan.fusion.entity.CaseNumEntity;
|
|
|
+import com.fdkankan.fusion.entity.FusionNum;
|
|
|
import com.fdkankan.fusion.entity.Model;
|
|
|
import com.fdkankan.fusion.exception.BusinessException;
|
|
|
import com.fdkankan.fusion.httpClient.client.FdKKClient;
|
|
@@ -198,7 +199,8 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNumEntit
|
|
|
|
|
|
private List<String> updateByNumList(Integer caseId, List<SceneNumParam> sceneNumParam) {
|
|
|
List<String> addList = new ArrayList<>();
|
|
|
- List<String> delMsgList = new ArrayList<>();
|
|
|
+ HashMap<Integer, FusionNum> fusionNumHashMap = fusionNumService.getByCaseId(caseId);
|
|
|
+ HashMap<Integer,List<String>> delMap = new HashMap<>();
|
|
|
for (SceneNumParam param : sceneNumParam) {
|
|
|
Integer type = param.getType();
|
|
|
List<String> numList = param.getNumList();
|
|
@@ -206,12 +208,12 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNumEntit
|
|
|
wrapper.eq(CaseNumEntity::getCaseId,caseId);
|
|
|
wrapper.eq(CaseNumEntity::getNumType,type);
|
|
|
List<CaseNumEntity> list = this.list(wrapper);
|
|
|
+
|
|
|
List<String> hanNumList = list.parallelStream().map(CaseNumEntity::getNum).collect(Collectors.toList());
|
|
|
List<String> delList = new ArrayList<>();
|
|
|
for (String num : hanNumList) {
|
|
|
if(!numList.contains(num)){
|
|
|
delList.add(num);
|
|
|
- delMsgList.add(num);
|
|
|
}
|
|
|
}
|
|
|
for (String num : numList) {
|
|
@@ -219,10 +221,21 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNumEntit
|
|
|
addList.add(num);
|
|
|
}
|
|
|
}
|
|
|
- this.deleteByNum(caseId,delList,param.getType());
|
|
|
+ if(!delList.isEmpty()){
|
|
|
+ HashMap<String, Model> mapByNum = modelService.getMapByNum(delList);
|
|
|
+ for (String key : mapByNum.keySet()) {
|
|
|
+ Model model = mapByNum.get(key);
|
|
|
+ if(model != null && model.getType().equals(param.getType()) && fusionNumHashMap.containsKey(model.getModelId())){
|
|
|
+ throw new BusinessException(ResultCode.DEL_NUM_ERROR);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ delMap.put(param.getType(),delList);
|
|
|
+ }
|
|
|
}
|
|
|
- if(!delMsgList.isEmpty()){
|
|
|
- sessionService.sendSingleByCaseId(caseId, WsMessage.okResult(CommonEnum.NOTICE, ResultData.error(ResultCode.CASE_REMOVE_SCENE)));
|
|
|
+ if(!delMap.isEmpty()){
|
|
|
+ for (Integer type : delMap.keySet()) {
|
|
|
+ this.deleteByNum(caseId,delMap.get(type),type);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return addList;
|