diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationInventoryEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationInventoryEOServiceImpl.java index f86813fb3..489cae778 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationInventoryEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationInventoryEOServiceImpl.java @@ -2859,6 +2859,49 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl 1) { dataList.add(rowList); } @@ -3518,8 +3561,10 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl datas, ProjectCertificationInventoryEO projectCertificationInventoryEOTemp) { - //1. 验证标准号在文档库中是否存在 + + List serialNumberList = datas.stream().map(ProjectCertificationInventoryEO::getSerialNumber).collect(Collectors.toList()); + //1. 验证标准号在文档库中是否存在 LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.in(BussDocumentLibraryEO::getSerialNumber,serialNumberList); List bussDocumentLibraryEOList = iBussDocumentLibraryEOService.list(wrapper); @@ -3537,24 +3582,31 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl collect = bussDocumentLibraryEOList.stream() - .filter(e -> e.getSerialNumber().equals(projectCertificationInventoryEO.getSerialNumber())).collect(Collectors.toList()); - projectCertificationInventoryEO.setBussDocumentLibraryId(collect.get(0).getId()); + //验证编号在法规清单中是否存在 + LambdaQueryWrapper lwrapper = new LambdaQueryWrapper<>(); + lwrapper.in(ProjectLawsInventoryEO::getSerialNumber,serialNumberList); + List projectLawsInventoryEOList = projectLawsInventoryEOService.list(lwrapper); + List LawSerialNumberListTemp = projectLawsInventoryEOList.stream().map(ProjectLawsInventoryEO::getSerialNumber).distinct().collect(Collectors.toList()); + if(serialNumberList.size() != LawSerialNumberListTemp.size()){ + //存在法规清单中没有的数据 + List collect = projectLawsInventoryEOList.stream().map(ProjectLawsInventoryEO::getSerialNumber).collect(Collectors.toList()); + List serialNumbers = serialNumberList.stream().filter(e -> !collect.contains(e)).collect(Collectors.toList()); + if(serialNumbers.size() > 0){ + if(CutEnum.CN.getValue().equals(datas.get(0).getCut())){ + throw new JeroBootException(StringUtils.join(serialNumbers,",")+"法规清单中不存在,不能添加"); + }else{ + throw new JeroBootException(StringUtils.join(serialNumbers,",")+" does not exist in the project laws and cannot be added"); + } + } + }else{ + for (ProjectCertificationInventoryEO projectCertificationInventoryEO : datas) { + List collect = bussDocumentLibraryEOList.stream() + .filter(e -> e.getSerialNumber().equals(projectCertificationInventoryEO.getSerialNumber())).collect(Collectors.toList()); + projectCertificationInventoryEO.setBussDocumentLibraryId(collect.get(0).getId()); + } } } -// //2. 验证标准号在法规清单中是否添加过 -// LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); -// lambdaQueryWrapper.in(ProjectCertificationInventoryEO::getSerialNumber,serialNumberList).in(ProjectCertificationInventoryEO::getProjectLibraryId,projectCertificationInventoryEOTemp.getProjectLibraryId()); -// List projectCertificationInventoryEOList = this.list(lambdaQueryWrapper); -// List serialNumberTempList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getSerialNumber).collect(Collectors.toList()); -// if(projectCertificationInventoryEOList.size() > 0){ -// if(CutEnum.CN.getValue().equals(datas.get(0).getCut())){ -// throw new JeroBootException(StringUtils.join(serialNumberTempList,",")+"已存在,不能重复添加"); -// }else{ -// throw new JeroBootException(StringUtils.join(serialNumberTempList,",")+" already exists and cannot be added again"); -// } -// } + } /**