package cn.iocoder.yudao.module.crm.job.salesperformance;

import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
import cn.iocoder.yudao.module.crm.service.salesperformancesettlement.SalesPerformanceSettlementService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
@Slf4j
public class AutoConfirmJob {

    // TODO: 2024/11/04  - 每个月月初04号 0点10分 未确认的 自动确认上个月的结算记录
    @Resource
    private SalesPerformanceSettlementService salesPerformanceSettlementService;

    @XxlJob("autoConfirmJob")
    @TenantJob // --- ⚠️ 这个注解 会将租户列表拉出来 完了后逐个租户执行 定时任务需要注意
    public ReturnT<String> execute() {
        log.info("开始 自动确认");
        salesPerformanceSettlementService.autoConfirmJob();
        log.info("结束 自动确认");
        return ReturnT.SUCCESS;
    }
}
