diff --git a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/service/impl/SyncDataServiceImpl.java b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/service/impl/SyncDataServiceImpl.java index 16d89736f..570c34db2 100644 --- a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/service/impl/SyncDataServiceImpl.java +++ b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/service/impl/SyncDataServiceImpl.java @@ -88,7 +88,7 @@ public class SyncDataServiceImpl implements ISyncDataService{ }else{ sysDepart.setParentCode(ppo.getParent_path()); } - sysDepart.setDepartOrder(Integer.valueOf(ppo.getId())); + sysDepart.setDepartOrder(ppo.getId()); // LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); // sysDepart.setCreateBy(sysUser.getRealname()); @@ -119,7 +119,7 @@ public class SyncDataServiceImpl implements ISyncDataService{ sysDepart.setOrgCode(root.getCode()); String parentCode = root.getParent_path().substring(root.getParent_path().lastIndexOf("/")); sysDepart.setParentCode(parentCode); - sysDepart.setDepartOrder(i); + sysDepart.setDepartOrder(String.valueOf(i)); LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); sysDepart.setCreateBy(sysUser.getRealname()); diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/split/service/impl/FileSpiltService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/split/service/impl/FileSpiltService.java index 8ae44d076..149065bb2 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/split/service/impl/FileSpiltService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/split/service/impl/FileSpiltService.java @@ -112,12 +112,20 @@ public class FileSpiltService { try { //获取文件地址 String connectId = sarFileSplitInfoEO.getConnectId(); - if (StringUtils.isEmpty(connectId)) { + String fileName = sarFileSplitInfoEO.getFileName(); + if (StringUtils.isEmpty(connectId) || StringUtils.isEmpty(fileName)) { throw new JeroBootException("当前文件未找到,请重新选择!"); } LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); queryWrapper.eq(OSSFile::getConnectId, connectId); - OSSFile ossFile = iossFileService.getOne(queryWrapper); + queryWrapper.eq(OSSFile::getFileName, fileName); + queryWrapper.orderByDesc(OSSFile::getCreateTime); + List ossFileList = iossFileService.list(queryWrapper); + if (CollectionUtils.isEmpty(ossFileList)) { + throw new JeroBootException("当前文件未找到,请重新选择!"); + } + OSSFile ossFile = ossFileList.get(0); + String readFilePath = ossFile.getUrl(); if (StringUtils.isEmpty(readFilePath)) { throw new JeroBootException("当前文件未找到,请重新选择!"); @@ -425,7 +433,17 @@ public class FileSpiltService { if (StringUtils.isEmpty(readPdf)) { throw new JeroBootException("未读取到文件内容,请检查后重试!"); } - String[] pdfArrays = readPdf.split("\r\n"); + String[] pdfArrays; + + String os = System.getProperty("os.name"); + //Windows操作系统 + if (os != null && os.toLowerCase().startsWith("windows")) { + pdfArrays = readPdf.split("\r\n"); + } else if (os != null && os.toLowerCase().startsWith("linux")) {//Linux操作系统 + pdfArrays = readPdf.split("\n"); + } else { //其它操作系统 + pdfArrays = readPdf.split("\n"); + } // Pattern ptest ; // Matcher matcher; @@ -479,7 +497,6 @@ public class FileSpiltService { // ptest = Pattern.compile("^[\\d.]*$"); boolean hasGoIf = false; for (int i = 0; i < nowStart.size(); i++) { - System.out.println(nowStart.get(i)); if (paragraphString.startsWith(nowStart.get(i))) { // 判断名称,如果大于10位,取十位, // String itemName = paragraphString.substring(nowStart.get(i).length()).length()>10?paragraphString.substring(nowStart.get(i).length(),nowStart.get(i).length()+10):paragraphString.substring(nowStart.get(i).length()); @@ -532,6 +549,7 @@ public class FileSpiltService { } } catch (JeroBootException e) { + e.printStackTrace(); throw new JeroBootException(e.getMessage()); } catch (Exception e) { e.printStackTrace(); @@ -592,12 +610,19 @@ public class FileSpiltService { try { //获取文件地址 String connectId = sarFileSplitInfoEO.getConnectId(); - if (StringUtils.isEmpty(connectId)) { + String fileName = sarFileSplitInfoEO.getFileName(); + if (StringUtils.isEmpty(connectId) || StringUtils.isEmpty(fileName)) { throw new JeroBootException("当前文件未找到,请重新选择!"); } LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); queryWrapper.eq(OSSFile::getConnectId, connectId); - OSSFile ossFile = iossFileService.getOne(queryWrapper); + queryWrapper.eq(OSSFile::getFileName, fileName); + queryWrapper.orderByDesc(OSSFile::getCreateTime); + List ossFileList = iossFileService.list(queryWrapper); + if (CollectionUtils.isEmpty(ossFileList)) { + throw new JeroBootException("当前文件未找到,请重新选择!"); + } + OSSFile ossFile = ossFileList.get(0); String readFilePath = ossFile.getUrl(); if (StringUtils.isEmpty(readFilePath)) { throw new JeroBootException("当前文件未找到,请重新选择!"); @@ -756,12 +781,19 @@ public class FileSpiltService { try { //获取文件地址 String connectId = sarFileSplitInfoEO.getConnectId(); - if (StringUtils.isEmpty(connectId)) { + String fileName = sarFileSplitInfoEO.getFileName(); + if (StringUtils.isEmpty(connectId) || StringUtils.isEmpty(fileName)) { throw new JeroBootException("当前文件未找到,请重新选择!"); } LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); queryWrapper.eq(OSSFile::getConnectId, connectId); - OSSFile ossFile = iossFileService.getOne(queryWrapper); + queryWrapper.eq(OSSFile::getFileName, fileName); + queryWrapper.orderByDesc(OSSFile::getCreateTime); + List ossFileList = iossFileService.list(queryWrapper); + if (CollectionUtils.isEmpty(ossFileList)) { + throw new JeroBootException("当前文件未找到,请重新选择!"); + } + OSSFile ossFile = ossFileList.get(0); String readFilePath = ossFile.getUrl(); if (StringUtils.isEmpty(readFilePath)) { throw new JeroBootException("当前文件未找到,请重新选择!"); @@ -924,12 +956,19 @@ public class FileSpiltService { try { //获取文件地址 String connectId = sarFileSplitInfoEO.getConnectId(); - if (StringUtils.isEmpty(connectId)) { + String fileName = sarFileSplitInfoEO.getFileName(); + if (StringUtils.isEmpty(connectId) || StringUtils.isEmpty(fileName)) { throw new JeroBootException("当前文件未找到,请重新选择!"); } LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); queryWrapper.eq(OSSFile::getConnectId, connectId); - OSSFile ossFile = iossFileService.getOne(queryWrapper); + queryWrapper.eq(OSSFile::getFileName, fileName); + queryWrapper.orderByDesc(OSSFile::getCreateTime); + List ossFileList = iossFileService.list(queryWrapper); + if (CollectionUtils.isEmpty(ossFileList)) { + throw new JeroBootException("当前文件未找到,请重新选择!"); + } + OSSFile ossFile = ossFileList.get(0); String readFilePath = ossFile.getUrl(); if (StringUtils.isEmpty(readFilePath)) { throw new JeroBootException("当前文件未找到,请重新选择!"); @@ -1092,12 +1131,19 @@ public class FileSpiltService { try { //获取文件地址 String connectId = sarFileSplitInfoEO.getConnectId(); - if (StringUtils.isEmpty(connectId)) { + String fileName = sarFileSplitInfoEO.getFileName(); + if (StringUtils.isEmpty(connectId) || StringUtils.isEmpty(fileName)) { throw new JeroBootException("当前文件未找到,请重新选择!"); } LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); queryWrapper.eq(OSSFile::getConnectId, connectId); - OSSFile ossFile = iossFileService.getOne(queryWrapper); + queryWrapper.eq(OSSFile::getFileName, fileName); + queryWrapper.orderByDesc(OSSFile::getCreateTime); + List ossFileList = iossFileService.list(queryWrapper); + if (CollectionUtils.isEmpty(ossFileList)) { + throw new JeroBootException("当前文件未找到,请重新选择!"); + } + OSSFile ossFile = ossFileList.get(0); String readFilePath = ossFile.getUrl(); if (StringUtils.isEmpty(readFilePath)) { throw new JeroBootException("当前文件未找到,请重新选择!"); @@ -1257,12 +1303,19 @@ public class FileSpiltService { try { //获取文件地址 String connectId = sarFileSplitInfoEO.getConnectId(); - if (StringUtils.isEmpty(connectId)) { + String fileName = sarFileSplitInfoEO.getFileName(); + if (StringUtils.isEmpty(connectId) || StringUtils.isEmpty(fileName)) { throw new JeroBootException("当前文件未找到,请重新选择!"); } LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); queryWrapper.eq(OSSFile::getConnectId, connectId); - OSSFile ossFile = iossFileService.getOne(queryWrapper); + queryWrapper.eq(OSSFile::getFileName, fileName); + queryWrapper.orderByDesc(OSSFile::getCreateTime); + List ossFileList = iossFileService.list(queryWrapper); + if (CollectionUtils.isEmpty(ossFileList)) { + throw new JeroBootException("当前文件未找到,请重新选择!"); + } + OSSFile ossFile = ossFileList.get(0); String readFilePath = ossFile.getUrl(); if (StringUtils.isEmpty(readFilePath)) { throw new JeroBootException("当前文件未找到,请重新选择!"); @@ -1427,12 +1480,19 @@ public class FileSpiltService { try { //获取文件地址 String connectId = sarFileSplitInfoEO.getConnectId(); - if (StringUtils.isEmpty(connectId)) { + String fileName = sarFileSplitInfoEO.getFileName(); + if (StringUtils.isEmpty(connectId) || StringUtils.isEmpty(fileName)) { throw new JeroBootException("当前文件未找到,请重新选择!"); } LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); queryWrapper.eq(OSSFile::getConnectId, connectId); - OSSFile ossFile = iossFileService.getOne(queryWrapper); + queryWrapper.eq(OSSFile::getFileName, fileName); + queryWrapper.orderByDesc(OSSFile::getCreateTime); + List ossFileList = iossFileService.list(queryWrapper); + if (CollectionUtils.isEmpty(ossFileList)) { + throw new JeroBootException("当前文件未找到,请重新选择!"); + } + OSSFile ossFile = ossFileList.get(0); String readFilePath = ossFile.getUrl(); if (StringUtils.isEmpty(readFilePath)) { throw new JeroBootException("当前文件未找到,请重新选择!");