From 7e9ccac5722b2c1976b572587b162fa39119b38c Mon Sep 17 00:00:00 2001 From: xuyuxiang Date: Thu, 10 Nov 2022 10:25:48 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=9B=B4=E6=96=B0=E3=80=91=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E9=98=BF=E9=87=8C=E4=BA=91=E4=B8=8A=E4=BC=A0=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=9C=B0=E5=9D=80=E8=BF=94=E5=9B=9E=E9=94=99=E8=AF=AF?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8D=E6=96=87=E4=BB=B6key=E6=9E=84?= =?UTF-8?q?=E9=80=A0=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dev/modular/file/service/impl/DevFileServiceImpl.java | 6 +++--- .../xiaonuo/dev/modular/file/util/DevFileAliyunUtil.java | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/file/service/impl/DevFileServiceImpl.java b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/file/service/impl/DevFileServiceImpl.java index d370ff53..0f19393e 100644 --- a/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/file/service/impl/DevFileServiceImpl.java +++ b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/file/service/impl/DevFileServiceImpl.java @@ -241,9 +241,9 @@ public class DevFileServiceImpl extends ServiceImpl impl String fileObjectName = fileId + StrUtil.DOT + fileSuffix; // 获取日期文件夹,格式如,2021/10/11/ - String dateFolderPath = DateUtil.thisYear() + FileUtil.FILE_SEPARATOR + - (DateUtil.thisMonth() + 1) + FileUtil.FILE_SEPARATOR + - DateUtil.thisDayOfMonth() + FileUtil.FILE_SEPARATOR; + String dateFolderPath = DateUtil.thisYear() + StrUtil.SLASH + + (DateUtil.thisMonth() + 1) + StrUtil.SLASH + + DateUtil.thisDayOfMonth() + StrUtil.SLASH; // 返回 return dateFolderPath + fileObjectName; diff --git a/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/file/util/DevFileAliyunUtil.java b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/file/util/DevFileAliyunUtil.java index 4e4c71f8..385a3f87 100644 --- a/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/file/util/DevFileAliyunUtil.java +++ b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/file/util/DevFileAliyunUtil.java @@ -33,6 +33,7 @@ import javax.activation.MimetypesFileTypeMap; import java.io.*; import java.net.URL; import java.util.Date; +import java.util.List; /** * 阿里云文件工具类 @@ -429,7 +430,8 @@ public class DevFileAliyunUtil { try { initClient(); OSSClient ossClient = (OSSClient) client; - return bucketName + StrUtil.DOT + ossClient.getEndpoint().toString() + StrUtil.SLASH + key; + List urlList = StrUtil.split(ossClient.getEndpoint().toString(), StrUtil.COLON + StrUtil.SLASH + StrUtil.SLASH); + return urlList.get(0) + StrUtil.COLON + StrUtil.SLASH + StrUtil.SLASH + bucketName + StrUtil.DOT + urlList.get(1) + StrUtil.SLASH + key; } catch (OSSException | ClientException e) { throw new CommonException(e.getMessage()); }