From 4e20a1aaaba1bb843820fca844c20055a33febce Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期五, 19 七月 2024 17:39:19 +0800 Subject: [PATCH] 1. 新增webSocket相关功能 --- src/main/kotlin/cn/flightfeather/supervision/scheduler/ScheduleService.kt | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/cn/flightfeather/supervision/scheduler/ScheduleService.kt b/src/main/kotlin/cn/flightfeather/supervision/scheduler/ScheduleService.kt index 45ebef0..c34d071 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/scheduler/ScheduleService.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/scheduler/ScheduleService.kt @@ -6,9 +6,11 @@ import cn.flightfeather.supervision.lightshare.vo.AreaVo import org.slf4j.Logger import org.slf4j.LoggerFactory +import org.springframework.beans.factory.annotation.Value 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 /** @@ -23,6 +25,8 @@ */ @Component class ScheduleService( + @Value("\${mode}") + var mode: String, private val taskFinishSubtask: TaskFinishSubtask, private val taskFinishTopTask: TaskFinishTopTask, private val aopTaskCtrl: AopTaskCtrl, @@ -32,6 +36,8 @@ @Async @Scheduled(cron = "0 0 0 * * *") fun eachDay() { + if (mode != "pro") return + logger.info("=====>>>>>姣忔棩浠诲姟鎵ц {}", System.currentTimeMillis()) taskFinishSubtask.handle() logger.info("=====>>>>>姣忔棩浠诲姟缁撴潫 {}", System.currentTimeMillis()) @@ -40,18 +46,22 @@ @Async @Scheduled(cron = "0 0 0 * * MON") fun eachWeek() { + if (mode != "pro") return + logger.info("=====>>>>>姣忓懆浠诲姟鎵ц {}", System.currentTimeMillis()) // 鎵ц涓婂懆鐨勮嚜璇勪换鍔� - aopTaskCtrl.startAllEvaluation(LocalDateTime.now()) + aopTaskCtrl.startAllEvaluation(LocalDate.now().atStartOfDay()) logger.info("=====>>>>>姣忓懆浠诲姟缁撴潫 {}", System.currentTimeMillis()) } @Async @Scheduled(cron = "0 0 0 2 * *") fun eachMonth() { + if (mode != "pro") return + logger.info("=====>>>>>姣忔湀浠诲姟鎵ц {}", System.currentTimeMillis()) // 鎵ц涓婁釜鏈堢殑瀹屾暣鑷瘎浠诲姟 - aopTaskCtrl.startAll(LocalDateTime.now().minusMonths(1)) + aopTaskCtrl.startAll(LocalDate.now().atStartOfDay().minusMonths(1)) // 鎵ц椤跺眰浠诲姟鑷姩缁撴潫浠诲姟 taskFinishTopTask.handle() logger.info("=====>>>>>姣忔湀浠诲姟缁撴潫 {}", System.currentTimeMillis()) -- Gitblit v1.9.3