/** 提交表单 */ public String submit() throws Exception { log.debug("*** submit 方法开始"); log.debug( new StringBuilder("*** Received parameter:[") .append("taskId:") .append(taskId) .append("]") .toString()); task = taskService.getWorkflowTask(taskId); String to = ""; CompleteTaskTipType result = workflowInstanceManager.submitForm(task); switch (result) { case OK: this.addSuccessMessage(result.getContent()); to = input(); break; case MESSAGE: this.addErrorMessage(result.getContent()); to = INPUT; break; case RETURN_URL: to = assignTransactor(); break; case TACHE_CHOICE_URL: canChoiceTaches = result.getCanChoiceTaches(); to = choiceTache(); break; } ApiFactory.getBussinessLogService().log("工作流管理", "提交表单", ContextUtils.getSystemId("wf")); return to; }
/** 指定办理人 */ @Action(value = "taskassign") public String assignTransactor() throws Exception { String to = INPUT; if (task.getId() == null) { this.addErrorMessage("非法的任务"); } else { WorkflowInstance instance = workflowInstanceManager.getWorkflowInstance(task.getProcessInstanceId()); CompleteTaskTipType result = taskService.isNeedAssigningTransactor(instance, task); if (result == null) { result = taskService.isSubProcessNeedChoiceTransactor(task, instance); } switch (result) { case OK: this.addSuccessMessage(result.getContent()); to = input(); break; case MESSAGE: this.addErrorMessage(result.getContent()); to = INPUT; break; case RETURN_URL: candidates = taskService.getNextTasksCandidates(task); this.addErrorMessage("请选择办理人"); to = "assign"; break; case TACHE_CHOICE_URL: addActionMessage("请选择环节"); canChoiceTaches = result.getCanChoiceTaches(); to = choiceTache(); case SINGLE_TRANSACTOR_CHOICE: User temp; for (String tran : result.getCanChoiceTransactor()) { temp = userManager.getUserByLoginName(tran); if (temp != null) canChoiceTransactor.put(tran, temp.getName()); } moreTransactor = CompleteTaskTipType.SINGLE_TRANSACTOR_CHOICE.getContent().equals("true"); to = "singleTransactorChoice"; } } ApiFactory.getBussinessLogService().log("工作流管理", "指定办理人", ContextUtils.getSystemId("wf")); return to; }
/** 保存任务 */ @Override public String save() throws Exception { log.debug("*** save 办理任务方法开始"); log.debug( new StringBuilder("*** Received parameter:[") .append("task:") .append(task) .append("]") .toString()); ApiFactory.getBussinessLogService().log("工作流管理", "保存任务", ContextUtils.getSystemId("wf")); // 如果为分发环节,指定被分发人 if (TaskProcessingMode.TYPE_DISTRIBUTE.toString().equals(task.getProcessingMode().toString())) { return "distribute"; } // 如果为交办环节,指定被交办人 if (task.getActive() == 0 && TaskProcessingMode.TYPE_ASSIGN.toString().equals(task.getProcessingMode().toString())) { moreTransactor = true; workflowInstanceManager.saveData(task, null); return "assignTree"; } // 如果已经办理但没有指定办理人 if (task.getActive() == 1 && task.getProcessingMode() != TaskProcessingMode.TYPE_ASSIGN) { return assignTransactor(); } String to = ""; try { CompleteTaskTipType result = taskService.completeWorkflowTaskAndSaveData( task, transact, TaskSetting.getTaskSettingInstance() .setTransitionName(transitionName) .setAssignmentTransactors(newTransactor)); switch (result) { case OK: this.addSuccessMessage(result.getContent()); to = input(); break; case MESSAGE: this.addErrorMessage(result.getContent()); to = INPUT; break; case RETURN_URL: to = assignTransactor(); break; case TACHE_CHOICE_URL: addActionMessage("请选择环节"); canChoiceTaches = result.getCanChoiceTaches(); to = choiceTache(); break; case SINGLE_TRANSACTOR_CHOICE: User temp; for (String tran : result.getCanChoiceTransactor()) { temp = userManager.getUserByLoginName(tran); if (temp != null) canChoiceTransactor.put(tran, temp.getName()); } moreTransactor = CompleteTaskTipType.SINGLE_TRANSACTOR_CHOICE.getContent().equals("true"); to = "singleTransactorChoice"; } } catch (TransactorAssignmentException e) { nullAssignmentException = "下一环节没有办理人,请指定!"; return "assignmentTree"; } catch (DecisionException de) { transitionNames = de.getTransitionNames(); messageTip = de.getMessage(); messageTip = getText(messageTip); return input(); } return to; }