package com.engine.kq.biz;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ServiceUtil;
import com.engine.kq.service.KQScheduleSignImportService;
import com.engine.kq.service.impl.KQScheduleSignImportServiceImpl;
import weaver.general.BaseBean;
import weaver.hrm.common.Tools;
import weaver.interfaces.schedule.BaseCronJob;

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

public class KQDingTalkImportJob extends BaseCronJob{
	public void execute() {
		BaseBean bb = new BaseBean();
		try{

			bb.writeLog("begin do KQDingTalkImportJob invoke ...");
			KQScheduleSignImportService kqScheduleSignImportService = (KQScheduleSignImportServiceImpl) ServiceUtil.getService(KQScheduleSignImportServiceImpl.class);
			//导入策略 每天导入前一天和当天数据
			Map<String,Object> params = new HashMap<>();
			params.put("fromDate",Tools.getDate(Tools.getToday(),-1));
			params.put("toDate",Tools.getDate(Tools.getToday()));

			bb.writeLog("do KQDingTalkImportJob invoke.."+ JSONObject.toJSONString(params));

			kqScheduleSignImportService.synDingTalkData(params);

			bb.writeLog("end do KQDingTalkImportJob invoke  ...");
		}catch (Exception e) {
			bb.writeLog(e);
		}
	}
}
