package com.ruoyi.project.listener;

import com.alibaba.fastjson.JSON;
import com.ruoyi.common.sendEmail.IMailService;
import com.ruoyi.common.utils.SpringContextUtils;
import com.ruoyi.project.system.service.ISysUserService;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.ExecutionListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.Map;

@Service("startProcessListener")
public class StartProcessListener implements Serializable, ExecutionListener {
    protected Logger logger = LoggerFactory.getLogger(getClass());

    private static final long serialVersionUID = -3759054058055401826L;

    @Override
    public void notify(DelegateExecution delegateExecution) {
        String id = delegateExecution.getProcessInstanceBusinessKey();
        Map variableInstances = delegateExecution.getVariableInstances();
        logger.info("--------------------------start--------------------------");
        logger.debug("参数--------------------------------" + JSON.toJSONString(variableInstances));
        logger.debug("审批id--------------------------------" + id);
        ISysUserService sysUserService = (ISysUserService) SpringContextUtils.getBean("sysUserService");
        IMailService mailService = (IMailService) SpringContextUtils.getBean("mailService");


    }
}
