From 55ce0e34c9183aebe802b91dba88cd54c6eaa48b Mon Sep 17 00:00:00 2001 From: 司猫子 <songshuang@qq.com> Date: 星期日, 04 二月 2024 09:52:19 +0800 Subject: [PATCH] !480 优化单元格合并后多余内容的清除 * excel插件 优化合并策略 在合适的生命周期完成合并 去除被合并单元格的非首行内容 --- ruoyi-common/ruoyi-common-oss/src/main/java/org/dromara/common/oss/factory/OssFactory.java | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ruoyi-common/ruoyi-common-oss/src/main/java/org/dromara/common/oss/factory/OssFactory.java b/ruoyi-common/ruoyi-common-oss/src/main/java/org/dromara/common/oss/factory/OssFactory.java index cbda62a..d70270a 100644 --- a/ruoyi-common/ruoyi-common-oss/src/main/java/org/dromara/common/oss/factory/OssFactory.java +++ b/ruoyi-common/ruoyi-common-oss/src/main/java/org/dromara/common/oss/factory/OssFactory.java @@ -24,6 +24,7 @@ public class OssFactory { private static final Map<String, OssClient> CLIENT_CACHE = new ConcurrentHashMap<>(); + private static final ReentrantLock LOCK = new ReentrantLock(); /** * 鑾峰彇榛樿瀹炰緥 @@ -51,14 +52,16 @@ OssClient client = CLIENT_CACHE.get(key); // 瀹㈡埛绔笉瀛樺湪鎴栭厤缃笉鐩稿悓鍒欓噸鏂版瀯寤� if (client == null || !client.checkPropertiesSame(properties)) { - ReentrantLock lock = new ReentrantLock(); - lock.lock(); + LOCK.lock(); try { - CLIENT_CACHE.put(key, new OssClient(configKey, properties)); - log.info("鍒涘缓OSS瀹炰緥 key => {}", configKey); - return CLIENT_CACHE.get(key); + client = CLIENT_CACHE.get(key); + if (client == null || !client.checkPropertiesSame(properties)) { + CLIENT_CACHE.put(key, new OssClient(configKey, properties)); + log.info("鍒涘缓OSS瀹炰緥 key => {}", configKey); + return CLIENT_CACHE.get(key); + } } finally { - lock.unlock(); + LOCK.unlock(); } } return client; -- Gitblit v1.9.3