From 40254eb1fc7ad9bef6e820c0ffc0cc5a63e9e53e Mon Sep 17 00:00:00 2001 From: zhang <zc857179121@qq.com> Date: 星期二, 21 十月 2025 09:53:54 +0800 Subject: [PATCH] 1 --- src/main/java/com/zy/asrs/task/OverYearLogScheduler.java | 17 ++++++++++++++++- 1 files changed, 16 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/zy/asrs/task/OverYearLogScheduler.java b/src/main/java/com/zy/asrs/task/OverYearLogScheduler.java index 95a8a29..7d3090a 100644 --- a/src/main/java/com/zy/asrs/task/OverYearLogScheduler.java +++ b/src/main/java/com/zy/asrs/task/OverYearLogScheduler.java @@ -2,6 +2,8 @@ import com.zy.asrs.task.core.ReturnT; import com.zy.asrs.task.handler.OverYearLogHandler; +import com.zy.system.entity.Config; +import com.zy.system.service.ConfigService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -16,15 +18,28 @@ private static final Logger log = LoggerFactory.getLogger(OverYearLogScheduler.class); + public static Integer days = 60; + @Autowired private OverYearLogHandler overYearLogHandler; + @Autowired + private ConfigService configService; + @Scheduled(cron = "0/3 * * * * ? ") - private void execute(){ + private void execute() { ReturnT<String> returnT = overYearLogHandler.start(); if (!returnT.isSuccess()) { log.error(returnT.getMsg()); } } + + @Scheduled(cron = "0/2 * * * * ? ") + private void execute2() { + Config config = configService.selectConfigByCode("AlarmDays"); + if (config != null && config.getValue() != null && config.getStatus() == 1) { + days = Integer.parseInt(config.getValue()); + } + } } -- Gitblit v1.9.1