|
@@ -99,6 +99,20 @@ public class ContractInventoryFormServiceImpl extends BaseServiceImpl<ContractIn
|
|
|
throw new ServiceException("excel中有清单数量未填写,填写单价则必须填写数量");
|
|
|
}
|
|
|
});
|
|
|
+ //校验Excel中是否存在相同的导入编号
|
|
|
+ List<String> imports = excels.stream().map(l -> l.getImportNumber()).collect(Collectors.toList());
|
|
|
+ Set<String> imp = imports.stream().filter(i -> Collections.frequency(imports, i) > 1)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ if (imp.size() > 0){
|
|
|
+ throw new ServiceException("重复的导入编号:"+String.join(",",imp));
|
|
|
+ }
|
|
|
+ //校验Excel中是否存在相同的清单编号
|
|
|
+ List<String> numbers = excels.stream().map(l -> l.getFormNumber()).collect(Collectors.toList());
|
|
|
+ Set<String> numb = numbers.stream().filter(i -> Collections.frequency(numbers, i) > 1)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ if (numb.size() > 0){
|
|
|
+ throw new ServiceException("重复的清单编号:"+String.join(",",numb));
|
|
|
+ }
|
|
|
allTotal = excels.size();
|
|
|
List<Integer> firstNode = new ArrayList<>();
|
|
|
//获取当前合同的首节点
|
|
@@ -250,9 +264,9 @@ public class ContractInventoryFormServiceImpl extends BaseServiceImpl<ContractIn
|
|
|
//判断要新增的数据中,清单编号是否已经存在
|
|
|
List<String> collect = list.stream().map(l -> l.getFormNumber()).collect(Collectors.toList());
|
|
|
if (nodes != 0 && collect.size() > 0){
|
|
|
- List<String> numbers = baseMapper.getAllEqualsNumber(contractId,collect);
|
|
|
- if (numbers.size() > 0){
|
|
|
- throw new ServiceException("以下清单编号已经存在:["+StringUtils.join(numbers,",")+"],请修改excel后重新导入");
|
|
|
+ List<String> numbs = baseMapper.getAllEqualsNumber(contractId,collect);
|
|
|
+ if (numbs.size() > 0){
|
|
|
+ throw new ServiceException("以下清单编号已经存在:["+StringUtils.join(numbs,",")+"],请修改excel后重新导入");
|
|
|
}
|
|
|
}
|
|
|
endTotal = list.size();
|