flowable672版本中已经结束的流程实例怎么查看流程图
在Flowable 6.7.2版本中,已经结束的流程实例的流程图可以通过以下步骤查看:
-
首先,你需要获取已经结束的流程实例的ID。你可以通过Flowable的API或者数据库查询来获取。
-
一旦你获取了已经结束的流程实例的ID,你可以使用Flowable的
HistoryService来获取流程实例的历史信息。
// 获取HistoryService
HistoryService historyService = processEngine.getHistoryService();
// 获取已经结束的流程实例的历史流程实例查询对象
HistoricProcessInstanceQuery historicProcessInstanceQuery = historyService.createHistoricProcessInstanceQuery();
// 根据流程实例ID查询已经结束的流程实例
HistoricProcessInstance historicProcessInstance = historicProcessInstanceQuery.processInstanceId(processInstanceId).singleResult();
// 获取流程定义ID
String processDefinitionId = historicProcessInstance.getProcessDefinitionId();
- 一旦你获取了流程定义ID,你可以使用Flowable的
RepositoryService来获取流程定义的信息。
// 获取RepositoryService
RepositoryService repositoryService = processEngine.getRepositoryService();
// 根据流程定义ID查询流程定义
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
.processDefinitionId(processDefinitionId)
.singleResult();
// 获取流程定义的流程图资源名称
String diagramResourceName = processDefinition.getDiagramResourceName();
- 最后,你可以使用Flowable的
RepositoryService来获取流程图的输入流,并将其保存到文件中以供查看。
// 获取流程定义的流程图输入流
InputStream diagramInputStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), diagramResourceName);
// 将流程图保存到文件中
OutputStream out = new FileOutputStream("path/to/save/diagram.png");
IOUtils.copy(diagramInputStream, out);
out.close();
通过以上步骤,你可以获取已经结束的流程实例的流程图,并将其保存为文件进行查看
原文地址: http://www.cveoy.top/t/topic/iLYH 著作权归作者所有。请勿转载和采集!