From 6059f907eabf430b2732d2bcad1b3f7a549fbbcd Mon Sep 17 00:00:00 2001 From: liyawei Date: Tue, 10 May 2022 15:51:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E6=96=87=E4=BB=B6=E5=90=8D?= =?UTF-8?q?=E8=AF=BB=E5=8F=96=E6=96=87=E4=BB=B6=E5=B7=A5=E5=85=B7-?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=90=8D=E6=A0=BC=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ParamsInfoEOServiceImpl.java | 134 ++++++++++++------ .../cert/template/vo/ParamsInfoEnExport.java | 2 +- .../cert/template/vo/ParamsInfoEnImport.java | 2 +- .../ocr/controller/OcrRecordEOController.java | 4 + .../jero/modules/split/common/FileUnZip.java | 41 +++--- .../impl/FileSplitItemsEOServiceImpl.java | 6 +- .../impl/SarFileSplitItemsEOServiceImpl.java | 6 +- 7 files changed, 128 insertions(+), 67 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 6bab4ecc5..6d68530a3 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 @@ -181,6 +181,21 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl result = ExcelImportUtil.importExcelMore(excelfile, CertCategoryParamsInfoCnImport.class, params); List list = result.getList(); if (CollectionUtil.isNotEmpty(list)) { - list.forEach(certCategoryParamsInfoEO -> { + for (CertCategoryParamsInfoCnImport certCategoryParamsInfoEO : list){ + //判断此行数据是否全部为空,是则不读取 + if (checkObjAllFieldsIsNull(certCategoryParamsInfoEO)) { + continue; + } certCategoryParamsInfoEO.setCertCategory(certCategoryMap.get(sheetName)); certCategoryParamsInfoEO.setParamsTemplateId(paramsTemplateId); - }); + } certCategoryParamsInfoEOListMap.put(sheetName, list); } } @@ -840,7 +859,7 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl oldParamsInfoEOList = paramsInfoEOMapper.selectListWithCert(paramsInfoVO); @@ -855,8 +874,12 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl delParamsInfoEOIdList = delParamsInfoEOList.stream().map(ParamsInfoEO::getId).collect(Collectors.toList()); List delCertCategoryParamsInfoEOIdList = delCertCategoryParamsInfoEOList.stream().map(CertCategoryParamsInfoEO::getId).collect(Collectors.toList()); - deleteByIds(delParamsInfoEOIdList); - certCategoryParamsInfoEOService.deleteByIds(delCertCategoryParamsInfoEOIdList); + if (CollectionUtil.isNotEmpty(delParamsInfoEOIdList)) { + deleteByIds(delParamsInfoEOIdList); + } + if (CollectionUtil.isNotEmpty(delCertCategoryParamsInfoEOIdList)) { + certCategoryParamsInfoEOService.deleteByIds(delCertCategoryParamsInfoEOIdList); + } // 批量新增认证参数项 certCategoryParamsInfoEOService.saveBatch(certCategoryParamsInfoEOS); @@ -938,7 +961,7 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl resultMap = new HashMap<>(); // nio编号 String nioNumber = dto.getNioNumber(); - resultMap = validateMustAndLength(nioNumber, "nio编号", IsMustEnum.YES.getValue(),"15", false, cut); + resultMap = validateMustAndLength(nioNumber, "nio编号", "nio number", IsMustEnum.YES.getValue(),"15", false, cut); errorMsg += (String)resultMap.get("errorMsg"); countError += (int)resultMap.get("countError"); if (StringUtils.isNotEmpty(dto.getNioNumber())) { @@ -952,10 +975,10 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl nowFileList = FileUnZip.readFileByFilename(filepath, fileName,null,null,null,null,null); + List nowFileList = FileUnZip.readFileByFilename(filepath, fileName); if (nowFileList.size() == 0) { if(CutEnum.CN.getValue().equals(cut)) { errorMsg += "附件模板压缩包中没有" + fileName + "文件; "; } else { - errorMsg += "附件模板 " + fileName + "isn't present in the cabinet;"; + errorMsg += "File template " + fileName + "isn't present in the cabinet;"; } countError++; } else { @@ -1107,7 +1155,7 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl validateMustAndLength (String value, String fieldName, String mustInput, String dbLength, Boolean isSingle, String cut) { + private Map validateMustAndLength (String value, String fieldNameCn, String fieldNameEn, String mustInput, String dbLength, Boolean isSingle, String cut) { String errorMsg = ""; int countError= 0; Map resultMap = new HashMap<>(); if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isEmpty(value)) { if(CutEnum.CN.getValue().equals(cut)) { - errorMsg += fieldName + "为必填项,不能为空;"; + errorMsg += fieldNameCn + "为必填项,不能为空;"; } else { - errorMsg += fieldName + " is mandatory and cannot be empty;"; + errorMsg += fieldNameEn + " is mandatory and cannot be empty;"; } countError++; } if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) { if(CutEnum.CN.getValue().equals(cut)) { - errorMsg += fieldName + "不能超过" + dbLength + "个字符;"; + errorMsg += fieldNameCn + "不能超过" + dbLength + "个字符;"; } else { - errorMsg += fieldName + " can not be more than" + dbLength + "char;"; + errorMsg += fieldNameEn + " can not be more than" + dbLength + "char;"; } countError++; } @@ -1193,9 +1241,9 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl getCodeByName(String value, String fieldName, String type, Map enumMap, List judgeData, List coverData,String cut) { + private Map getCodeByName(String value, String fieldNameCn, String fieldNameEn, String type, Map enumMap, List judgeData, List coverData,String cut) { String errorMsg = ""; int countError= 0; Map resultMap = new HashMap<>(); @@ -1225,9 +1273,9 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl queryPageList(@RequestBody OcrRecordEOPage ocrRecordEOPage) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + if (StringUtils.isNotEmpty(ocrRecordEOPage.getStandNumber())) { + ocrRecordEOPage.setStandNumber(ocrRecordEOPage.getStandNumber().replace("%","\\%")); + } + queryWrapper.like(StringUtils.isNotEmpty(ocrRecordEOPage.getStandName()), OcrRecordEO::getStandName, ocrRecordEOPage.getStandName()) .like(StringUtils.isNotEmpty(ocrRecordEOPage.getStandNumber()), OcrRecordEO::getStandNumber, ocrRecordEOPage.getStandNumber()) .eq(StringUtils.isNotEmpty(ocrRecordEOPage.getResultContent()), OcrRecordEO::getResultContent, ocrRecordEOPage.getResultContent()) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/split/common/FileUnZip.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/split/common/FileUnZip.java index 2b3ef0ac2..a65d1e365 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/split/common/FileUnZip.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/split/common/FileUnZip.java @@ -117,6 +117,7 @@ public class FileUnZip { /** * 根据文件名称读取固定目录下文件 + * 适用范围:filename内容 dir/file * gaoyan * @param filename */ @@ -174,22 +175,30 @@ public class FileUnZip { } return resultlist; } -// public static List readFileByFilename(String path,String filename) { -// List resultlist = new ArrayList<>(); -// if (StringUtil.isNotEmpty(path)){ -// File file = new File(path); -// if (file.isDirectory()) { -// File[] files = file.listFiles(); -// for (File fi : files) { -// // 对文件进行过滤 -// if (fi.getName().equals(filename)) { -// resultlist.add(fi); -// } -// } -// } -// } -// return resultlist; -// } + + /** + * 根据文件名称读取固定目录下文件 + * 适用范围:filename内容 dir/file; file + * @param path + * @param filename + * @return + */ + public static List readFileByFilename(String path,String filename) { + List resultlist = new ArrayList<>(); + if (StringUtil.isNotEmpty(path)){ + File file = new File(path); + if (file.isDirectory()) { + File[] files = file.listFiles(); + for (File fi : files) { + // 对文件进行过滤 + if (fi.getName().equals(filename)) { + resultlist.add(fi); + } + } + } + } + return resultlist; + } /** *@Description: 删除某个文件 diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/split/service/impl/FileSplitItemsEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/split/service/impl/FileSplitItemsEOServiceImpl.java index 31347c765..f6f8ff08a 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/split/service/impl/FileSplitItemsEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/split/service/impl/FileSplitItemsEOServiceImpl.java @@ -1217,7 +1217,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i],null,null,null,null,null); + List nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i]); if (nowfilelist != null && !nowfilelist.isEmpty()) { String url = nowfilelist.get(0).getPath(); MultipartFile multipartFile = createMfileByPath(url); @@ -1262,7 +1262,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i],null,null,null,null,null); + List nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i]); if (nowfilelist != null && !nowfilelist.isEmpty()) { String url = nowfilelist.get(0).getPath(); MultipartFile multipartFile = createMfileByPath(url); @@ -1311,7 +1311,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i],null,null,null,null,null); + List nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i]); if (nowfilelist != null && !nowfilelist.isEmpty()) { String url = nowfilelist.get(0).getPath(); MultipartFile multipartFile = createMfileByPath(url); diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/split/service/impl/SarFileSplitItemsEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/split/service/impl/SarFileSplitItemsEOServiceImpl.java index 5e566814c..04e9c8377 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/split/service/impl/SarFileSplitItemsEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/split/service/impl/SarFileSplitItemsEOServiceImpl.java @@ -993,7 +993,7 @@ public class SarFileSplitItemsEOServiceImpl extends ServiceImpl nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i],null,null,null,null,null); + List nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i]); if (nowfilelist != null && !nowfilelist.isEmpty()) { OSSFile ossFile = new OSSFile(); ossFile.setFileName(nowfilelist.get(0).getName()); @@ -1030,7 +1030,7 @@ public class SarFileSplitItemsEOServiceImpl extends ServiceImpl nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i],null,null,null,null,null); + List nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i]); if (nowfilelist != null && !nowfilelist.isEmpty()) { OSSFile ossFile = new OSSFile(); ossFile.setFileName(nowfilelist.get(0).getName()); @@ -1069,7 +1069,7 @@ public class SarFileSplitItemsEOServiceImpl extends ServiceImpl nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i],null,null,null,null,null); + List nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i]); if (nowfilelist != null && !nowfilelist.isEmpty()) { OSSFile ossFile = new OSSFile(); ossFile.setFileName(nowfilelist.get(0).getName());