public JbpmConstantsElResolver(ScopeInstanceImpl scopeInstance) { if (scopeInstance instanceof ExecutionImpl) { this.execution = (ExecutionImpl) scopeInstance; this.processInstance = execution.getProcessInstance(); } else { this.task = (TaskImpl) scopeInstance; this.execution = task.getExecution(); if (this.execution != null) { this.processInstance = execution.getProcessInstance(); } } }
@Override // 默认销售负责人负责的工单列表 public String execute() throws Exception { List<Issue> dbIssues = new ArrayList<Issue>(); HttpSession session = request.getSession(); // 获取当前登录用户 User sessionUser = (User) session.getAttribute(LicenseWorkFlowConstants.SESSION_USER); // 获取流程定义列表 List<ProcessDefinition> pdList = issueService.getRepositoryService().createProcessDefinitionQuery().list(); // 获取流程实例列表 List<ProcessInstance> piList = issueService.getExecutionService().createProcessInstanceQuery().list(); // 获取该用户组内的任务 List<Task> taskList = issueService.getTaskService().findGroupTasks(sessionUser.getName()); // 查询库中所有的工单 dbIssues = issueService.getAllIssues(); // 获取流程寮例历史记录列表 List<HistoryProcessInstance> hplist = issueService.getHistoryService().createHistoryProcessInstanceQuery().list(); String processDefinitionId = ""; // 流程定义标识 if (pdList != null && pdList.size() > 0) { processDefinitionId = ((ProcessDefinition) (pdList.get(0))).getId(); } // 遍历系统中的工单 for (Issue issue : dbIssues) { // 设置工单的流程节点 String activeName = issueService.getActiveName(issue.getProcessInstanceId()); IssueVO issueVO = new IssueVO(); issueVO.setWorkFlowNodeName(activeName); // 遍历当前登录用户的task列表 for (Task task : taskList) { // 获取执行 Execution execution = issueService.getExecutionService().findExecutionById(task.getExecutionId()); ExecutionImpl execImpl = (ExecutionImpl) execution; // 获取执行的流程实例 ProcessInstance processInstance = execImpl.getProcessInstance(); if (issue.getProcessInstanceId().equals(processInstance.getId())) { // 显示审核链接 issueVO.setShowAudit(true); // 当前工单要审核的task issueVO.setIssueTask(task); break; } else { issueVO.setShowAudit(false); } } LicenseWorkFlowConstants.issuePOTOVOCopier.copy(issue, issueVO, null); issues.add(issueVO); } return "index"; }