From da1effd003554a1306c1aba448d59a1f68f61163 Mon Sep 17 00:00:00 2001 From: liyawei Date: Thu, 3 Nov 2022 10:14:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A4=E8=B4=A6-=E5=8F=82=E6=95=B0=E9=A1=B9?= =?UTF-8?q?=E6=94=B6=E9=9B=86-=E5=A1=AB=E5=86=99=E4=BA=BA=E5=AF=BC?= =?UTF-8?q?=E5=85=A5-bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ParamsCollectManifestEOServiceImpl.java | 117 +++++++++++++----- 1 file changed, 85 insertions(+), 32 deletions(-) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsCollectManifestEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsCollectManifestEOServiceImpl.java index 782b75725..5e8efa641 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsCollectManifestEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsCollectManifestEOServiceImpl.java @@ -1887,13 +1887,20 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl").append(nioNumber).append("").append("工程接口人没有填写,请填写完工程接口人再进行下发收集。"); } - } else { + } else if ("2".equals(type)) { if (CutEnum.EN.getValue().equals(cut)) { stringBuilder.append("NIO number is ").append(nioNumber).append(",state is ").append("").append(stateName).append("").append(",no operation permission for this button."); } else { stringBuilder.append("NIO编号为").append(nioNumber).append(",状态为").append("").append(stateName).append("").append(",没有此按钮的操作权限。"); } + } else if ("3".equals(type)) { + if (CutEnum.EN.getValue().equals(cut)) { + stringBuilder.append("NIO number is ").append(nioNumber).append(",state is ").append("").append(stateName).append("").append(", fail to import."); + } else { + stringBuilder.append("NIO编号为").append(nioNumber).append(",状态为").append("").append(stateName).append("").append(",导入失败。"); + } + } msgList.add(stringBuilder.toString()); @@ -2687,24 +2694,24 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl> datas = result; if(datas!=null &&!datas.isEmpty()){ try { - int i = 0 ; - List> datasUpdate = new ArrayList<>(); +// int i = 0 ; +// List> datasUpdate = new ArrayList<>(); //处理空行数据,当读取exceL出现空行过多时,空行数为20以上时中断读取,将数据清洗为新的list - for(Map importDto :datas){ - if(i>20){ - break; - } - //判断此行数据是否全部为空 - if(checkObjAllFieldsIsNull(importDto)){ - i++; - //是则不读取 - continue; - } - i = 0; - datasUpdate.add(importDto); - } +// for(Map importDto :datas){ +// if(i>20){ +// break; +// } +// //判断此行数据是否全部为空 +// if(checkObjAllFieldsIsNull(importDto)){ +// i++; +// //是则不读取 +// continue; +// } +// i = 0; +// datasUpdate.add(importDto); +// } String unzipfilepath = zipEntryName; - Result message = importData(datasUpdate,unzipfilepath,cut,paramsManifestId); + Result message = importData(datas,unzipfilepath,cut,paramsManifestId); //删除原上传文件 FileUnZip.deleteDir(saveDirectory); return message; @@ -2771,6 +2778,7 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl configDataList = (List) map.get("configDataList"); + List> notImportNioNumberList = (List>) map.get("notImportNioNumberList"); for (ParamsConfigDataEO importDto : configDataList) { //判断此行数据是否全部为空,是则不读取 @@ -2809,13 +2817,19 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl msgList = getMsgOfIssueCollection(notImportNioNumberList, cut, "3"); + return Result.OK(null, msgList); + } else { - msg = "import " + countSuccess + " datas successfully"; + int countSuccess = configDataList.size(); + if (CutEnum.CN.getValue().equals(cut)) { + msg = "成功导入" + countSuccess + "条"; + } else { + msg = "import " + countSuccess + " datas successfully"; + } + return Result.OK(msg, null); } - return Result.OK(msg, null); } else { if (CutEnum.CN.getValue().equals(cut)) { msg = "导入失败"; @@ -3654,9 +3668,9 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl configIdList = paramsConfigEOList.stream().map(ParamsConfigEO::getId).collect(Collectors.toList()); List paramsConfigDataEOList = paramsConfigDataEOService.queryListByConfigIdList(configIdList); - Map controlTypeMap = ControlTypeEnum.toMapForImport(cut); - Map controlVerifyMap = ControlVerifyEnum.toMapForImport(cut); - Map paramsIsMustMap = ParamsIsMustEnum.toMapForImport(cut); - //存放数据验证结果信息 List configDataList = new ArrayList<>(); + List verifyNioNumber = new ArrayList<>(); + List> notImportNioNumberList = new ArrayList<>(); List stringMessage = new ArrayList<>(); int i = 3; //记录行号 //循环验证数据 @@ -3698,10 +3710,50 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl resultMap = new HashMap<>(); String nioNumber = (String) dto.get("nio_number"); - String controlType = controlTypeMap.get((String) dto.get("control_type")); - String controlVerify = controlVerifyMap.get((String) dto.get("control_verify")); - String controlValues = (String) dto.get("control_values"); - String isMust = paramsIsMustMap.get((String) dto.get("is_must")); + if (StringUtils.isBlank(nioNumber)) { + continue; + } + + List listPCM = paramsCollectManifestEOList.stream().filter(e-> nioNumber.equals(e.getNioNumber())).collect(Collectors.toList()); + if (CollectionUtil.isEmpty(listPCM)) { + if (CutEnum.EN.getValue().equals(cut)) { + errorMsg += "NIO Number can not find; "; + } else{ + errorMsg += "NIO编号不存在;"; + } + countError++; + stringMessage.add(errorMsg); + continue; + } + + if (!verifyNioNumber.contains(nioNumber)) { + verifyNioNumber.add(nioNumber); + } else{ + if (CutEnum.EN.getValue().equals(cut)) { + errorMsg += "NIO Number is repeat; "; + } else{ + errorMsg += "NIO编号重复;"; + } + countError ++; + stringMessage.add(errorMsg); + continue; + } + + ParamsCollectManifestEO paramsCollectManifestEO = listPCM.get(0); + String state = paramsCollectManifestEO.getState(); + if (!CollectManifestStateEnum.WAIT_FILL.getValue().equals(state) && !CollectManifestStateEnum.CERT_BACK.getValue().equals(state)) { + Map msgMap = new HashMap<>(); + msgMap.put("nioNumber", nioNumber); + msgMap.put("state", state); + msgMap.put("type", "3"); + notImportNioNumberList.add(msgMap); + continue; + } + + String controlType = paramsCollectManifestEO.getControlType(); + String controlVerify = paramsCollectManifestEO.getControlVerify(); + String controlValues = paramsCollectManifestEO.getControlValues(); + String isMust = paramsCollectManifestEO.getIsMust(); for (Map.Entry entry : dto.entrySet()) { String key = entry.getKey(); String value = (String) entry.getValue(); @@ -3935,6 +3987,7 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl