/**
* 查询当前流程图
* @param taskId
* @param response
* @return
* @throws Exception
*/
@RequestMapping("/showCurrentView")
public ModelAndView showCurrentView(String taskId,HttpServletResponse response)throws Exception{
ModelAndView mav=new ModelAndView();
Task task=taskService.createTaskQuery() // 创建任务查询
.taskId(taskId) // 根据任务id查询
.singleResult();
String processDefinitionId=task.getProcessDefinitionId(); // 获取流程定义id
ProcessDefinition processDefinition=repositoryService.createProcessDefinitionQuery() // 创建流程定义查询
.processDefinitionId(processDefinitionId) // 根据流程定义id查询
.singleResult();
mav.addObject("deploymentId",processDefinition.getDeploymentId()); // 部署id
mav.addObject("diagramResourceName", processDefinition.getDiagramResourceName()); // 图片资源文件名称
ProcessDefinitionEntity processDefinitionEntity=(ProcessDefinitionEntity) repositoryService.getProcessDefinition(processDefinitionId);
String processInstanceId=task.getProcessInstanceId(); // 获取流程实例id
ProcessInstance pi=runtimeService.createProcessInstanceQuery() // 根据流程实例id获取流程实例
.processInstanceId(processInstanceId)
.singleResult();
ActivityImpl activityImpl=processDefinitionEntity.findActivity(pi.getActivityId()); // 根据活动id获取活动实例
mav.addObject("x", activityImpl.getX()); // x坐标
mav.addObject("y", activityImpl.getY()); // y坐标
mav.addObject("width", activityImpl.getWidth()); // 宽度
mav.addObject("height", activityImpl.getHeight()); // 高度
mav.setViewName("page/currentView");
return mav;
}
activiti中有任务id,获取当前流程节点的信息
最新推荐文章于 2024-10-11 18:04:22 发布