Browse Source

聊天室开启自动定时任务

yuhongqi 1 week ago
parent
commit
d947169350

+ 0 - 16
fs-live-socket/pom.xml

@@ -68,17 +68,6 @@
             <groupId>com.alibaba</groupId>
             <groupId>com.alibaba</groupId>
             <artifactId>druid-spring-boot-starter</artifactId>
             <artifactId>druid-spring-boot-starter</artifactId>
         </dependency>
         </dependency>
-        <!-- 验证码 -->
-        <dependency>
-            <groupId>com.github.penggle</groupId>
-            <artifactId>kaptcha</artifactId>
-            <exclusions>
-                <exclusion>
-                    <artifactId>javax.servlet-api</artifactId>
-                    <groupId>javax.servlet</groupId>
-                </exclusion>
-            </exclusions>
-        </dependency>
         <!-- 系统模块-->
         <!-- 系统模块-->
         <dependency>
         <dependency>
             <groupId>com.fs</groupId>
             <groupId>com.fs</groupId>
@@ -98,11 +87,6 @@
             <groupId>com.github.javen205</groupId>
             <groupId>com.github.javen205</groupId>
             <artifactId>IJPay-All</artifactId>
             <artifactId>IJPay-All</artifactId>
         </dependency>
         </dependency>
-        <dependency>
-            <groupId>com.alipay.sdk</groupId>
-            <artifactId>alipay-sdk-java</artifactId>
-            <version>4.8.62.ALL</version>
-        </dependency>
         <dependency>
         <dependency>
             <groupId>com.google.zxing</groupId>
             <groupId>com.google.zxing</groupId>
             <artifactId>javase</artifactId>
             <artifactId>javase</artifactId>

+ 1 - 1
fs-live-socket/src/main/java/com/fs/LiveSocketAppApplication.java

@@ -13,7 +13,7 @@ import org.springframework.web.socket.config.annotation.EnableWebSocket;
  */
  */
 @EnableCaching
 @EnableCaching
 @EnableAsync
 @EnableAsync
-//@EnableScheduling
+@EnableScheduling
 @EnableWebSocket
 @EnableWebSocket
 @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
 @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
 public class LiveSocketAppApplication
 public class LiveSocketAppApplication

+ 12 - 0
fs-live-socket/src/main/java/com/fs/live/config/WebSocketConfig.java

@@ -2,6 +2,8 @@ package com.fs.live.config;
 
 
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.TaskScheduler;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
 import org.springframework.web.socket.server.standard.ServerEndpointExporter;
 import org.springframework.web.socket.server.standard.ServerEndpointExporter;
 
 
 @Configuration
 @Configuration
@@ -17,4 +19,14 @@ public class WebSocketConfig {
     public ServerEndpointExporter serverEndpointExporter() {
     public ServerEndpointExporter serverEndpointExporter() {
         return new ServerEndpointExporter();
         return new ServerEndpointExporter();
     }
     }
+
+    @Bean
+    public TaskScheduler taskScheduler() {
+        ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
+        scheduler.setPoolSize(10); // 线程池大小
+        scheduler.setThreadNamePrefix("live-scheduler-"); // 线程名前缀
+        scheduler.setAwaitTerminationSeconds(60); // 等待终止时间
+        scheduler.setWaitForTasksToCompleteOnShutdown(true); // 关闭时等待任务完成
+        return scheduler;
+    }
 }
 }

+ 0 - 23
fs-live-socket/src/main/java/com/fs/live/task/Task.java

@@ -80,28 +80,6 @@ public class Task {
     private LiveLotteryRegistrationMapper liveLotteryRegistrationMapper;
     private LiveLotteryRegistrationMapper liveLotteryRegistrationMapper;
     @Autowired
     @Autowired
     private ILiveRedConfService liveRedConfService;
     private ILiveRedConfService liveRedConfService;
-//1111
-    @Autowired
-    private ILiveOrderService liveOrderService;
-
-    @Autowired
-    private ILiveAfterSalesService afterSalesService;
-
-
-    @Autowired
-    private IErpOrderService erpOrderService;
-
-
-    @Autowired
-    private IFsExpressService expressService;
-
-
-    @Autowired
-    private ILiveOrderLogsService orderLogsService;
-
-
-    @Autowired
-    private FsWarehousesMapper fsWarehousesMapper;
 
 
     @Autowired
     @Autowired
     public FsJstAftersalePushService fsJstAftersalePushService;
     public FsJstAftersalePushService fsJstAftersalePushService;
@@ -109,7 +87,6 @@ public class Task {
     public RedisUtil redisUtil;
     public RedisUtil redisUtil;
     @Scheduled(cron = "0 0/1 * * * ?")
     @Scheduled(cron = "0 0/1 * * * ?")
     @DistributeLock(key = "updateLiveStatusByTime", scene = "task")
     @DistributeLock(key = "updateLiveStatusByTime", scene = "task")
-    //public void selectSopUserLogsListByTime() {
     public void updateLiveStatusByTime() {
     public void updateLiveStatusByTime() {
         List<Live> list = liveService.selectNoEndLiveList();
         List<Live> list = liveService.selectNoEndLiveList();
         if (list.isEmpty())
         if (list.isEmpty())