package com.qmth.sop.task.service;

import org.springframework.scheduling.quartz.QuartzJobBean;

import java.util.List;
import java.util.Map;

/**
 * @Description: quartz 服务类
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2020/7/1
 */
public interface QuartzService {

    /**
     * 增加一个job
     *
     * @param jobClass
     * @param jobName
     * @param jobGroupName
     * @param jobTime
     * @param jobTimes
     * @param jobData
     */
    public void addJob(Class<? extends QuartzJobBean> jobClass, String jobName, String jobGroupName, int jobTime,
                       int jobTimes, Map jobData);

    /**
     * 增加一个job
     *
     * @param jobClass
     * @param jobName
     * @param jobGroupName
     * @param jobTime
     * @param jobData
     */
    public void addJob(Class<? extends QuartzJobBean> jobClass, String jobName, String jobGroupName, String jobTime, Map jobData);

    /**
     * 修改一个job的 时间表达式
     *
     * @param jobName
     * @param jobGroupName
     * @param jobTime
     */
    public void updateJob(String jobName, String jobGroupName, String jobTime);

    /**
     * 删除任务一个job
     *
     * @param jobName
     * @param jobGroupName
     */
    public void deleteJob(String jobName, String jobGroupName);

    /**
     * 暂停一个job
     *
     * @param jobName
     * @param jobGroupName
     */
    public void pauseJob(String jobName, String jobGroupName);

    /**
     * 恢复一个job
     *
     * @param jobName
     * @param jobGroupName
     */
    public void resumeJob(String jobName, String jobGroupName);

    /**
     * 立即执行一个job
     *
     * @param jobName
     * @param jobGroupName
     */
    public void runAJobNow(String jobName, String jobGroupName);

    /**
     * 获取所有job
     *
     * @return
     */
    public List<Map<String, Object>> queryAllJob();

    /**
     * 查询正在运行的job
     *
     * @return
     */
    public List<Map<String, Object>> queryRunJob();
}