package cn.com.ctop.job.bytedance.handler;

import cn.com.ctop.toutiao.modules.link.service.IEtlDesignDailyReportService;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.jeecg.common.util.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;

public class ETLReportDesignJob {

    @Autowired
    IEtlDesignDailyReportService etlDesignDailyReportService;

    /**
     * 设计人员消耗数据清洗
     * @throws Exception
     */
    @XxlJob("ETLReportDesignJob")
    public void execute() throws Exception {
        String statDate = DateUtils.formatDate(DateUtils.addDay(new Date(), -1));
        try {
            etlDesignDailyReportService.cleanEtl(statDate);
        } catch (Exception e) {
            XxlJobHelper.log("头条视频报表基础数据拉取异常：{}", e.getMessage());
        } finally {
            XxlJobHelper.log("ETLReportVideoCleanJob is finish");
        }
    }

}
