企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
:-: ![](https://img.kancloud.cn/09/4a/094afa6503a3104896e3a5a3c7d3c8b5_1156x150.png) 文件:`evection.bpmn` ```java public class TestPersonalTaskList { /** * 查询任务负责人的待办任务 */ @Test public void findPersonalTaskList() { //获取processEngine ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine(); //获取TaskService TaskService taskService = processEngine.getTaskService(); //获取RuntimeService RuntimeService runtimeService = processEngine.getRuntimeService(); //查询流程定义的对象 List<Task> taskList = taskService.createTaskQuery() .processDefinitionKey("evection-personal") .includeProcessVariables() .taskAssignee("张三") .list(); //.singleResult(); for (Task task : taskList) { //使用task对象获取实例id String processInstanceId = task.getProcessInstanceId(); //使用实例id,获取流程实例对象 ProcessInstance processInstance = runtimeService.createProcessInstanceQuery() .processInstanceId(processInstanceId) .singleResult(); //使用processInstance,得到 businessKey String businessKey = processInstance.getBusinessKey(); System.out.println("流程实例id:" + task.getProcessInstanceId()); System.out.println("任务id:" + task.getId()); System.out.println("任务负责人:" + task.getAssignee()); System.out.println("任务名称:" + task.getName()); System.out.println("businessKey(业务标识):" + businessKey); System.out.println(); } //流程实例id:27501 //任务id:27505 //任务负责人:张三 //任务名称:创建出差申请单 //businessKey(业务标识):10001 } } ```