package org.jeecg.modules.ctop.job;

import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 头条素材报表按天跑前一天的数据任务
 *
 * @author sunzhen
 */
@Slf4j
public class BytedanceDailyReportAsyncTaskGetJob implements Job {
    @Autowired
    private IBytedanceReportService bytedanceReportService;

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        try {
            log.info("头条获取素材报表数据定时任务执行开始");
            Long starttime = System.currentTimeMillis();
            bytedanceReportService.bytedanceAsyncTaskGet();
            Long endtime = System.currentTimeMillis();
            log.info("头条异步报表数据定时任务执行结束,执行耗时：{}秒", (endtime - starttime) / 1000);
        } catch (Exception e) {
            log.error("头条获取异步报表数据定时任务执行报错");
            e.printStackTrace();
        }
    }
}
