From 9a468600867a1e28847313c7509c395a7a7cd2f9 Mon Sep 17 00:00:00 2001 From: gaibu <1016771049@qq.com> Date: Fri, 30 Dec 2022 15:04:28 +0800 Subject: [PATCH 1/7] =?UTF-8?q?fix:=20=E9=87=8D=E5=A4=8D=20file=20?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=20Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/infra/dal/mysql/file/FileContentDAOImpl.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileContentDAOImpl.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileContentDAOImpl.java index c4dcfe8a0..e38acf2cf 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileContentDAOImpl.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileContentDAOImpl.java @@ -1,11 +1,13 @@ package cn.iocoder.yudao.module.infra.dal.mysql.file; +import cn.hutool.core.collection.CollUtil; import cn.iocoder.yudao.framework.file.core.client.db.DBFileContentFrameworkDAO; import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileContentDO; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.springframework.stereotype.Repository; import javax.annotation.Resource; +import java.util.List; @Repository public class FileContentDAOImpl implements DBFileContentFrameworkDAO { @@ -27,9 +29,9 @@ public class FileContentDAOImpl implements DBFileContentFrameworkDAO { @Override public byte[] selectContent(Long configId, String path) { - FileContentDO fileContentDO = fileContentMapper.selectOne( + List fileContentDOs = fileContentMapper.selectList( buildQuery(configId, path).select(FileContentDO::getContent)); - return fileContentDO != null ? fileContentDO.getContent() : null; + return CollUtil.isNotEmpty(fileContentDOs) ? CollUtil.getFirst(fileContentDOs).getContent() : null; } private LambdaQueryWrapper buildQuery(Long configId, String path) { From 639c7820f92e0368e94f63a762f9ef5fc96e44ec Mon Sep 17 00:00:00 2001 From: gaibu <1016771049@qq.com> Date: Fri, 30 Dec 2022 16:07:53 +0800 Subject: [PATCH 2/7] =?UTF-8?q?fix:=20=E9=87=8D=E5=A4=8D=20file=20?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=20Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao/module/infra/dal/mysql/file/FileContentDAOImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileContentDAOImpl.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileContentDAOImpl.java index e38acf2cf..5213edc7a 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileContentDAOImpl.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileContentDAOImpl.java @@ -30,7 +30,7 @@ public class FileContentDAOImpl implements DBFileContentFrameworkDAO { @Override public byte[] selectContent(Long configId, String path) { List fileContentDOs = fileContentMapper.selectList( - buildQuery(configId, path).select(FileContentDO::getContent)); + buildQuery(configId, path).select(FileContentDO::getContent).orderByDesc(FileContentDO::getId)); return CollUtil.isNotEmpty(fileContentDOs) ? CollUtil.getFirst(fileContentDOs).getContent() : null; } From 906a3a2c50fd5daa01a5e57893b09d06a7c10135 Mon Sep 17 00:00:00 2001 From: gaibu <1016771049@qq.com> Date: Mon, 2 Jan 2023 12:27:52 +0800 Subject: [PATCH 3/7] =?UTF-8?q?fix:=20=E9=87=8D=E5=A4=8D=20file=20?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=20Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/infra/dal/mysql/file/FileContentDAOImpl.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileContentDAOImpl.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileContentDAOImpl.java index 5213edc7a..2492c803d 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileContentDAOImpl.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileContentDAOImpl.java @@ -8,6 +8,7 @@ import org.springframework.stereotype.Repository; import javax.annotation.Resource; import java.util.List; +import java.util.Optional; @Repository public class FileContentDAOImpl implements DBFileContentFrameworkDAO { @@ -29,9 +30,11 @@ public class FileContentDAOImpl implements DBFileContentFrameworkDAO { @Override public byte[] selectContent(Long configId, String path) { - List fileContentDOs = fileContentMapper.selectList( + List list = fileContentMapper.selectList( buildQuery(configId, path).select(FileContentDO::getContent).orderByDesc(FileContentDO::getId)); - return CollUtil.isNotEmpty(fileContentDOs) ? CollUtil.getFirst(fileContentDOs).getContent() : null; + return Optional.ofNullable(CollUtil.getFirst(list)) + .map(FileContentDO::getContent) + .orElse(null); } private LambdaQueryWrapper buildQuery(Long configId, String path) { From 2fea3a8e8357f2047c941702626d1120a716e0ff Mon Sep 17 00:00:00 2001 From: gaibu <1016771049@qq.com> Date: Mon, 2 Jan 2023 22:31:15 +0800 Subject: [PATCH 4/7] =?UTF-8?q?fix:=20=E8=85=BE=E8=AE=AF=20COS=20=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=EF=BC=8CRegion=20=E5=BF=85=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao/framework/file/core/client/s3/S3FileClient.java | 8 +++++++- .../framework/file/core/client/s3/S3FileClientConfig.java | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/s3/S3FileClient.java b/yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/s3/S3FileClient.java index a2b11b1dc..f554e0b52 100644 --- a/yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/s3/S3FileClient.java +++ b/yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/s3/S3FileClient.java @@ -9,10 +9,11 @@ import io.minio.*; import java.io.ByteArrayInputStream; import static cn.iocoder.yudao.framework.file.core.client.s3.S3FileClientConfig.ENDPOINT_ALIYUN; +import static cn.iocoder.yudao.framework.file.core.client.s3.S3FileClientConfig.ENDPOINT_TENCENT; /** * 基于 S3 协议的文件客户端,实现 MinIO、阿里云、腾讯云、七牛云、华为云等云服务 - * + *

* S3 协议的客户端,采用亚马逊提供的 software.amazon.awssdk.s3 库 * * @author 芋道源码 @@ -78,6 +79,11 @@ public class S3FileClient extends AbstractFileClient { .replaceAll("-internal", "")// 去除内网 Endpoint 的后缀 .replaceAll("https://", ""); } + // 腾讯云必须有 region,否则会报错 + if (config.getEndpoint().contains(ENDPOINT_TENCENT)) { + return StrUtil.subAfter(config.getEndpoint(), ".cos.", false) + .replaceAll("." + ENDPOINT_TENCENT, ""); // 去除 Endpoint + } return null; } diff --git a/yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/s3/S3FileClientConfig.java b/yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/s3/S3FileClientConfig.java index 151159f5e..0c46e8aa6 100644 --- a/yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/s3/S3FileClientConfig.java +++ b/yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/s3/S3FileClientConfig.java @@ -19,6 +19,7 @@ public class S3FileClientConfig implements FileClientConfig { public static final String ENDPOINT_QINIU = "qiniucs.com"; public static final String ENDPOINT_ALIYUN = "aliyuncs.com"; + public static final String ENDPOINT_TENCENT = "myqcloud.com"; /** * 节点地址 From 29ac759c51227ccb836d5d6d7f3b087f8b9f7fea Mon Sep 17 00:00:00 2001 From: kinlon92 Date: Tue, 3 Jan 2023 07:36:15 +0000 Subject: [PATCH 5/7] =?UTF-8?q?=E6=98=AF=E5=90=A6=E5=8F=AF=E8=A7=81?= =?UTF-8?q?=E5=86=99=E5=8F=8D=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: kinlon92 --- .../module/infra/controller/admin/config/ConfigController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/ConfigController.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/ConfigController.java index 726a10498..493b5faa6 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/ConfigController.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/ConfigController.java @@ -75,7 +75,7 @@ public class ConfigController { if (config == null) { return null; } - if (config.getVisible()) { + if (!config.getVisible()) { throw ServiceExceptionUtil.exception(ErrorCodeConstants.CONFIG_GET_VALUE_ERROR_IF_VISIBLE); } return success(config.getValue()); From 29d2aad176feeaec091982935f7f679a54a76927 Mon Sep 17 00:00:00 2001 From: gaibu <1016771049@qq.com> Date: Wed, 4 Jan 2023 16:33:05 +0800 Subject: [PATCH 6/7] =?UTF-8?q?fix:=20=E4=B8=8A=E4=BC=A0=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-ui-admin/src/views/infra/file/index.vue | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/yudao-ui-admin/src/views/infra/file/index.vue b/yudao-ui-admin/src/views/infra/file/index.vue index be76b5c18..bd569a377 100644 --- a/yudao-ui-admin/src/views/infra/file/index.vue +++ b/yudao-ui-admin/src/views/infra/file/index.vue @@ -1,14 +1,16 @@