/**获取当前任务流程图片的输入流
* @param PROC_INST_ID_ //流程实例ID
* @from fhadmin.cn
*/
private InputStream getResourceDiagramInputStream(String PROC_INST_ID_){
try {
HistoricProcessInstance hip = historyService.createHistoricProcessInstanceQuery().processInstanceId(PROC_INST_ID_).singleResult(); //获取历史流程实例
List<HistoricActivityInstance> hai = historyService.createHistoricActivityInstanceQuery().processInstanceId(PROC_INST_ID_)
.orderByHistoricActivityInstanceId().asc().list(); //获取流程中已经执行的节点,按照执行先后顺序排序
List<String> executedActivityIdList = new ArrayList<String>(); // 构造已执行的节点ID集合
for (HistoricActivityInstance activityInstance : hai) {
executedActivityIdList.add(activityInstance.getActivityId());
}
BpmnModel bpmnModel = repositoryService.getBpmnModel(hip.getProcessDefinitionId()); // 获取bpmnModel
List<String> flowIds = this.getExecutedFlows(bpmnModel, hai); // 获取流程已发生流转的线ID集合
ProcessDiagramGenerator processDiagramGenerator = processEngine.getProcessEngineConfiguration().getProcessDiagramGenerator();
InputStream imageStream = processDiagramGenerator.generateDiagram(bpmnModel, "png", executedActivityIdList, flowIds, "宋体", "微软雅黑", "黑体", null, 2.0); //使用默认配置获得流程图表生成器,并生成追踪图片字符流
return imageStream;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
activiti 获取当前任务流程图片的输入流
最新推荐文章于 2022-11-03 10:03:39 发布