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

import cn.com.ctop.toutiao.modules.report.service.IByteDanceVideoReportDailyService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.log.XxlJobLogger;
import org.jeecg.common.util.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * 头条视频报表清洗数据定时任务
 *
 * @author sunzhen
 */
@Component
public class ByteDanceVideoReportJob {
    @Autowired
    private IByteDanceVideoReportDailyService byteDanceVideoReportDailyService;

    @XxlJob("byteDanceVideoReport")
    public ReturnT<String> execute(String param) throws Exception {
        String getDate = DateUtils.formatDate(DateUtils.addDay(new Date(), -1));
        XxlJobLogger.log("头条视频报表清洗数据定时任务开始, 执行时间为：" + getDate);
        byteDanceVideoReportDailyService.videoInfoList(getDate, getDate);
        return ReturnT.SUCCESS;
    }
}
