package org.jeecg.modules.ctop.job;

import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.constant.SystemDateConstant;
import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.ctop.service.IMaterialTopService;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

/**
 *  Created by JQ.bi on 2020.5.25
 *  定时更新素材报表的 快手头条整合数据
 */
@Slf4j
public class MaterialReportAccountUpdateJob implements Job {

    @Autowired
    IMaterialTopService materialTopService;

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {

        log.info("MaterialReportAccountUpdateJob is start");

        boolean result=materialTopService.insertMaterialReportAccount(DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd,
                DateUtils.getNowDate(SystemDateConstant.yyyy_MM_dd), -1));

        if(!result){
            log.error("MaterialReportAccountUpdateJob is error");
        } else {
            log.info("MaterialReportAccountUpdateJob is done");
        }
    }

}
