问题遇到的现象和发生背景
activit 7
问题相关代码,请勿粘贴截图
// 1. 获取流程引擎
ProcessEngine defaultProcessEngine = ProcessEngines.getDefaultProcessEngine();
// 2. 通过TaskService 查询任务
TaskService taskService = defaultProcessEngine.getTaskService();
// 3. 根据 流程的 key 和 任务的负责人查询任务
List<Task> tasks = taskService.createTaskQuery().processDefinitionKey("myEvention").list();
// .taskAssignee("zhangsan").list();
// 4. 展示
tasks.forEach(e -> {
System.out.println("流程实例 ID -> " + e.getProcessInstanceId());
System.out.println("任务 ID -> " + e.getId());
System.out.println("任务负责人 -> " + e.getAssignee());
System.out.println("任务名称 -> " + e.getName());
});
对应的bpmn文件
<bpmn:userTask id="Task_13j14ta" name="创建出差申请" camunda:assignee="zhangsan" camunda:candidateUsers="zhangsan">
<bpmn:incoming>SequenceFlow_1s9xwpt</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1jew1sj</bpmn:outgoing>
</bpmn:userTask>
<bpmn:userTask id="Task_0cu19v2" name="经理审批" camunda:assignee="lisi" camunda:candidateUsers="lisi">
<bpmn:incoming>SequenceFlow_1jew1sj</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0rcro0v</bpmn:outgoing>
</bpmn:userTask>
<bpmn:userTask id="Task_178czq5" name="总经理审批" camunda:assignee="wangwu" camunda:candidateUsers="wangwu">
<bpmn:incoming>SequenceFlow_0rcro0v</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_01kx4bh</bpmn:outgoing>
</bpmn:userTask>
<bpmn:userTask id="Task_0fcwsrt" name="财务审批" camunda:assignee="zhaoliu" camunda:candidateUsers="zhaoliu">
<bpmn:incoming>SequenceFlow_01kx4bh</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1wx8lyc</bpmn:outgoing>
</bpmn:userTask>
</bpmn:process>