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


import cn.com.ctop.common.module.utils.HttpUtils;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.jeecg.common.util.DateUtils;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * 供应链-快分销数据
 */
@Component
public class CheckSupplyChainJob {

    @XxlJob("checkSupplyChainJob")
    public void checkSupplyChainJob() throws Exception {
        String today = DateUtils.date2Str();
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("endDate", today);
        paramMap.put("beginDate", today);
        HttpUtils.httpGet("http://ruixuan.api.bjhcstszkj.cn/isv/supply_chain/addList", paramMap, null);
        XxlJobHelper.log(" --------当天供应链-快分销数据，执行完成-------- " + paramMap.toString());
    }

    @XxlJob("checkSupplyChainTwoDaysJob")
    public void checkSupplyChainTwoDaysJob() throws Exception {
        String today = DateUtils.date2Str();
        //昨天
        String yesterday = DateUtils.getLastDay(today, 2);
        String endDate = DateUtils.getLastDay(today, 1);
        String beginDate = DateUtils.getLastDay(today, 2);
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("endDate", endDate);
        paramMap.put("beginDate", beginDate);
        HttpUtils.httpGet("http://ruixuan.api.bjhcstszkj.cn/isv/supply_chain/addList", paramMap, null);
        XxlJobHelper.log(" --------供应链-快分销更新发货状态数据，执行完成-------- " + paramMap.toString());
        XxlJobHelper.log(" --------前两天供应链-快分销数据，执行完成-------- " + paramMap.toString());
    }


}
