// 查看详细内容 public Map<String, Object> view(String taskId, String piId) { if (taskId == null || "".equals(taskId)) { map = executionService.getVariables(piId, executionService.getVariableNames(piId)); } else { Set<String> set = taskService.getVariableNames(taskId); map = taskService.getVariables(taskId, set); } return map; }
// 审核 public String audit() throws Exception { TaskService taskService = issueService.getTaskService(); HttpSession session = request.getSession(); User sessionUser = (User) session.getAttribute(LicenseWorkFlowConstants.SESSION_USER); User user = userService.getById(sessionUser.getId()); Audit audit = new Audit(); // 审批意见 String groupName = ""; if (user.getGroups() != null && user.getGroups().size() > 0) { List<Group> groupList = new ArrayList<Group>(); groupList.addAll(user.getGroups()); groupName = groupList.get(0).getCnName(); } // 设置审核的部门名称 audit.setAuditDept(groupName); audit.setAuditNotion(auditNotion); // 审批意见 audit.setAuditTime(new Date()); // 审批时间 audit.setAuditUser(user); // 审批用户 String outcome = ""; // 边 if ("1".equals(result)) { outcome = "同意"; audit.setAuditResult("同意"); } else { outcome = "否决"; audit.setAuditResult("不同意"); } /** all the variables visible in the given task */ Set<String> set = taskService.getVariableNames(taskId); /** retrieves a map of variables */ Map<String, Object> variables = taskService.getVariables(taskId, set); if (issue.getId() == 0) throw new OceanRuntimeException("标识不合法"); // 获取工单 issue = issueService.getById(issue.getId()); variables.put("createUser", "admin"); // 执行任务 taskService.completeTask(taskId, outcome, variables); // 修改工单的审核信息 audit.setIssue(issue); Set<Audit> audits = issue.getAudits(); audits.add(audit); issue.setAudits(audits); issueService.saveOrUpdate(issue); // 更新到库中 return "indexAction"; }
// 驳回 public void reject(String taskId) { task = taskService.getTask(taskId); Set<String> set = taskService.getVariableNames(taskId); map = taskService.getVariables(taskId, set); map.put("reject", task.getAssignee()); // 驳回人 taskService.setVariables(task.getId(), map); execution = executionService.findExecutionById(task.getExecutionId()); if (execution.getProcessInstance().isActive("部门主管审批")) { // 部门主管不批准 taskService.completeTask(taskId, "To主管驳回"); } else if (execution.getProcessInstance().isActive("项目经理审批")) { // 项目经理不批准 taskService.completeTask(taskId, "To项目经理驳回"); } else if (execution.getProcessInstance().isActive("三级合议")) { // 总经理不批准的过程 taskService.completeTask(taskId, "To三级驳回"); } else if (execution.getProcessInstance().isActive("四级合议")) { // 四级议论 taskService.completeTask(taskId, "To四级驳回"); } else if (execution.getProcessInstance().isActive("最终决裁")) { // 五级审批 taskService.completeTask(taskId, "To最终驳回"); } else { taskService.completeTask(taskId); } }
// 进入开始审批的界面 public Map<String, Object> prepareJudge(String taskId) { Set<String> set = taskService.getVariableNames(taskId); map = taskService.getVariables(taskId, set); return map; }
// 根据任务编号查询流程变量 public Map<String, Object> reApply(String taskId) throws Exception { Set<String> set = taskService.getVariableNames(taskId); map = taskService.getVariables(taskId, set); return map; }