jiangqs
2023-09-04 c97706c3cc213b7db3d381e8a0435ff0ef9a04d6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.ruoyi.goods.scheduler;
 
 
import com.ruoyi.goods.service.activity.ActivityService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
 
 
@Component
@Log4j2
public class ActivityScheduler {
 
 
    @Autowired
    private SchedulerUtils schedulerUtils;
 
    @Autowired
    private ActivityService activityService;
 
    /**
     * 每1小时检查活动定时开始
     */
    @Scheduled(cron="0 0 */1 * * ?")
    private void timingSendCoupon(){
        if(schedulerUtils.getSchedulerRun()) {
            log.info("活动定时任务开始执行");
            activityService.timingStartActivity();
        }
    }
 
 
    
}