From 3ec7893edac48c072ebcdcfbfba12bb3abb939cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E5=B5=A9?= Date: Tue, 28 Mar 2023 00:13:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=8F=91OTA=E5=A4=87=E6=A1=88?= =?UTF-8?q?=E5=B7=A5=E5=85=B7-=E5=AF=BC=E5=85=A5=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/OtaBaCxJsfzbacsServiceImpl.java | 38 +++++++-------- .../impl/OtaBaCxKsjxtmccsServiceImpl.java | 2 + .../modules/ota/utils/ImportFileUtil.java | 47 ++++++++++++------- 3 files changed, 51 insertions(+), 36 deletions(-) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaCxJsfzbacsServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaCxJsfzbacsServiceImpl.java index fc68cc6da..3ff4f6d07 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaCxJsfzbacsServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaCxJsfzbacsServiceImpl.java @@ -326,7 +326,7 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl uploadFiles1(File attFile, String[] strs, IOSSFileService ossFileService) throws Exception { List res = new ArrayList<>(); for (int i = 0; i < strs.length; i++) { - File file = ImportFileUtil.findFile(attFile, strs[i]); - if (null == file) { - throw new JeroBootException("找不到文件:" + strs[i]); - } - OSSFile ossFile = ossFileService.uploadLocalOfCos(ImportFileUtil.createMfileByFile(file), "", null, null); - if (ObjectUtils.isNotEmpty(ossFile)) { - res.add(ossFile); + if (StringUtils.isNotEmpty(strs[i])) { + File file = ImportFileUtil.findFile(attFile, strs[i]); + if (null == file) { + throw new JeroBootException("找不到文件:" + strs[i]); + } + OSSFile ossFile = ossFileService.uploadLocalOfCos(ImportFileUtil.createMfileByFile(file), "", null, null); + if (ObjectUtils.isNotEmpty(ossFile)) { + res.add(ossFile); + } } } return res; @@ -224,16 +235,18 @@ public class ImportFileUtil { public static String uploadFiles(File attFile, String[] strs, IOSSFileService ossFileService) throws Exception { String res = ""; for (int i = 0; i < strs.length; i++) { - File file = ImportFileUtil.findFile(attFile, strs[i]); - if (null == file) { - throw new JeroBootException("找不到文件:" + strs[i]); - } - OSSFile ossFile = ossFileService.uploadLocalOfCos(ImportFileUtil.createMfileByFile(file), "", null, null); - if (ObjectUtils.isNotEmpty(ossFile)) { - if (i >= strs.length - 1) { - res += ossFile.getId(); - } else { - res += ossFile.getId() + ","; + if (StringUtils.isNotEmpty(strs[i])) { + File file = ImportFileUtil.findFile(attFile, strs[i]); + if (null == file) { + throw new JeroBootException("找不到文件:" + strs[i]); + } + OSSFile ossFile = ossFileService.uploadLocalOfCos(ImportFileUtil.createMfileByFile(file), "", null, null); + if (ObjectUtils.isNotEmpty(ossFile)) { + if (i >= strs.length - 1) { + res += ossFile.getId(); + } else { + res += ossFile.getId() + ","; + } } } }