package com.ruoyi.web.job;

import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.flowable.service.ISysFormService;
import com.ruoyi.system.service.ISysUserService;
import org.flowable.engine.ProcessEngine;
import org.flowable.engine.ProcessEngines;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.task.api.Task;
import org.flowable.task.api.TaskQuery;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;

@EnableScheduling
@Component
public class ToDoNumberJob {
    protected Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    private ISysFormService sysFormService;

    /**
     * 每五分钟更新一次待办事项数量
     *
     */
    @Scheduled(fixedDelay = 120000,initialDelay = 10000)
    public void updateToDoNumber(){
        logger.info("开始更新待办事项数量");
        //查询所有进行中的任务
        //更新代办任务数量
        sysFormService.updateToDoNumber();
    }
}
