mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-11-14 05:03:47 +08:00
update 格式化代码 统一间隔符
update 格式化代码 统一间隔符
This commit is contained in:
@@ -23,10 +23,10 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
@Slf4j
|
||||
public class OssFactory {
|
||||
|
||||
/**
|
||||
* 服务实例缓存
|
||||
*/
|
||||
private static final Map<String, IOssStrategy> SERVICES = new ConcurrentHashMap<>();
|
||||
/**
|
||||
* 服务实例缓存
|
||||
*/
|
||||
private static final Map<String, IOssStrategy> SERVICES = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 初始化工厂
|
||||
@@ -42,40 +42,40 @@ public class OssFactory {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取默认实例
|
||||
*/
|
||||
public static IOssStrategy instance() {
|
||||
// 获取redis 默认类型
|
||||
String type = RedisUtils.getCacheObject(OssConstant.CACHE_CONFIG_KEY);
|
||||
if (StringUtils.isEmpty(type)) {
|
||||
throw new OssException("文件存储服务类型无法找到!");
|
||||
}
|
||||
return instance(type);
|
||||
}
|
||||
/**
|
||||
* 获取默认实例
|
||||
*/
|
||||
public static IOssStrategy instance() {
|
||||
// 获取redis 默认类型
|
||||
String type = RedisUtils.getCacheObject(OssConstant.CACHE_CONFIG_KEY);
|
||||
if (StringUtils.isEmpty(type)) {
|
||||
throw new OssException("文件存储服务类型无法找到!");
|
||||
}
|
||||
return instance(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据类型获取实例
|
||||
*/
|
||||
public static IOssStrategy instance(String type) {
|
||||
/**
|
||||
* 根据类型获取实例
|
||||
*/
|
||||
public static IOssStrategy instance(String type) {
|
||||
IOssStrategy service = SERVICES.get(type);
|
||||
if (service == null) {
|
||||
refreshService(type);
|
||||
service = SERVICES.get(type);
|
||||
}
|
||||
return service;
|
||||
}
|
||||
if (service == null) {
|
||||
refreshService(type);
|
||||
service = SERVICES.get(type);
|
||||
}
|
||||
return service;
|
||||
}
|
||||
|
||||
private static void refreshService(String type) {
|
||||
Object json = RedisUtils.getCacheObject(OssConstant.SYS_OSS_KEY + type);
|
||||
private static void refreshService(String type) {
|
||||
Object json = RedisUtils.getCacheObject(OssConstant.SYS_OSS_KEY + type);
|
||||
OssProperties properties = JsonUtils.parseObject(json.toString(), OssProperties.class);
|
||||
if (properties == null) {
|
||||
throw new OssException("系统异常, '" + type + "'配置信息不存在!");
|
||||
}
|
||||
// 获取redis配置信息 创建对象 并缓存
|
||||
if (properties == null) {
|
||||
throw new OssException("系统异常, '" + type + "'配置信息不存在!");
|
||||
}
|
||||
// 获取redis配置信息 创建对象 并缓存
|
||||
IOssStrategy service = (IOssStrategy) ReflectUtils.newInstance(OssEnumd.getServiceClass(type));
|
||||
((AbstractOssStrategy)service).init(properties);
|
||||
SERVICES.put(type, service);
|
||||
}
|
||||
((AbstractOssStrategy)service).init(properties);
|
||||
SERVICES.put(type, service);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user