一 1.根据当前任务id获得当前任务对象
Task task = processEngine.getTaskService().createTaskQuery().taskId(taskId).singleResult();
2.根据流程id获得流程实例
ProcessInstance pi =processEngine.getRuntimeService().createProcessInstanceQuery().processInstanceId(task.getProcessInstanceId()).singleResult();
3.根据任务id获得流程实例id
task.getProcessInstanceId();
4.根据任务id获得流程定义id
task.getProcessDefinitionId();
5.更具流程实例id获得流程
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery()
.processInstanceId(pProcessInstanceId).singleResult();
6.根据任务名字获得所有任务
List<Task> list = taskService.createTaskQuery()
.taskCandidateOrAssigned("userId").list();
7.添加批注信息
taskService.addComment(taskId, task.getProcessInstanceId(), message);
8.查询批注信息
List<Comment> list = taskService.getProcessInstanceComments(task.getProcessInstanceId());
9.获取历史流程实例
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery()
.processInstanceId(pProcessInstanceId).singleResult();
10.获得流程定义(根据历史流程实例id)
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService)
.getDeployedProcessDefinition(historicProcessInstance.getProcessDefinitionId());
11.获得流程实例中已执行的节点
List<HistoricActivityInstance> historicActivityInstanceList = historyService.createHistoricActivityInstanceQuery()
.processInstanceId(pProcessInstanceId).orderByHistoricActivityInstanceId().asc().list();
12.查询流程定
List<ProcessDifintion> list = processEngine.getRepositoryService.CreateProcessDefinitionQuery().processDefinitionId(processDefifinitionId).list();
---------------------
作者:pgh_1947
来源:CSDN
原文:https://blog.csdn.net/pgh_1947/article/details/77340711
版权声明:本文为博主原创文章,转载请附上博文链接!