Map<String, Object> map = new HashMap<String,Object>(); //使用任務ID,查詢任務對象 Task task = taskService.createTaskQuery()// .taskId(taskId)//使用任務ID查詢 .singleResult(); //獲取流程定義的ID String processDefinitionId = task.getProcessDefinitionId(); //獲取流程定義的實體對象(對應.bpmn文件中的數據) ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity)repositoryService.getProcessDefinition(processDefinitionId); //流程實例ID String processInstanceId = task.getProcessInstanceId(); //使用流程實例ID,查詢正在執行的執行對象表,獲取當前活動對應的流程實例對象 ProcessInstance pi = runtimeService.createProcessInstanceQuery()//建立流程實例查詢 .processInstanceId(processInstanceId)//使用流程實例ID查詢 .singleResult(); //獲取當前活動的ID String activityId = pi.getActivityId(); //獲取當前活動對象 ActivityImpl activityImpl = processDefinitionEntity.findActivity(activityId);//活動ID //獲取座標 map.put("x", activityImpl.getX()); map.put("y", activityImpl.getY()); map.put("width", activityImpl.getWidth()); map.put("height", activityImpl.getHeight());