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/AliyunOssStrategy.java | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ruoyi-oss/src/main/java/com/ruoyi/oss/service/impl/AliyunOssStrategy.java b/ruoyi-oss/src/main/java/com/ruoyi/oss/service/impl/AliyunOssStrategy.java index 70672d4..61b98cd 100644 --- a/ruoyi-oss/src/main/java/com/ruoyi/oss/service/impl/AliyunOssStrategy.java +++ b/ruoyi-oss/src/main/java/com/ruoyi/oss/service/impl/AliyunOssStrategy.java @@ -13,6 +13,7 @@ import com.ruoyi.oss.exception.OssException; import com.ruoyi.oss.properties.OssProperties; import com.ruoyi.oss.service.abstractd.AbstractOssStrategy; +import org.springframework.stereotype.Component; import java.io.ByteArrayInputStream; import java.io.InputStream; @@ -22,13 +23,14 @@ * * @author Lion Li */ +@Component public class AliyunOssStrategy extends AbstractOssStrategy { private OSSClient client; @Override - public void init(OssProperties cloudStorageProperties) { - properties = cloudStorageProperties; + public void init(OssProperties ossProperties) { + super.init(ossProperties); try { ClientConfiguration configuration = new ClientConfiguration(); DefaultCredentialProvider credentialProvider = new DefaultCredentialProvider( @@ -38,6 +40,7 @@ } catch (Exception e) { throw new OssException("闃块噷浜戝瓨鍌ㄩ厤缃敊璇�! 璇锋鏌ョ郴缁熼厤缃�:[" + e.getMessage() + "]"); } + isInit = true; } @Override @@ -56,8 +59,8 @@ } @Override - public String getServiceType() { - return OssEnumd.ALIYUN.getValue(); + public OssEnumd getServiceType() { + return OssEnumd.ALIYUN; } @Override -- Gitblit v1.9.3