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

import cn.com.ctop.toutiao.modules.link.service.IETLReportBytedanceVideoService;
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 org.springframework.stereotype.Component;

import java.util.Date;

@Component
public class ETLReportVideoCleanJob {

    @Autowired
    IETLReportBytedanceVideoService etlReportBytedanceVideoService;

    //TODO 待删除
    @XxlJob("ETLReportVideoCleanJob")
    public void execute() throws Exception {
        String statDate = DateUtils.formatDate(DateUtils.addDay(new Date(), -1));
        try {
            etlReportBytedanceVideoService.cleanETL(statDate);
        } catch (Exception e) {
            XxlJobHelper.log("头条视频报表基础数据拉取异常：{}", e.getMessage());
        } finally {
            XxlJobHelper.log("ETLReportVideoCleanJob is finish");
        }
    }
}

