Browse Source

添加定时任务

Signed-off-by: hamjin <335908093@qq.com>
hamjin 2 years ago
parent
commit
b7407b353e

+ 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();
     }
 }