package com.ytpm.middle.timer;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.temporal.TemporalAdjusters;

/**
 * @author Marx
 * @date 2025/8/6 18:02
 */
//@Component
public class CustomScheduling {

    /**
     * 每周三执行
     */
//    @Scheduled(cron = "0 0 0 ? * WED")
//    public void financialAccounting() {
//        LocalDate today = LocalDate.now();
//        // 1. 获取本月最后一个周三
//        LocalDate lastWed = today.with(TemporalAdjusters.lastInMonth(DayOfWeek.WEDNESDAY));
//        // 2. 判断今天是否是最后一个周三
//        if (today.isEqual(lastWed)) {
//            executeFinanceTask();
//        }
//    }
//
//    /**
//     * 执行任务，查询需要出账的企业
//     */
//    private void executeFinanceTask() {
//
//    }
}
