| | |
| | | import org.springframework.scheduling.annotation.Async |
| | | import org.springframework.scheduling.annotation.Scheduled |
| | | import org.springframework.stereotype.Component |
| | | import java.time.LocalDate |
| | | import java.time.LocalDateTime |
| | | |
| | | /** |
| | |
| | | @Async |
| | | @Scheduled(cron = "0 0 * * * *") |
| | | fun eachHour() { |
| | | if (mode != "proapp") return |
| | | logger.info("=====>>>>>每小时任务执行 {}", System.currentTimeMillis()) |
| | | taskJinAnHourlyDustData.doTask(LocalDateTime.now()) |
| | | logger.info("=====>>>>>每小时任务结束 {}", System.currentTimeMillis()) |
| | |
| | | @Async |
| | | @Scheduled(cron = "0 0 0 * * SUN") |
| | | fun eachSunday() { |
| | | if (mode != "proapp") return |
| | | logger.info("=====>>>>>每周日零点任务执行 {}", System.currentTimeMillis()) |
| | | mTaskJinAnHourlyDustData.handle() |
| | | logger.info("=====>>>>>每周日零点任务结束 {}", System.currentTimeMillis()) |
| | | } |
| | | |
| | | @Async |
| | | @Scheduled(cron = "0 0 3 1 * *") |
| | | fun eachMonth() { |
| | | logger.info("=====>>>>>每月初任务执行 {}", System.currentTimeMillis()) |
| | | // 执行上个月的静安工地扬尘数据补全任务 |
| | | val now = LocalDate.now().minusMonths(1) |
| | | mTaskJinAnHourlyDustData.handle(now.year, now.monthValue) |
| | | logger.info("=====>>>>>每月初任务结束 {}", System.currentTimeMillis()) |
| | | } |
| | | } |