package com.yd.csf.api.async;

import com.yd.csf.api.service.XxlJobService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * 预计发佣-异步类
 */
@Slf4j
@Component
public class ApiExpectedFortuneAsyncService {

    @Autowired
    private XxlJobService xxlJobService;

    @Value("${xxl.job.executor.calmAppName}")
    private String calmAppName;

    /**
     * 创建XXL-Job定时任务-保单冷静期-异步方法
     * @param taskBizId
     * @param scheduleTime
     */
//    @Async("jobTaskExecutor")
    public void addCalmScheduleJob(String taskBizId, Date scheduleTime) {
        String taskName = "冷静期定时任务";
        String jobId = xxlJobService.addScheduleJob(taskName,taskBizId,calmAppName,scheduleTime);
        log.info("创建XXL-Job定时任务成功-->jobId：{}",jobId);
    }

}
