From 1f2e2a86fd4d07a102268564b550f1286d4772f7 Mon Sep 17 00:00:00 2001 From: wangchengjun Date: Thu, 26 May 2022 21:08:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=86=E5=88=86=E6=96=87=E4=BB=B6=E4=B8=AD?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=88=B0=E5=A4=9A=E4=B8=AA=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../split/service/impl/FileSpiltService.java | 78 +++++++++++++++---- 1 file changed, 64 insertions(+), 14 deletions(-) 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..4589cf08d 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("当前文件未找到,请重新选择!"); @@ -592,12 +600,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 +771,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 +946,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 +1121,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 +1293,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 +1470,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("当前文件未找到,请重新选择!");