Sfoglia il codice sorgente

建科统一身份认证平台接入

S0025136190 5 mesi fa
parent
commit
204a379daf

+ 14 - 4
takai-admin/src/main/java/com/takai/init/InitDataLoader.java

@@ -6,9 +6,11 @@ import com.takai.bigmodel.service.IBigModelService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.CommandLineRunner;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 import org.springframework.stereotype.Component;
 
 import java.io.IOException;
+import java.util.concurrent.ThreadPoolExecutor;
 
 @Slf4j
 @Component
@@ -22,6 +24,9 @@ public class InitDataLoader implements CommandLineRunner {
     @Autowired
     private IJkApiService jkApiService;
 
+    @Autowired
+    private ThreadPoolTaskExecutor threadPoolTaskExecutor;
+
     @Override
     public void run(String... args) throws Exception {
         loadData();
@@ -37,16 +42,21 @@ public class InitDataLoader implements CommandLineRunner {
 //        System.out.println("========================初始化DeepSeek信息结束()");
 
         log.info("===================获取建科统一用户平台信息Job开始执行==============");
+        threadPoolTaskExecutor.execute(() -> syncJkData());
+
+        log.info("===================获取建科统一用户平台信息Job执行结束==============");
+    }
+
+    private void syncJkData() {
         try {
             log.info("===================开始获取部门信息==============");
             jkApiService.getJkDepts();
             log.info("===================开始获取岗位信息==============");
-//            jkApiService.getJkPosts();
+            jkApiService.getJkPosts();
             log.info("===================开始获取用户信息==============");
-//            jkApiService.getJkUsers();
+            jkApiService.getJkUsers();
         } catch (IOException e) {
-            e.printStackTrace();
+            log.error("获取建科统一用户平台信息失败",e);
         }
-        log.info("===================获取建科统一用户平台信息Job执行结束==============");
     }
 }