feiyu02
2026-01-19 53ce8de426561e7a43847afda23b5e24e6f76c4e
src/main/kotlin/cn/flightfeather/supervision/scheduler/ScheduleService.kt
@@ -8,6 +8,7 @@
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
/**
@@ -32,15 +33,17 @@
    @Async
    @Scheduled(cron = "0 0 * * * *")
    fun eachHour() {
        if (mode != "proapp") return
        if (mode != "pro") return
        logger.info("=====>>>>>每小时任务执行 {}", System.currentTimeMillis())
        taskJinAnHourlyDustData.doTask(LocalDateTime.now())
        logger.info("=====>>>>>每小时任务结束 {}", System.currentTimeMillis())
    }
//    @Async
    //    @Async
//    @Scheduled(cron = "0 0 0 * * *")
    fun eachDay() {
        if (mode != "pro") return
        logger.info("=====>>>>>每日任务执行 {}", System.currentTimeMillis())
        logger.info("=====>>>>>每日任务结束 {}", System.currentTimeMillis())
@@ -49,9 +52,20 @@
    @Async
    @Scheduled(cron = "0 0 0 * * SUN")
    fun eachSunday() {
        if (mode != "proapp") return
        if (mode != "pro") return
        logger.info("=====>>>>>每周日零点任务执行 {}", System.currentTimeMillis())
        mTaskJinAnHourlyDustData.handle()
        logger.info("=====>>>>>每周日零点任务结束 {}", System.currentTimeMillis())
    }
    @Async
    @Scheduled(cron = "0 0 3 1 * *")
    fun eachMonth() {
        if (mode != "pro") return
        logger.info("=====>>>>>每月初任务执行 {}", System.currentTimeMillis())
        // 执行上个月的静安工地扬尘数据补全任务
        val now = LocalDate.now().minusMonths(1)
        mTaskJinAnHourlyDustData.handle(now.year, now.monthValue)
        logger.info("=====>>>>>每月初任务结束 {}", System.currentTimeMillis())
    }
}