| | |
| | | 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; |
| | |
| | | * |
| | | * @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( |
| | |
| | | } catch (Exception e) { |
| | | throw new OssException("阿里云存储配置错误! 请检查系统配置:[" + e.getMessage() + "]"); |
| | | } |
| | | isInit = true; |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public String getServiceType() { |
| | | return OssEnumd.ALIYUN.getValue(); |
| | | public OssEnumd getServiceType() { |
| | | return OssEnumd.ALIYUN; |
| | | } |
| | | |
| | | @Override |