TaskManager taskManager = commandContext.getTaskManager();
if(taskId==null||taskId.equals("")){
throw new FixFlowBizException("taskId 不能为空");
}
TaskInstance taskInstanceQuery = taskManager.findTaskById(taskId);
String tokenId = taskInstanceQuery.getTokenId();
String processDefinitionId = taskInstanceQuery.getProcessDefinitionId();
ProcessInstanceManager processInstanceManager = commandContext.getProcessInstanceManager();
String processInstanceId = taskInstanceQuery.getProcessInstanceId();
ProcessDefinitionManager processDefinitionManager = commandContext.getProcessDefinitionManager();
ProcessDefinitionBehavior processDefinition = processDefinitionManager.findLatestProcessDefinitionById(processDefinitionId);
ProcessInstanceEntity processInstanceImpl = processInstanceManager.findProcessInstanceById(processInstanceId, processDefinition);
TokenEntity token=processInstanceImpl.getTokenMap().get(tokenId);
List<String> tokenIdList=new ArrayList<String>();
addTokenParent(token, tokenIdList);
//获取这个节点关系上之前的所有人工任务(UserTask)
Map<String,FlowNode> flowNodes=CoreUtil.getBeforeFlowNode(token.getFlowNode());
//获取这个令牌自己和爸爸相关的所有任务
TaskQuery taskQuery=new TaskQueryImpl(Context.getCommandContext());
List<TaskInstance> taskInstanceQueryToList = new ArrayList<TaskInstance>();
taskQuery.processInstanceId(processInstanceId);
taskQuery.taskIsEnd().orderByEndTime().asc().orderByTaskCreateTime().asc();
taskInstanceQueryToList = taskQuery.list();
List<String> processInstanceIdList=new ArrayList<String>();
processInstanceIdList.add(token.getProcessInstanceId());
taskManager.getTaskStatusByByProcessInstanceIdList(processInstanceIdList);
//List<TaskInstance> taskInstanceQueryToList=(List)taskManager.findTasksByTokenIdList(tokenIdList);
List<TaskInstance> taskInstanceQueryToListNew=new ArrayList<TaskInstance>();
//Map<String, TaskInstance> taskMap=new HashMap<String, TaskInstance>();
//TaskInstance previousTaskInstance=null;
Map<String, String> pcNodeMap= new HashMap<String, String>();
String tempString=taskInstanceQuery.getNodeId()+Authentication.getAuthenticatedUserId();
for (int i = 0; i < taskInstanceQueryToList.size(); i++) {
TaskInstance taskInstance=taskInstanceQueryToList.get(i);
if(flowNodes.get(taskInstance.getNodeId())!=null&&!taskInstance.getId().equals(this.taskId)){
if(!tempString.equals(taskInstance.getNodeId()+taskInstance.getAssignee())){
//taskInstanceQueryToListNew.add(taskInstance);
if(pcNodeMap.get(taskInstance.getNodeId()+taskInstance.getAssignee())==null){
taskInstanceQueryToListNew.add(taskInstance);
pcNodeMap.put(taskInstance.getNodeId()+taskInstance.getAssignee(), "");
}
//taskMap.put(taskInstance.getNodeId(), taskInstance);
}