From ae0d4dd6e574367b5b89a06be90b00f2eb1e40ba Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期一, 07 八月 2023 18:01:22 +0800
Subject: [PATCH] update 优化 岗位如果绑定了用户则不允许禁用

---
 ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/config/ThreadPoolConfig.java |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/config/ThreadPoolConfig.java b/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/config/ThreadPoolConfig.java
index cb3d8f7..3db62b2 100644
--- a/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/config/ThreadPoolConfig.java
+++ b/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/config/ThreadPoolConfig.java
@@ -1,8 +1,11 @@
 package org.dromara.common.core.config;
 
-import org.dromara.common.core.config.properties.ThreadPoolProperties;
-import org.dromara.common.core.utils.Threads;
+import jakarta.annotation.PreDestroy;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.concurrent.BasicThreadFactory;
+import org.dromara.common.core.config.properties.ThreadPoolProperties;
+import org.dromara.common.core.utils.SpringUtils;
+import org.dromara.common.core.utils.Threads;
 import org.springframework.boot.autoconfigure.AutoConfiguration;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
@@ -18,6 +21,7 @@
  *
  * @author Lion Li
  **/
+@Slf4j
 @AutoConfiguration
 @EnableConfigurationProperties(ThreadPoolProperties.class)
 public class ThreadPoolConfig {
@@ -54,4 +58,19 @@
             }
         };
     }
+
+    /**
+     * 閿�姣佷簨浠�
+     */
+    @PreDestroy
+    public void destroy() {
+        try {
+            log.info("====鍏抽棴鍚庡彴浠诲姟浠诲姟绾跨▼姹�====");
+            ScheduledExecutorService scheduledExecutorService = SpringUtils.getBean("scheduledExecutorService");
+            Threads.shutdownAndAwaitTermination(scheduledExecutorService);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+        }
+    }
+
 }

--
Gitblit v1.9.3