Activiti 流程圖上標記當前任務
[img]http://dl2.iteye.com/upload/attachment/0101/0349/cd728153-435b-3215-826e-266a0f57aeb9.png[/img]
public byte[] getCurrTaskTrackImage(String deoployId,String processInstanceId) {
byte[] imageByte = null;
ByteArrayOutputStream out = null;
try{
ProcessDefinition processDefinition = null;
if(deoployId != null) {
processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(deoployId).singleResult();
}else{
HistoricProcessInstance processInstance = findProcessInstanceHisById(processInstanceId);
processDefinition = ((RepositoryServiceImpl)repositoryService).getProcessDefinition(processInstance.getProcessDefinitionId());
}
String diagramResourceName = processDefinition.getDiagramResourceName();
InputStream imageStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), diagramResourceName);
BufferedImage image = ImageIO.read(imageStream);
List<Task> list = taskService.createTaskQuery().processInstanceId(processInstanceId).list();
Task currTask = list.get(0);
String taskId = currTask.getId();
Graphics g = image.getGraphics();
g.setColor(Color.red);
ActivityImpl currActivity = findCurrActivityGraph(taskId);
int x = currActivity.getX(),
y = currActivity.getY(),
weight = currActivity.getWidth(),
height = currActivity.getHeight();
g.drawRect(x-1, y-1, weight, height);
g.dispose();
//
ImageIO.write(image, "PNG", new File("C:/1.png"));
out = new ByteArrayOutputStream();
ImageIO.write(image, "PNG", out);
imageByte = out.toByteArray();
}catch(Exception e) {
e.printStackTrace();
}finally{
try {
out.flush();
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return imageByte;
}
public ActivityImpl findCurrActivityGraph(String taskId) {
HistoricTaskInstance currTask = historyService.createHistoricTaskInstanceQuery().taskId(taskId).singleResult();
String currActivitiId = currTask.getTaskDefinitionKey();
ProcessDefinitionEntity def = (ProcessDefinitionEntity) ((RepositoryServiceImpl)repositoryService).
getDeployedProcessDefinition(currTask.getProcessDefinitionId());
ActivityImpl activityImpl = def.findActivity(currActivitiId);
return activityImpl;
}
private HistoricProcessInstance findProcessInstanceHisById(String processInstanceId) throws Exception {
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
if(historicProcessInstance == null) {
throw new Exception("流程歷史例項未找到!");
}
return historicProcessInstance;
}
相關文章
- activiti 獲取當前任務流程圖片的輸入流流程圖
- activiti 生成當前任務圖片PNG
- flowable 獲取當前任務流程圖片的輸入流流程圖
- Activiti 學習筆記四:流程例項、任務的執行筆記
- Activiti 學習筆記五:流程變數筆記變數
- Activiti學習筆記三:管理流程定義筆記
- Activiti 學習(三)—— Activiti 流程啟動並完成
- Activiti 學習筆記六:流程執行歷史記錄筆記
- activiti7---自定義流程圖(springboot專案)流程圖Spring Boot
- Activiti 學習筆記12:分配個人任務筆記
- Activiti 學習筆記13:分配組任務筆記
- springboot 整合 activiti 流程引擎Spring Boot
- 3.activiti7 流程例項
- Activiti判斷流程是否結束
- Activiti-Explorer中設計的流程圖儲存到哪裡去了?流程圖
- Activiti7 結束/終止流程
- Activiti 儲存圖片
- 事務提交時itl上flag標記U測試!
- activiti 新增流程模型並返回 modelId模型
- activiti學習記錄
- 被標記為事務的方法互相呼叫的坑(上)
- activiti7 獲取流程定義的xmlXML
- activiti學習筆記二筆記
- Activiti 基礎概念 筆記筆記
- [CTO札記]業務流程圖Sample流程圖
- 如何在已存在的流程記錄上發起流程?
- Activiti-master java activiti5 線上web流程設計器畫布整合視訊教程ASTJavaWeb
- Activiti5.2 自動完成第一節點流程
- ArcGIS API for Silverlight 中根據座標點在地圖上打標記API地圖
- RecycleView:再見前任(Listview)View
- activiti學習筆記(四)managementService筆記
- Activiti 學習筆記 小結筆記
- Activiti工作流-筆記2筆記
- laravel之標準上傳圖片Laravel
- activiti 根據 流程例項ID 獲取發起人
- Activiti 流程啟動及節點流轉原始碼分析原始碼
- iOS上架流程iOS上架流程iOS
- 投標流程