From 868942e202aeb967b8ce47b38cc2433a636a128d Mon Sep 17 00:00:00 2001 From: phanes <5411232+phanes@user.noreply.gitee.com> Date: 星期日, 16 一月 2022 17:46:24 +0800 Subject: [PATCH] update 格式化代码结构 统一编码格式 --- ruoyi-oss/src/main/java/com/ruoyi/oss/factory/OssFactory.java | 70 +++++++++++++++++----------------- 1 files changed, 35 insertions(+), 35 deletions(-) diff --git a/ruoyi-oss/src/main/java/com/ruoyi/oss/factory/OssFactory.java b/ruoyi-oss/src/main/java/com/ruoyi/oss/factory/OssFactory.java index 1691596..0107955 100644 --- a/ruoyi-oss/src/main/java/com/ruoyi/oss/factory/OssFactory.java +++ b/ruoyi-oss/src/main/java/com/ruoyi/oss/factory/OssFactory.java @@ -1,8 +1,8 @@ package com.ruoyi.oss.factory; import com.ruoyi.common.utils.JsonUtils; -import com.ruoyi.common.utils.RedisUtils; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.redis.RedisUtils; import com.ruoyi.common.utils.reflect.ReflectUtils; import com.ruoyi.oss.constant.OssConstant; import com.ruoyi.oss.enumd.OssEnumd; @@ -23,10 +23,10 @@ @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 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); + } } -- Gitblit v1.9.3