package org.jeecg.modules.okki.wechatgroup.job;

import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.okki.wechatgroup.service.IOkkiShopWechatGroupMsgService;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import javax.annotation.Resource;

/**
 * @author Chen
 */
@Slf4j
public class SyncWechatGroupMsgJob implements Job {

    @Resource
    private IOkkiShopWechatGroupMsgService okkiShopWechatGroupMsgService;

    private String parameter;

    public void setParameter(String parameter) {
        this.parameter = parameter;
    }

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        long start = System.currentTimeMillis();
        log.info(String.format("开始同步站点-企业微信群组消息-普通定时任务 SyncWechatGroupMsgJob !  时间:" + DateUtils.now()));
        okkiShopWechatGroupMsgService.getSiteWechatMsgMaxSeq(this.parameter);
        long end = System.currentTimeMillis();
        log.info("请求同步站点-企业微信群组消息-普通定时任务 SyncWechatGroupMsgJob !结束,耗时:{}s", (end - start) / 1000);
    }
}
