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

import cn.com.ctop.toutiao.modules.report.service.IBytedanceVideoEtlInfoService;
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 BytedanceEtlVideoJob {

    @Autowired
    private IBytedanceVideoEtlInfoService bytedanceVideoEtlInfoService;
    @XxlJob("bytedanceEtlVideoJob")
    public void execute() throws Exception {
        Date startDate = DateUtils.addDay(new Date(),-2);
        for(int i=0;i<=2;i++){
            Date getDate = DateUtils.addDay(startDate,i);
            bytedanceVideoEtlInfoService.etlBytedanceVideoInfo(getDate);
        }
    }

    @XxlJob("bytedanceEtlVideoProjectJob")
    public void bytedanceEtlVideoProjectJob() throws Exception {
        Date startDate = DateUtils.addDay(new Date(),-2);
        for(int i=0;i<=2;i++){
            Date getDate = DateUtils.addDay(startDate,i);
            bytedanceVideoEtlInfoService.etlBytedanceVideoInfoByProjectId(getDate);
        }
    }
}
