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

import cn.com.ctop.toutiao.modules.material.service.IBytedanceEffectVideoInfoService;
import com.xxl.job.core.biz.model.ReturnT;
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 BytedanceEffectVideoJob {
    @Autowired
    private IBytedanceEffectVideoInfoService bytedanceEffectVideoInfoService;
    @XxlJob("bytedanceEffectVideoJob")
    public ReturnT<String> execute(String date) throws Exception {
        if(null == date||date.trim().equalsIgnoreCase("")||date.trim().equalsIgnoreCase("null")){
            date = DateUtils.formatDate(DateUtils.addDay(new Date(),-14));
        }
        bytedanceEffectVideoInfoService.loadEffectVideo(date);
        return ReturnT.SUCCESS;
    }
}
