Chinaunix首页 | 论坛 | 博客
  • 博客访问: 604883
  • 博文数量: 298
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 3077
  • 用 户 组: 普通用户
  • 注册时间: 2019-06-17 10:57
文章分类

全部博文(298)

文章存档

2022年(96)

2021年(201)

2019年(1)

我的朋友

分类: Java

2021-10-29 12:36:53


点击(此处)折叠或打开


  1.     /**获取当前任务流程图片的输入流
  2.      * @param PROC_INST_ID_    //流程实例ID
  3.      * @from fhadmin.cn
  4.      */
  5.     private InputStream getResourceDiagramInputStream(String PROC_INST_ID_){
  6.         try {
  7.             HistoricProcessInstance hip = historyService.createHistoricProcessInstanceQuery().processInstanceId(PROC_INST_ID_).singleResult();             //获取历史流程实例
  8.             List<HistoricActivityInstance> hai = historyService.createHistoricActivityInstanceQuery().processInstanceId(PROC_INST_ID_)
  9.                                                                                                      .orderByHistoricActivityInstanceId().asc().list();    //获取流程中已经执行的节点,按照执行先后顺序排序
  10.             List<String> executedActivityIdList = new ArrayList<String>();                        // 构造已执行的节点ID集合
  11.             for (HistoricActivityInstance activityInstance : hai) {
  12.                 executedActivityIdList.add(activityInstance.getActivityId());
  13.             }
  14.             BpmnModel bpmnModel = repositoryService.getBpmnModel(hip.getProcessDefinitionId()); // 获取bpmnModel
  15.             List<String> flowIds = this.getExecutedFlows(bpmnModel, hai);                        // 获取流程已发生流转的线ID集合
  16.             ProcessDiagramGenerator processDiagramGenerator = processEngine.getProcessEngineConfiguration().getProcessDiagramGenerator();    
  17.             InputStream imageStream = processDiagramGenerator.generateDiagram(bpmnModel, "png", executedActivityIdList, flowIds, "宋体", "微软雅黑", "黑体", null, 2.0);    //使用默认配置获得流程图表生成器,并生成追踪图片字符流
  18.             return imageStream;
  19.         } catch (Exception e) {
  20.             e.printStackTrace();
  21.             return null;
  22.         }
  23.     }


阅读(6166) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~