From c20a9314e5b5055f80198cbcbfe9c1ecd8d6c7e9 Mon Sep 17 00:00:00 2001 From: liyawei Date: Thu, 30 Jun 2022 11:46:47 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A4=E8=AF=81-=E5=8F=82=E6=95=B0=E9=A1=B9-?= =?UTF-8?q?bug55113?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ParamsInfoEOServiceImpl.java | 65 +++++++++++++++---- 1 file changed, 52 insertions(+), 13 deletions(-) diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/impl/ParamsInfoEOServiceImpl.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/impl/ParamsInfoEOServiceImpl.java index a02b651ac..e4a311b2e 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/impl/ParamsInfoEOServiceImpl.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/impl/ParamsInfoEOServiceImpl.java @@ -127,7 +127,7 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl ccParamsInfoList = certCategoryParamsInfoEOList.stream() .collect(Collectors.collectingAndThen(Collectors - .toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getCertCategory() + ";" + o.getParamsNumber()))), ArrayList::new)); + .toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getParamsNumber()))), ArrayList::new)); if (ccParamsInfoList.size() < certCategoryParamsInfoEOList.size()) { if (CutEnum.CN.getValue().equals(paramsInfoEO.getCut())) { throw new JeroBootException("不同类别间参数编号必须唯一!"); @@ -212,7 +212,7 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl ccParamsInfoList = certCategoryParamsInfoEOList.stream() .collect(Collectors.collectingAndThen(Collectors - .toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getCertCategory() + ";" + o.getParamsNumber()))), ArrayList::new)); + .toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getParamsNumber()))), ArrayList::new)); if (ccParamsInfoList.size() < certCategoryParamsInfoEOList.size()) { if (CutEnum.CN.getValue().equals(paramsInfoEO.getCut())) { throw new JeroBootException("不同类别间参数编号必须唯一!"); @@ -260,7 +260,7 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl 不能删 发布版用的同一文件 return removeById(id); } @@ -280,7 +280,7 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl nioNumberList = paramsInfoEOList.stream().map(ParamsInfoEO::getNioNumber).collect(Collectors.toList()); // 关联删除认证类别参数项 certCategoryParamsInfoEOService.deleteByNioNumberList(nioNumberList, paramsTemplateId); - // TODO 关联删除附件模板文件信息和文件 + // 关联删除附件模板文件信息和文件 ---> 不能删 发布版用的同一文件 } return removeByIds(ids); @@ -1098,11 +1098,11 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl nioNumberImport = new ArrayList<>(); // 记录导入的nio编号 int i = 1; //记录行号 - int num = 0; //记录是第几条数据 //循环验证数据 for (ParamsInfoCnImport dto : paramsInfoEOList) { //判断此行数据是否全部为空,是则不读取 if (checkObjAllFieldsIsNull(dto)) { + i++; continue; } @@ -1318,10 +1318,14 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl> ccDtoMap : certCategoryParamsInfoEOListMap.entrySet()) { String certCategory = ccDtoMap.getKey(); List ccDtoList = ccDtoMap.getValue(); + + List ccNioNumberImport = new ArrayList<>(); // 记录导入的nio编号 + int j = 1; for (CertCategoryParamsInfoCnImport ccDto : ccDtoList) { //判断此行数据是否全部为空,是则不读取 if (checkObjAllFieldsIsNull(ccDto)) { + j++; continue; } @@ -1351,6 +1355,20 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl ccDtoAfterDistinct = ccDtoList.stream() + .collect(Collectors.collectingAndThen(Collectors.toCollection(() -> + new TreeSet<>(Comparator.comparing(o -> o.getNioNumber() + ";" + o.getCertCategory()))), ArrayList::new)); + if (ccDtoAfterDistinct.size() < ccDtoList.size()) { + // 取差集 + String reduceOne = ccDtoList.stream() + .filter(e->!ccDtoAfterDistinct.contains(e)).map(CertCategoryParamsInfoCnImport::getNioNumber).collect(Collectors.joining(",")); + if (StringUtils.isNotBlank(reduceOne)) { + if (CutEnum.CN.getValue().equals(cut)) { + stringMessage.add("导入数据中NIO编号:" + reduceOne + "下存在重复认证类别;"); + } else { + stringMessage.add("Repeat cert category exist in NIO Number: " + reduceOne + ";"); + } + } + } + certCategoryParamsInfoEOList.addAll(ccDtoList); } // 校验同 nio下认证参数编号唯一 - List ccDtoAfterDistinct = certCategoryParamsInfoEOList.stream() + List ccDtoAfterDistinctTwo = certCategoryParamsInfoEOList.stream() .collect(Collectors.collectingAndThen(Collectors.toCollection(() -> - new TreeSet<>(Comparator.comparing(o -> o.getNioNumber() + ";" + o.getCertCategory()))), ArrayList::new)); - if (ccDtoAfterDistinct.size() < certCategoryParamsInfoEOList.size()) { - if(CutEnum.CN.getValue().equals(cut)) { - stringMessage.add("导入数据中存在重复认证编号;"); - } else { - stringMessage.add("Repeat number exist in the Import Data;"); + new TreeSet<>(Comparator.comparing(o -> o.getNioNumber() + ";" + o.getParamsNumber()))), ArrayList::new)); + if (ccDtoAfterDistinctTwo.size() < certCategoryParamsInfoEOList.size()) { + // 取差集 + String reduceTwo = certCategoryParamsInfoEOList.stream() + .filter(e->!ccDtoAfterDistinctTwo.contains(e)).map(CertCategoryParamsInfoCnImport::getNioNumber).collect(Collectors.joining(",")); + if (StringUtils.isNotBlank(reduceTwo)) { + if (CutEnum.CN.getValue().equals(cut)) { + stringMessage.add("导入数据中NIO编号:" + reduceTwo + "下存在重复认证编号;"); + } else { + stringMessage.add("Repeat number exist in NIO Number: " + reduceTwo + ";"); + } } } - Map map = new HashMap(); if (stringMessage.isEmpty()) { map.put("result", true);