| | |
| | | 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; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 定时任务 |
| | |
| | | * 定时任务,每天凌晨1点执行一次, |
| | | * 自动处理之前报了名,申请了考试又没有去考试的,做缺考标记,并将报名状态修改为已取消报名 |
| | | */ |
| | | @Scheduled(cron = "* * 1 * * ?") |
| | | // @Scheduled(cron = "*/30 * * * * ?") |
| | | // @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(); |
| | | } |
| | | } |