From cd510b43b1ef85202ddf9018271aaadf695f3c8d Mon Sep 17 00:00:00 2001 From: hewenqiang <1527468660@qq.com> Date: 星期二, 25 一月 2022 17:17:06 +0800 Subject: [PATCH] fix 优化登录、注册校验方式,在接口通过@Validated进行数据基础校验,以及服务执行到异常后,抛出异常结束方法执行(减少if-else嵌套)。 --- ruoyi-oss/src/main/java/com/ruoyi/oss/service/impl/MinioOssStrategy.java | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ruoyi-oss/src/main/java/com/ruoyi/oss/service/impl/MinioOssStrategy.java b/ruoyi-oss/src/main/java/com/ruoyi/oss/service/impl/MinioOssStrategy.java index 60ac032..e2cd578 100644 --- a/ruoyi-oss/src/main/java/com/ruoyi/oss/service/impl/MinioOssStrategy.java +++ b/ruoyi-oss/src/main/java/com/ruoyi/oss/service/impl/MinioOssStrategy.java @@ -9,6 +9,7 @@ import com.ruoyi.oss.service.abstractd.AbstractOssStrategy; import io.minio.*; import org.springframework.http.MediaType; +import org.springframework.stereotype.Component; import java.io.ByteArrayInputStream; import java.io.InputStream; @@ -18,13 +19,14 @@ * * @author Lion Li */ +@Component public class MinioOssStrategy extends AbstractOssStrategy { private MinioClient minioClient; @Override - public void init(OssProperties cloudStorageProperties) { - properties = cloudStorageProperties; + public void init(OssProperties ossProperties) { + super.init(ossProperties); try { minioClient = MinioClient.builder() .endpoint(properties.getEndpoint()) @@ -34,6 +36,7 @@ } catch (Exception e) { throw new OssException("Minio瀛樺偍閰嶇疆閿欒! 璇锋鏌ョ郴缁熼厤缃�:[" + e.getMessage() + "]"); } + isInit = true; } @Override @@ -56,8 +59,8 @@ } @Override - public String getServiceType() { - return OssEnumd.MINIO.getValue(); + public OssEnumd getServiceType() { + return OssEnumd.MINIO; } @Override -- Gitblit v1.9.3