瀏覽代碼

添加定时任务

Signed-off-by: hamjin <335908093@qq.com>
hamjin 2 年之前
父節點
當前提交
b7407b353e
共有 1 個文件被更改,包括 7 次插入5 次删除
  1. 7 5
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/SpringTaskConfig.java

+ 7 - 5
ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/SpringTaskConfig.java

@@ -2,22 +2,24 @@ package com.ruoyi.web.controller.common;
 
 
 import com.ruoyi.system.mapper.PoTetherMapper;
+import com.ruoyi.system.service.IPoCollectionService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.Scheduled;
 
-import java.util.Date;
-
 @Configuration
 @EnableScheduling
 public class SpringTaskConfig {
     @Autowired
     PoTetherMapper poTetherMapper;
 
+    @Autowired
+    IPoCollectionService collectionService;
+
     @Scheduled(cron = "0/5 * * * * ?")
-    public  void cron() {
-      Integer i =  poTetherMapper.updateSellStatus();
-      System.out.println(i);
+    public void cron() {
+        poTetherMapper.updateSellStatus();
+        collectionService.updateCollectionStatus();
     }
 }