update 格式化代码 统一间隔符

update 格式化代码 统一间隔符
This commit is contained in:
疯狂的狮子li
2022-01-13 09:49:26 +08:00
parent 857dec38d1
commit a0bed51d96
71 changed files with 4279 additions and 4245 deletions

View File

@@ -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);
}
}