package com.bbd.bpm.listener;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.TaskService;
import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.TaskListener;

import java.io.Serializable;

/**
 * Created by houkang on 2019/1/28.
 */
public class PutAssigneeListener   implements Serializable, TaskListener {
   // private String  job;

    @Override
    public void notify(DelegateTask delegateTask) {

        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
        TaskService taskService = processEngine.getTaskService();
        //System.out.println("========================= "+job+" =============");
//        if(job!=null){
//            if("jingli".equals(job)){
//                delegateTask.setAssignee("wang");
//            }else if("emp".equals(job)){
//                delegateTask.setAssignee("houkang");
//            }
//        }else{
        taskService.setAssignee(delegateTask.getId(),"hr");
//        }
    }

   //
}
