| 12345678910111213141516171819202122232425262728293031323334353637 |
- package com.punchsettle.server.task;
- import java.time.LocalDate;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.scheduling.annotation.Scheduled;
- import org.springframework.stereotype.Component;
- import com.punchsettle.server.service.manager.ICalendarManager;
- import lombok.extern.slf4j.Slf4j;
- /**
- * @author tyuio
- * @version 1.0.0
- * @date 2025/4/14 12:57
- * @description 日历定时任务,每年1月1日零点零一秒执行
- */
- @Slf4j
- @Component
- public class CalendarTask {
- @Autowired
- private ICalendarManager calendarManager;
- @Scheduled(cron = "1 0 0 1 1 ?")
- public void execute() {
- log.info("========== 日历定时任务 开始执行 ==========");
- // 当前公历日期
- int currentYear = LocalDate.now().getYear();
- String gregorianDate = String.valueOf(currentYear);
- calendarManager.refreshCalendar(gregorianDate);
- log.info("========== 日历定时任务 结束执行 ==========");
- }
- }
|