智慧保安后台管理-外网项目备份
Administrator
2021-12-02 859fc9f3c05e88c1d1af5dcdb91c88800c2aab5d
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
package org.springblade.modules.crontab;
 
import org.springblade.modules.training.entity.TrainingRegistration;
import org.springblade.modules.training.service.TrainingRegistrationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
 
/**
 * 定时任务
 * @author zhongrj
 * @since 2021-11-18
 */
@Component
public class Crontab {
 
    @Autowired
    private TrainingRegistrationService trainingRegistrationService;
 
    /**
     * 定时任务,每天凌晨1点执行一次,
     * 自动处理之前报了名,申请了考试又没有去考试的,做缺考标记,并将报名状态修改为已取消报名
     */
    @Scheduled(cron = "* * 1 * * ?")
//    @Scheduled(cron = "*/30 * * * * ?")
    @GetMapping("/examApplyStatus")
    public void examApplyStatus(){
        //自动处理之前报了名,申请了考试又没有去考试的,做缺考标记,并将报名状态修改为已取消报名
        trainingRegistrationService.examApplyStatus();
    }
}