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

import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.okki.site.service.IOkCommonService;
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 CheckBotIsExistJobGroup 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("开始检测机器人或用户是否在群中-普通定时任务 CheckBotIsExistJobGroup !  时间:" + DateUtils.now()));
        okkiShopWechatGroupMsgService.checkBotOrUserIsExistGroup();
        long end = System.currentTimeMillis();
        log.info("请求检测机器人或用户是否在群中-普通定时任务 CheckBotIsExistJobGroup !结束,耗时:{}s", (end - start) / 1000);
    }
}
