Merge remote-tracking branch 'origin/dev_third_stage' into dev_third_stage

This commit is contained in:
lixuetao
2022-06-30 12:14:19 +08:00
@@ -127,7 +127,7 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
// 校验认证类别参数项编号 同一nio下编号 不同类别间编号唯一 // 校验认证类别参数项编号 同一nio下编号 不同类别间编号唯一
List<CertCategoryParamsInfoEO> ccParamsInfoList = certCategoryParamsInfoEOList.stream() List<CertCategoryParamsInfoEO> ccParamsInfoList = certCategoryParamsInfoEOList.stream()
.collect(Collectors.collectingAndThen(Collectors .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 (ccParamsInfoList.size() < certCategoryParamsInfoEOList.size()) {
if (CutEnum.CN.getValue().equals(paramsInfoEO.getCut())) { if (CutEnum.CN.getValue().equals(paramsInfoEO.getCut())) {
throw new JeroBootException("不同类别间参数编号必须唯一!"); throw new JeroBootException("不同类别间参数编号必须唯一!");
@@ -212,7 +212,7 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
// 校验认证类别参数项编号 同一nio下编号 不同类别间编号唯一 // 校验认证类别参数项编号 同一nio下编号 不同类别间编号唯一
List<CertCategoryParamsInfoEO> ccParamsInfoList = certCategoryParamsInfoEOList.stream() List<CertCategoryParamsInfoEO> ccParamsInfoList = certCategoryParamsInfoEOList.stream()
.collect(Collectors.collectingAndThen(Collectors .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 (ccParamsInfoList.size() < certCategoryParamsInfoEOList.size()) {
if (CutEnum.CN.getValue().equals(paramsInfoEO.getCut())) { if (CutEnum.CN.getValue().equals(paramsInfoEO.getCut())) {
throw new JeroBootException("不同类别间参数编号必须唯一!"); throw new JeroBootException("不同类别间参数编号必须唯一!");
@@ -260,7 +260,7 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
String nioNumber = paramsInfoEO.getNioNumber(); String nioNumber = paramsInfoEO.getNioNumber();
String paramsTemplateId = paramsInfoEO.getParamsTemplateId(); String paramsTemplateId = paramsInfoEO.getParamsTemplateId();
certCategoryParamsInfoEOService.deleteByNioNumberList(Arrays.asList(nioNumber), paramsTemplateId); certCategoryParamsInfoEOService.deleteByNioNumberList(Arrays.asList(nioNumber), paramsTemplateId);
// TODO 关联删除附件模板文件信息和文件 // 关联删除附件模板文件信息和文件 ---> 不能删 发布版用的同一文件
return removeById(id); return removeById(id);
} }
@@ -280,7 +280,7 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
List<String> nioNumberList = paramsInfoEOList.stream().map(ParamsInfoEO::getNioNumber).collect(Collectors.toList()); List<String> nioNumberList = paramsInfoEOList.stream().map(ParamsInfoEO::getNioNumber).collect(Collectors.toList());
// 关联删除认证类别参数项 // 关联删除认证类别参数项
certCategoryParamsInfoEOService.deleteByNioNumberList(nioNumberList, paramsTemplateId); certCategoryParamsInfoEOService.deleteByNioNumberList(nioNumberList, paramsTemplateId);
// TODO 关联删除附件模板文件信息和文件 // 关联删除附件模板文件信息和文件 ---> 不能删 发布版用的同一文件
} }
return removeByIds(ids); return removeByIds(ids);
@@ -1098,11 +1098,11 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
List<String> nioNumberImport = new ArrayList<>(); // 记录导入的nio编号 List<String> nioNumberImport = new ArrayList<>(); // 记录导入的nio编号
int i = 1; //记录行号 int i = 1; //记录行号
int num = 0; //记录是第几条数据
//循环验证数据 //循环验证数据
for (ParamsInfoCnImport dto : paramsInfoEOList) { for (ParamsInfoCnImport dto : paramsInfoEOList) {
//判断此行数据是否全部为空,是则不读取 //判断此行数据是否全部为空,是则不读取
if (checkObjAllFieldsIsNull(dto)) { if (checkObjAllFieldsIsNull(dto)) {
i++;
continue; continue;
} }
@@ -1318,10 +1318,14 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
for (Map.Entry<String, List<CertCategoryParamsInfoCnImport>> ccDtoMap : certCategoryParamsInfoEOListMap.entrySet()) { for (Map.Entry<String, List<CertCategoryParamsInfoCnImport>> ccDtoMap : certCategoryParamsInfoEOListMap.entrySet()) {
String certCategory = ccDtoMap.getKey(); String certCategory = ccDtoMap.getKey();
List<CertCategoryParamsInfoCnImport> ccDtoList = ccDtoMap.getValue(); List<CertCategoryParamsInfoCnImport> ccDtoList = ccDtoMap.getValue();
List<String> ccNioNumberImport = new ArrayList<>(); // 记录导入的nio编号
int j = 1; int j = 1;
for (CertCategoryParamsInfoCnImport ccDto : ccDtoList) { for (CertCategoryParamsInfoCnImport ccDto : ccDtoList) {
//判断此行数据是否全部为空,是则不读取 //判断此行数据是否全部为空,是则不读取
if (checkObjAllFieldsIsNull(ccDto)) { if (checkObjAllFieldsIsNull(ccDto)) {
j++;
continue; continue;
} }
@@ -1351,6 +1355,20 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
} }
countError++; countError++;
} }
if (CollectionUtil.isNotEmpty(ccNioNumberImport)) {
if (ccNioNumberImport.contains(ccDto.getNioNumber())) {
if (CutEnum.CN.getValue().equals(cut)) {
errorMsg += "NIO编号重复!";
} else {
errorMsg += "NIO number already exists!";
}
countError++;
} else {
ccNioNumberImport.add(ccDto.getNioNumber());
}
} else {
ccNioNumberImport.add(ccDto.getNioNumber());
}
} }
// 编号 // 编号
String paramsNumber = ccDto.getParamsNumber(); String paramsNumber = ccDto.getParamsNumber();
@@ -1384,21 +1402,42 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
stringMessage.add(errorMsg); stringMessage.add(errorMsg);
} }
} }
// 校验同 nio下认证类别唯一
List<CertCategoryParamsInfoCnImport> 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); certCategoryParamsInfoEOList.addAll(ccDtoList);
} }
// 校验同 nio下认证参数编号唯一 // 校验同 nio下认证参数编号唯一
List<CertCategoryParamsInfoCnImport> ccDtoAfterDistinct = certCategoryParamsInfoEOList.stream() List<CertCategoryParamsInfoCnImport> ccDtoAfterDistinctTwo = certCategoryParamsInfoEOList.stream()
.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> .collect(Collectors.collectingAndThen(Collectors.toCollection(() ->
new TreeSet<>(Comparator.comparing(o -> o.getNioNumber() + ";" + o.getCertCategory()))), ArrayList::new)); new TreeSet<>(Comparator.comparing(o -> o.getNioNumber() + ";" + o.getParamsNumber()))), ArrayList::new));
if (ccDtoAfterDistinct.size() < certCategoryParamsInfoEOList.size()) { if (ccDtoAfterDistinctTwo.size() < certCategoryParamsInfoEOList.size()) {
if(CutEnum.CN.getValue().equals(cut)) { // 取差集
stringMessage.add("导入数据中存在重复认证编号;"); String reduceTwo = certCategoryParamsInfoEOList.stream()
} else { .filter(e->!ccDtoAfterDistinctTwo.contains(e)).map(CertCategoryParamsInfoCnImport::getNioNumber).collect(Collectors.joining(","));
stringMessage.add("Repeat number exist in the Import Data;"); 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(); Map map = new HashMap();
if (stringMessage.isEmpty()) { if (stringMessage.isEmpty()) {
map.put("result", true); map.put("result", true);