智慧保安后台管理-外网
Administrator
2022-06-16 8b375fe00a241b3a769b82fe3dac8d1c9dce8a02
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
36
37
38
39
40
41
42
43
44
45
46
47
package org.springblade.modules.crontab;
 
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;
 
import java.text.SimpleDateFormat;
import java.util.Date;
 
/**
 * 定时任务
 * @author zhongrj
 * @since 2021-11-18
 */
@Component
public class Crontab {
 
    @Autowired
    private TrainingRegistrationService trainingRegistrationService;
 
    /**
     * 定时任务,每天凌晨1点执行一次,
     * 自动处理之前报了名,申请了考试又没有去考试的,做缺考标记,并将报名状态修改为已取消报名
     */
//    @Scheduled(cron = "0 0 23 * * ?")
//    @Scheduled(cron = "*/10 * * * * ?")
    @GetMapping("/examApplyStatus")
    public void examApplyStatus(){
        System.out.println("定时任务1:执行时间:"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
        //自动处理之前报了名,申请了考试又没有去考试的,做缺考标记,并将报名状态修改为已取消报名
        trainingRegistrationService.examApplyStatus();
    }
 
 
    /**
     * 定时任务,处理考试中的人员
     */
//    @Scheduled(cron = "0 0 22 * * ?")
//    @GetMapping("/examLoading")
    public void aa(){
        System.out.println("定时任务2:执行时间:"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
        //自动处理之前报了名,考试忘记提交或者中断考试的
        trainingRegistrationService.examLoading();
    }
}