From 2d86b0f2492399395052a787bd29d231fa6b9120 Mon Sep 17 00:00:00 2001 From: Charles7c Date: Thu, 28 Aug 2025 21:54:31 +0800 Subject: [PATCH] =?UTF-8?q?refactor(system/storage):=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=AD=98=E5=82=A8=E9=85=8D=E7=BD=AE=E6=97=B6=EF=BC=8C=E4=BF=9D?= =?UTF-8?q?=E6=8C=81Secret=20Key=E4=B8=BA=E7=A9=BA=E5=B0=86=E4=B8=8D?= =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/system/model/req/StorageReq.java | 15 +++++++-------- .../admin/system/model/resp/StorageResp.java | 8 -------- .../system/service/impl/StorageServiceImpl.java | 14 +++++--------- 3 files changed, 12 insertions(+), 25 deletions(-) diff --git a/continew-system/src/main/java/top/continew/admin/system/model/req/StorageReq.java b/continew-system/src/main/java/top/continew/admin/system/model/req/StorageReq.java index 18e3635e..702db61b 100644 --- a/continew-system/src/main/java/top/continew/admin/system/model/req/StorageReq.java +++ b/continew-system/src/main/java/top/continew/admin/system/model/req/StorageReq.java @@ -47,7 +47,7 @@ public class StorageReq implements Serializable { /** * 名称 */ - @Schema(description = "名称", example = "存储1") + @Schema(description = "名称", example = "S3对象存储") @NotBlank(message = "名称不能为空") @Length(max = 100, message = "名称长度不能超过 {max} 个字符") private String name; @@ -55,7 +55,7 @@ public class StorageReq implements Serializable { /** * 编码 */ - @Schema(description = "编码", example = "local") + @Schema(description = "编码", example = "s3_aliyun") @NotBlank(message = "编码不能为空") @Pattern(regexp = RegexConstants.GENERAL_CODE, message = "编码长度为 2-30 个字符,支持大小写字母、数字、下划线,以字母开头") private String code; @@ -70,7 +70,7 @@ public class StorageReq implements Serializable { /** * Access Key */ - @Schema(description = "Access Key", example = "") + @Schema(description = "Access Key", example = "LBAI4Fp4dXYcZamU5EXTBdTa") @Length(max = 255, message = "Access Key长度不能超过 {max} 个字符") @NotBlank(message = "Access Key不能为空", groups = ValidationGroup.Storage.OSS.class) private String accessKey; @@ -78,14 +78,13 @@ public class StorageReq implements Serializable { /** * Secret Key */ - @Schema(description = "Secret Key", example = "") - @NotBlank(message = "Secret Key不能为空", groups = ValidationGroup.Storage.OSS.class) + @Schema(description = "Secret Key", example = "RSA 公钥加密的 Secret Key") private String secretKey; /** * Endpoint */ - @Schema(description = "Endpoint", example = "") + @Schema(description = "Endpoint", example = "http://oss-cn-shanghai.aliyuncs.com") @Length(max = 255, message = "Endpoint长度不能超过 {max} 个字符") @NotBlank(message = "Endpoint不能为空", groups = ValidationGroup.Storage.OSS.class) @Pattern(regexp = RegexConstants.URL_HTTP, message = "Endpoint格式不正确", groups = ValidationGroup.Storage.OSS.class) @@ -94,7 +93,7 @@ public class StorageReq implements Serializable { /** * Bucket/存储路径 */ - @Schema(description = "Bucket/存储路径", example = "C:/continew-admin/data/file/") + @Schema(description = "Bucket/存储路径", example = "continew-admin") @Length(max = 255, message = "Bucket长度不能超过 {max} 个字符", groups = ValidationGroup.Storage.OSS.class) @Length(max = 255, message = "存储路径长度不能超过 {max} 个字符", groups = ValidationGroup.Storage.Local.class) @NotBlank(message = "Bucket不能为空", groups = ValidationGroup.Storage.OSS.class) @@ -104,7 +103,7 @@ public class StorageReq implements Serializable { /** * 域名/访问路径 */ - @Schema(description = "域名/访问路径", example = "http://localhost:8000/file") + @Schema(description = "域名/访问路径", example = "https://continew-admin.file.continew.top/") @Length(max = 255, message = "域名长度不能超过 {max} 个字符", groups = ValidationGroup.Storage.OSS.class) @Length(max = 255, message = "访问路径长度不能超过 {max} 个字符", groups = ValidationGroup.Storage.Local.class) @NotBlank(message = "访问路径不能为空", groups = ValidationGroup.Storage.Local.class) diff --git a/continew-system/src/main/java/top/continew/admin/system/model/resp/StorageResp.java b/continew-system/src/main/java/top/continew/admin/system/model/resp/StorageResp.java index d728de06..6bce6139 100644 --- a/continew-system/src/main/java/top/continew/admin/system/model/resp/StorageResp.java +++ b/continew-system/src/main/java/top/continew/admin/system/model/resp/StorageResp.java @@ -21,7 +21,6 @@ import lombok.Data; import top.continew.admin.common.base.model.resp.BaseDetailResp; import top.continew.admin.common.enums.DisEnableStatusEnum; import top.continew.admin.system.enums.StorageTypeEnum; -import top.continew.starter.security.mask.annotation.JsonMask; import java.io.Serial; @@ -68,13 +67,6 @@ public class StorageResp extends BaseDetailResp { @Schema(description = "Access Key", example = "") private String accessKey; - /** - * Secret Key - */ - @Schema(description = "Secret Key", example = "") - @JsonMask(left = 4, right = 3) - private String secretKey; - /** * Endpoint */ diff --git a/continew-system/src/main/java/top/continew/admin/system/service/impl/StorageServiceImpl.java b/continew-system/src/main/java/top/continew/admin/system/service/impl/StorageServiceImpl.java index a0ad7058..ca6b95ed 100644 --- a/continew-system/src/main/java/top/continew/admin/system/service/impl/StorageServiceImpl.java +++ b/continew-system/src/main/java/top/continew/admin/system/service/impl/StorageServiceImpl.java @@ -28,9 +28,9 @@ import org.dromara.x.file.storage.core.FileStorageServiceBuilder; import org.dromara.x.file.storage.core.platform.FileStorage; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import top.continew.admin.common.model.req.CommonStatusUpdateReq; import top.continew.admin.common.base.service.BaseServiceImpl; import top.continew.admin.common.enums.DisEnableStatusEnum; +import top.continew.admin.common.model.req.CommonStatusUpdateReq; import top.continew.admin.common.util.SecureUtils; import top.continew.admin.system.enums.StorageTypeEnum; import top.continew.admin.system.mapper.StorageMapper; @@ -40,7 +40,6 @@ import top.continew.admin.system.model.req.StorageReq; import top.continew.admin.system.model.resp.StorageResp; import top.continew.admin.system.service.FileService; import top.continew.admin.system.service.StorageService; -import top.continew.starter.core.constant.StringConstants; import top.continew.starter.core.util.ExceptionUtils; import top.continew.starter.core.util.SpringWebUtils; import top.continew.starter.core.util.validation.CheckUtils; @@ -68,6 +67,7 @@ public class StorageServiceImpl extends BaseServiceImpl SecureUtils.decryptByRsaPrivateKey(encryptSecretKey));