From 3c2c87364b89de46d12e95abd5bdf8cbd2c6dbf6 Mon Sep 17 00:00:00 2001
From: baoshiwei <baoshiwei@shlanbao.cn>
Date: 星期三, 12 三月 2025 08:43:23 +0800
Subject: [PATCH] dev-init

---
 ruoyi-common/ruoyi-common-oss/src/main/java/org/dromara/common/oss/factory/OssFactory.java |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 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 f0760f7..3da1ba5 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,8 +24,7 @@
 public class OssFactory {
 
     private static final Map<String, OssClient> CLIENT_CACHE = new ConcurrentHashMap<>();
-
-    private static final ReentrantLock lock = new ReentrantLock();
+    private static final ReentrantLock LOCK = new ReentrantLock();
 
     /**
      * 鑾峰彇榛樿瀹炰緥
@@ -49,11 +48,14 @@
         }
         OssProperties properties = JsonUtils.parseObject(json, OssProperties.class);
         // 浣跨敤绉熸埛鏍囪瘑閬垮厤澶氫釜绉熸埛鐩稿悓key瀹炰緥瑕嗙洊
-        String key = properties.getTenantId() + ":" + configKey;
+        String key = configKey;
+        if (StringUtils.isNotBlank(properties.getTenantId())) {
+            key = properties.getTenantId() + ":" + configKey;
+        }
         OssClient client = CLIENT_CACHE.get(key);
         // 瀹㈡埛绔笉瀛樺湪鎴栭厤缃笉鐩稿悓鍒欓噸鏂版瀯寤�
         if (client == null || !client.checkPropertiesSame(properties)) {
-            lock.lock();
+            LOCK.lock();
             try {
                 client = CLIENT_CACHE.get(key);
                 if (client == null || !client.checkPropertiesSame(properties)) {
@@ -62,7 +64,7 @@
                     return CLIENT_CACHE.get(key);
                 }
             } finally {
-                lock.unlock();
+                LOCK.unlock();
             }
         }
         return client;

--
Gitblit v1.9.3