2021-07-18 18:20:21 +08:00
|
|
|
package com.ruoyi.oss.enumd;
|
|
|
|
|
2021-08-13 21:09:24 +08:00
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
|
import com.ruoyi.oss.service.impl.AliyunCloudStorageStrategy;
|
|
|
|
import com.ruoyi.oss.service.impl.MinioCloudStorageStrategy;
|
|
|
|
import com.ruoyi.oss.service.impl.QcloudCloudStorageStrategy;
|
|
|
|
import com.ruoyi.oss.service.impl.QiniuCloudStorageStrategy;
|
2021-07-18 18:20:21 +08:00
|
|
|
import lombok.AllArgsConstructor;
|
|
|
|
import lombok.Getter;
|
|
|
|
|
|
|
|
/**
|
2021-09-10 10:51:40 +08:00
|
|
|
* 对象存储服务商枚举
|
2021-07-18 18:20:21 +08:00
|
|
|
*
|
2021-07-23 10:48:28 +08:00
|
|
|
* @author Lion Li
|
2021-07-18 18:20:21 +08:00
|
|
|
*/
|
|
|
|
@Getter
|
|
|
|
@AllArgsConstructor
|
|
|
|
public enum CloudServiceEnumd {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 七牛云
|
|
|
|
*/
|
2021-08-13 21:09:24 +08:00
|
|
|
QINIU("qiniu", QiniuCloudStorageStrategy.class),
|
2021-07-18 18:20:21 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 阿里云
|
|
|
|
*/
|
2021-08-13 21:09:24 +08:00
|
|
|
ALIYUN("aliyun", AliyunCloudStorageStrategy.class),
|
2021-07-18 18:20:21 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 腾讯云
|
|
|
|
*/
|
2021-08-13 21:09:24 +08:00
|
|
|
QCLOUD("qcloud", QcloudCloudStorageStrategy.class),
|
2021-07-18 18:20:21 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* minio
|
|
|
|
*/
|
2021-08-13 21:09:24 +08:00
|
|
|
MINIO("minio", MinioCloudStorageStrategy.class);
|
2021-07-18 18:20:21 +08:00
|
|
|
|
|
|
|
private final String value;
|
2021-07-18 19:29:33 +08:00
|
|
|
|
|
|
|
private final Class<?> serviceClass;
|
|
|
|
|
|
|
|
public static Class<?> getServiceClass(String value) {
|
|
|
|
for (CloudServiceEnumd clazz : values()) {
|
|
|
|
if (clazz.getValue().equals(value)) {
|
|
|
|
return clazz.getServiceClass();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
2021-08-13 21:09:24 +08:00
|
|
|
|
|
|
|
public static String getServiceName(String value) {
|
|
|
|
for (CloudServiceEnumd clazz : values()) {
|
|
|
|
if (clazz.getValue().equals(value)) {
|
|
|
|
return StringUtils.uncapitalize(clazz.getServiceClass().getSimpleName());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-07-18 18:20:21 +08:00
|
|
|
}
|