Example #1
0
 public String saveChoice() throws Exception {
   CompleteTaskTipType completeTaskTipType =
       taskService.completeTacheChoice(taskId, transitionName);
   this.addSuccessMessage(completeTaskTipType.getContent());
   ApiFactory.getBussinessLogService().log("工作流管理", "完成选择环节", ContextUtils.getSystemId("wf"));
   return input();
 }
Example #2
0
  /** 提交表单 */
  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;
  }
Example #3
0
 /**
  * 批量环节跳转功能
  *
  * @return
  * @throws Exception
  */
 @Action("task-volumeBack")
 public String volumeBack() throws Exception {
   String msg = "任务跳转成功";
   try {
     CompleteTaskTipType result = null;
     String[] wfids = workflowIds.split(",");
     result = taskService.taskJumps(wfids, backto, transactors, "volumeBack");
     switch (result) {
       case OK:
         msg = "OK";
         break;
       case RETURN_URL:
         msg = "RETURN_URL";
         break;
       case MESSAGE:
         msg = result.getContent();
     }
   } catch (Exception e) {
     PropUtils.getExceptionInfo(e);
     msg = "环节跳转失败";
   }
   ApiFactory.getBussinessLogService().log("流程监控", "执行批量环节跳转", ContextUtils.getSystemId("wf"));
   renderText(msg);
   return null;
 }
Example #4
0
 /**
  * 环节跳转功能
  *
  * @return
  * @throws Exception
  */
 public String goback() throws Exception {
   String msg = "任务跳转成功";
   try {
     CompleteTaskTipType result = null;
     workflowInstance = workflowInstanceManager.getWorkflowInstance(workflowId);
     result = taskService.taskJump(workflowInstance, backto, transactors, null, false);
     switch (result) {
       case OK:
         msg = "OK";
         break;
       case RETURN_URL:
         msg = "RETURN_URL";
         break;
       case SINGLE_TRANSACTOR_CHOICE:
         User temp;
         for (String tran : result.getCanChoiceTransactor()) {
           temp = userManager.getUserByLoginName(tran);
           if (temp != null)
             canChoiceTransacators = canChoiceTransacators + tran + "," + temp.getName() + ";";
         }
         msg = "SINGLE_TRANSACTOR_CHOICE";
         break;
       case MESSAGE:
         msg = result.getContent();
     }
   } catch (Exception e) {
     PropUtils.getExceptionInfo(e);
     msg = "环节跳转失败";
   }
   ApiFactory.getBussinessLogService().log("流程监控", "执行环节跳转", ContextUtils.getSystemId("wf"));
   renderText(msg + "=" + canChoiceTransacators);
   return null;
 }
Example #5
0
 /**
  * 完成分发
  *
  * @return
  * @throws Exception
  */
 public String distribute() throws Exception {
   CompleteTaskTipType completeTaskTipType =
       taskService.completeDistributeTask(taskId, transactors);
   if (CompleteTaskTipType.RETURN_URL == completeTaskTipType) {
     return assignTransactor();
   } else {
     this.addSuccessMessage(completeTaskTipType.getContent());
     task = taskService.getWorkflowTask(taskId);
     ApiFactory.getBussinessLogService().log("工作流管理", "完成分发任务", ContextUtils.getSystemId("wf"));
     return input();
   }
 }
Example #6
0
 /** 指定办理人 */
 @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;
 }
Example #7
0
  @SuppressWarnings("unchecked")
  public String start() throws Exception {
    log.debug("*** start 方法开始");
    log.debug(
        new StringBuilder("*** Received parameter:[")
            .append("processId:")
            .append(processId)
            .append("]")
            .toString());

    WorkflowDefinition wdf = workflowDefinitionManager.getWorkflowDefinitionByProcessId(processId);
    String wfdName = wdf.getName();
    String url =
        Struts2Utils.getRequest()
            .getRequestURL()
            .toString()
            .replaceFirst("task!start", "task!input");
    Map<String, String> urlMap = new HashMap<String, String>();
    urlMap.put(wfdName, url);
    Integer priority = 6;
    Map<String, String[]> parameterMap = Struts2Utils.getRequest().getParameterMap();
    String[] urgency = parameterMap.get(URGENCY);
    if (urgency != null && urgency.length > 0 && StringUtils.isNotEmpty(urgency[0]))
      priority = Integer.valueOf(urgency[0]);
    String to = "";
    CompleteTaskTipType result =
        workflowInstanceManager.startAndSubmitWorkflow(processId, urlMap, priority, null);
    switch (result) {
      case OK:
        this.addSuccessMessage(result.getContent());
        to = null;
        break;
      case MESSAGE:
        this.addErrorMessage(result.getContent());
        to = null;
        break;
      case RETURN_URL:
        to = assignTransactor();
        break;
    }
    ApiFactory.getBussinessLogService().log("工作流管理", "发起流程", ContextUtils.getSystemId("wf"));
    return to;
  }
Example #8
0
 public String saveChoicePop() throws Exception {
   CompleteTaskTipType completeTaskTipType =
       taskService.completeTacheChoice(taskId, transitionName);
   String to = "";
   switch (completeTaskTipType) {
     case OK:
       to = "OK:" + completeTaskTipType.getContent();
       break;
     case MESSAGE:
       to = "MS:" + completeTaskTipType.getContent();
       break;
     case RETURN_URL:
       String url = completeTaskTipType.getContent();
       if (url.equals(TaskService.DEFAULT_URL)) url = url + "?taskId=" + task.getId();
       to = "RU:" + url;
       break;
     case TACHE_CHOICE_URL:
       to = "TC:" + completeTaskTipType.getContent();
       break;
   }
   ApiFactory.getBussinessLogService().log("工作流管理", "完成选择环节任务", ContextUtils.getSystemId("wf"));
   this.renderText(to);
   return null;
 }
Example #9
0
 /** 保存任务 */
 @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;
 }