From b8b88190f538797aadc8c010a379c7ca96b73c4f Mon Sep 17 00:00:00 2001 From: cuijiaming <1410452759@qq.com> Date: Thu, 30 Mar 2023 16:35:14 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A4=E8=AF=81=E6=B8=85=E5=8D=95=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E5=BF=85=E5=A1=AB=E9=A1=B9=E6=A0=A1=E9=AA=8C=E5=92=8C?= =?UTF-8?q?=E7=BC=96=E5=8F=B7=E9=AA=8C=E8=AF=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ctCertificationInventoryEOServiceImpl.java | 86 +++++++++++++++---- 1 file changed, 69 insertions(+), 17 deletions(-) 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"); -// } -// } + } /**