其他分享
首页 > 其他分享> > 8. flowable - 查询一个流程实例的任务节点明细

8. flowable - 查询一个流程实例的任务节点明细

作者:互联网

废话不多说,直接上代码:

@PostMapping("listByProcessInstanceId")
public ResultDTO<TaskInstanceDTO> listByProcessInstanceId(String processInstanceId) {
    ResultDTO<TaskInstanceDTO> resultDTO = new ResultDTO<>(ReturnCode.SUCCESS, "查询成功");
    List<HistoricTaskInstance> historicTaskInstanceList = taskInstanceApplicationService.listByProcessInstanceId(processInstanceId);
    if (CollUtil.isEmpty(historicTaskInstanceList)) {
        return new ResultDTO<>(ReturnCode.FAIL, "查询无数据");
    }
    List<HistoricProcessInstance> historicProcessInstanceList = processInstanceApplicationService.listHistoryProcessInstanceByHistoricTaskInstanceList(historicTaskInstanceList);
    if (CollUtil.isEmpty(historicProcessInstanceList)) {
        return new ResultDTO<>(ReturnCode.FAIL, "查询无数据");
    }
    resultDTO.setDataList(TaskInstanceAssembler.toDTOByHistory(historicTaskInstanceList, historicProcessInstanceList));
    return resultDTO;
}

下面是接口测试:

 

 把我们刚刚发起的流程实实例id当做参数传入,点击execute:

 

 

可以看到,第一个节点名称是张三,执行人是zhangsan,第二个节点名称是李四,执行人是lisi。

 

标签:ReturnCode,return,flowable,明细,ResultDTO,new,historicTaskInstanceList,resultDTO,
来源: https://www.cnblogs.com/songci/p/14616714.html