Example #1
0
 /** 流程监控 减少办理人 */
 public String delTransactor() throws Exception {
   WorkflowInstance instance = null;
   if (instanceId != null) instance = workflowInstanceManager.getWorkflowInstance(instanceId);
   else instance = workflowInstanceManager.getWorkflowInstance(workflowId);
   workflowId = instance.getProcessInstanceId();
   boolean isForkTask = taskService.isForkTask(workflowId);
   if (!isForkTask) { // 表示是分支汇聚任务时不让减少办理人
     List<String[]> currentTransactors = taskService.getActivityTaskTransactors(workflowId);
     List<String> currentPrincipals = taskService.getActivityTaskPrincipals(workflowId);
     if (currentTransactors != null) {
       if (currentTransactors.size() == 1) {
         Object[] transactors = currentTransactors.get(0);
         transactor = (transactors[1]).toString();
       }
       transactorNum = currentTransactors.size();
     }
     if (currentPrincipals != null) {
       if (transactorNum == 0 && currentPrincipals.size() == 1) {
         String loginName = currentPrincipals.get(0);
         User user = acsUtils.getUserByLoginName(loginName);
         if (user != null) {
           transactor = user.getName();
         }
       }
       transactorNum = transactorNum + currentPrincipals.size();
     }
   }
   // 判断当前环节是否是子流程
   hasActivitySubProcess = taskService.getActivetySubProcess(instance.getProcessInstanceId());
   return "delTransactor";
 }
Example #2
0
 /**
  * 完成交办
  *
  * @return
  * @throws Exception
  */
 public String assignTo() throws Exception {
   task = taskService.getWorkflowTask(taskId);
   newTransactor = transactors.toString().replace(" ", "").replace("[", "").replace("]", "");
   taskService.completeWorkflowTask(
       task,
       TaskProcessingResult.ASSIGN,
       TaskSetting.getTaskSettingInstance().setAssignmentTransactors(newTransactor));
   ApiFactory.getBussinessLogService().log("工作流管理", "完成交办任务", ContextUtils.getSystemId("wf"));
   this.addSuccessMessage("任务交办成功");
   return input();
 }
Example #3
0
 /**
  * 流程监控/保存更改的办理人
  *
  * @return
  * @throws Exception
  */
 public String changeTransactorSave() throws Exception {
   taskService.changeTransactor(taskId, transactor);
   task = taskService.getWorkflowTask(taskId);
   workflowId = task.getProcessInstanceId();
   workflowInstance = workflowInstanceManager.getWorkflowInstance(workflowId);
   // 更改办理人业务补偿
   taskService.changeTransactorSet(workflowInstance, transactor, task.getId());
   ApiFactory.getBussinessLogService().log("流程监控", "更改办理人", ContextUtils.getSystemId("wf"));
   this.addSuccessMessage("办理人已更改");
   return changeTransactor();
 }
Example #4
0
 /** 流程监控 增加办理人 */
 public String addTransactor() throws Exception {
   if (instanceId != null)
     workflowInstance = workflowInstanceManager.getWorkflowInstance(instanceId);
   else workflowInstance = workflowInstanceManager.getWorkflowInstance(workflowId);
   workflowId = workflowInstance.getProcessInstanceId();
   forkTask = taskService.isForkTask(workflowId);
   // 判断当前环节是否是子流程
   hasActivitySubProcess =
       taskService.getActivetySubProcess(workflowInstance.getProcessInstanceId());
   return "addTransactor";
 }
Example #5
0
 /** 流程监控 更改办理人 */
 public String changeTransactor() throws Exception {
   if (instanceId != null)
     workflowInstance = workflowInstanceManager.getWorkflowInstance(instanceId);
   else workflowInstance = workflowInstanceManager.getWorkflowInstance(workflowId);
   taskList =
       taskService.getActivityTasks(
           workflowInstance.getProcessInstanceId(), ContextUtils.getCompanyId());
   // 判断当前环节是否是子流程
   hasActivitySubProcess =
       taskService.getActivetySubProcess(workflowInstance.getProcessInstanceId());
   return "changeTransactor";
 }
Example #6
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();
   }
 }
  // 我接收的流程
  @Action("tree-delegateAccept")
  public String delegateAccept() throws Exception {
    List<ZTreeNode> treeNodes = new ArrayList<ZTreeNode>();
    String name = getText("workflow.doing") + "(" + taskService.getAcceptTasksNum(false) + ")";
    ZTreeNode root = new ZTreeNode("ACC_ING", "0", name, "false", "false", "", "", "folder", "");
    treeNodes.add(root);

    name = getText("workflow.complete") + "(" + taskService.getAcceptTasksNum(true) + ")";
    root = new ZTreeNode("ACC_END", "0", name, "false", "false", "", "", "folder", "");
    treeNodes.add(root);
    renderText(JsonParser.object2Json(treeNodes));
    return null;
  }
Example #8
0
 /** 处理任务 */
 @Override
 public String input() throws Exception {
   log.debug("*** input 处理任务方法开始");
   log.debug(
       new StringBuilder("*** Received parameter:[")
           .append("task:")
           .append(task)
           .append("]")
           .toString());
   taskService.updateTaskIsRead(task);
   workflowId = task.getProcessInstanceId();
   workflowInstance = workflowInstanceManager.getWorkflowInstance(workflowId);
   opinions = workflowInstanceManager.getOpinions(taskId, task.getCompanyId());
   if (workflowRightsManager.mustOpinionRight(BeanUtil.turnToModelTask(task))
       && (opinions == null || opinions.size() <= 0)) {
     must = true;
   }
   StringBuilder builder = new StringBuilder();
   builder
       .append("<input type=\"hidden\" name=\"dataId\" value=\"")
       .append(workflowInstance.getDataId())
       .append("\"/>");
   formHtml =
       workflowInstanceManager.getHtml(
           workflowInstance.getProcessDefinitionId(),
           workflowInstance.getFormId(),
           workflowInstance.getDataId(),
           task.getName());
   formHtml = builder.toString() + formHtml;
   if (TaskState.COMPLETED.getIndex().equals(task.getActive())
       || TaskState.CANCELLED.getIndex().equals(task.getActive())) {
     // 列表控件控制
     formHtml =
         workflowInstanceManager.getFormHtml(
             workflowInstance, formHtml, workflowInstance.getDataId(), false, false);
     fieldPermission = workflowRightsManager.getFieldPermission(false);
   } else if (TaskState.WAIT_CHOICE_TACHE.getIndex().equals(task.getActive())) {
     canChoiceTaches = taskService.isNeedChoiceTache(task, workflowInstance).getCanChoiceTaches();
     return choiceTache();
   } else {
     // 列表控件控制
     formHtml =
         workflowInstanceManager.getFormHtml(
             workflowInstance, formHtml, workflowInstance.getDataId(), true, false);
     fieldPermission = ApiFactory.getFormService().getFieldPermission(task.getId());
   }
   ApiFactory.getBussinessLogService().log("工作流管理", "任务办理页面", ContextUtils.getSystemId("wf"));
   log.debug("*** input 处理任务方法结束");
   return INPUT;
 }
Example #9
0
 public void prepareSaveForm() throws Exception {
   if (taskId != null) {
     task = taskService.getWorkflowTask(taskId);
   } else {
     task = new WorkflowTask();
   }
 }
Example #10
0
 public void reminder(List<WorkflowTask> tasks) {
   try {
     for (WorkflowTask task : tasks) {
       if (neetReminder(task)) {
         if (task.getReminderLimitTimes() != 0
             && task.getReminderLimitTimes().equals(task.getAlreadyReminderTimes())) {
           if (StringUtils.isNotEmpty(task.getReminderNoticeStyle())) {
             informSettingUser(task);
           }
         }
         if (task.getReminderLimitTimes() == 0
             || task.getReminderLimitTimes() > task.getAlreadyReminderTimes()) {
           if (StringUtils.isNotEmpty(task.getReminderStyle())) {
             reminder(task);
           }
           task.setLastReminderTime(new Date(System.currentTimeMillis()));
           task.setAlreadyReminderTimes(task.getAlreadyReminderTimes() + 1);
         }
       }
     }
     taskService.saveTasks(tasks);
   } catch (Exception e) {
     log.error("定时催办异常:" + e.getMessage());
   }
 }
Example #11
0
  /**
   * 流程监控/保存增加的办理人
   *
   * @return
   * @throws Exception
   */
  public String addTransactorSave() throws Exception {
    taskService.addTransactor(workflowId, transactors);

    ApiFactory.getBussinessLogService().log("流程监控", "增加办理人", ContextUtils.getSystemId("wf"));
    this.addSuccessMessage("办理人已增加");
    return addTransactor();
  }
Example #12
0
  @Transactional(readOnly = false)
  public void run() throws Exception {
    List<Company> companys = acsUtils.getAllCompanys();
    for (Company company : companys) {
      ThreadParameters parameters = new ThreadParameters(company.getId());
      ParameterUtils.setParameters(parameters);
      String systemAdmin = ApiFactory.getAcsService().getSystemAdminLoginName();
      parameters = new ThreadParameters(company.getId());
      parameters.setUserName("系统");
      parameters.setLoginName(systemAdmin);
      ParameterUtils.setParameters(parameters);

      // 委托
      delegateMain();

      // 催办
      List<WorkflowTask> result = new ArrayList<WorkflowTask>();
      result.addAll(workflowInstanceManager.getNeedReminderTasksByInstance());
      result.addAll(taskService.getNeedReminderTasks());
      reminder(result);
    }
    deleteExportTempFile();

    // 清空同步处理时的实例map,见TaskService中的completeInteractiveWorkflowTask方法
    TaskService.instanceIds.clear();
  }
Example #13
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 #14
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 #15
0
 @Override
 protected void prepareModel() throws Exception {
   if (taskId != null) {
     task = taskService.getWorkflowTask(taskId);
   } else {
     task = new WorkflowTask();
   }
 }
Example #16
0
 public String choiceTachePop() throws Exception {
   if (canChoiceTaches == null) {
     workflowInstance = workflowInstanceManager.getWorkflowInstance(task.getProcessInstanceId());
     canChoiceTaches = taskService.isNeedChoiceTache(task, workflowInstance).getCanChoiceTaches();
   }
   ApiFactory.getBussinessLogService().log("工作流管理", "弹出选择环节页面", ContextUtils.getSystemId("wf"));
   return "choiceUrlPop";
 }
Example #17
0
 public String assignTransactorPop() throws Exception {
   if (task.getId() == null) {
     this.addErrorMessage("非法的任务");
   } else {
     candidates = taskService.getNextTasksCandidates(task);
     this.addErrorMessage("请选择办理人");
   }
   ApiFactory.getBussinessLogService().log("工作流管理", "弹出指定办理人", ContextUtils.getSystemId("wf"));
   return "assignPop";
 }
Example #18
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 #19
0
  /**
   * 设置办理人
   *
   * @return
   * @throws Exception
   */
  public String setTransactor() throws Exception {
    log.debug("*** setTransactor 办理任务方法开始");

    Map<String, List<String>> taskCondidates = new HashMap<String, List<String>>();
    for (String taskId : targetNames) {
      String[] condidates =
          Struts2Utils.getRequest().getParameterValues("targetTransactors_" + taskId);
      List<String> condidateList = new ArrayList<String>();
      for (String condidate : condidates) {
        condidateList.add(condidate.split("_")[0]);
      }
      taskCondidates.put(taskId, condidateList);
    }
    taskService.setTasksTransactor(taskId, taskCondidates);
    task = taskService.getTask(taskId);
    ApiFactory.getBussinessLogService().log("工作流管理", "设置办理人", ContextUtils.getSystemId("wf"));
    this.addSuccessMessage("任务已完成");
    log.debug("*** setTransactor 方法结束");
    return view();
  }
  // 移交任务
  @Action("transfer-task-tree")
  public String transferTaskTree() throws Exception {
    List<ZTreeNode> treeNodes = new ArrayList<ZTreeNode>();
    String name =
        getText("workflow.doing")
            + "("
            + taskService.getTransferTaskNum(ContextUtils.getUserId(), false)
            + ")";
    ZTreeNode root =
        new ZTreeNode("TRANSFER_ING", "0", name, "false", "false", "", "", "folder", "");
    treeNodes.add(root);

    name =
        getText("workflow.complete")
            + "("
            + taskService.getTransferTaskNum(ContextUtils.getUserId(), true)
            + ")";
    root = new ZTreeNode("TRANSFER_END", "0", name, "false", "false", "", "", "folder", "");
    treeNodes.add(root);
    renderText(JsonParser.object2Json(treeNodes));
    return null;
  }
  // 我委托的流程
  @Action("tree-delegateMonitor")
  public String delegateMonitor() throws Exception {
    List<ZTreeNode> treeNodes = new ArrayList<ZTreeNode>();
    String name =
        getText("workflow.doing")
            + "("
            + taskService.getDelegateTasksNum(
                getCompanyId(), getCurrentUser(), ContextUtils.getUserId(), false)
            + ")";
    ZTreeNode root = new ZTreeNode("DEL_ING", "0", name, "false", "false", "", "", "folder", "");
    treeNodes.add(root);

    name =
        getText("workflow.complete")
            + "("
            + taskService.getDelegateTasksNum(
                getCompanyId(), getCurrentUser(), ContextUtils.getUserId(), true)
            + ")";
    root = new ZTreeNode("DEL_END", "0", name, "false", "false", "", "", "folder", "");
    treeNodes.add(root);
    renderText(JsonParser.object2Json(treeNodes));
    return null;
  }
  // 我受托的流程
  @Action("tree-superviseAsTrusteeTree")
  public String superviseAsTrusteeTree() throws Exception {
    List<ZTreeNode> treeNodes = new ArrayList<ZTreeNode>();
    String name =
        getText("workflow.doing")
            + "("
            + taskService.getTrusteeTasksNum(
                getCompanyId(), getCurrentUser(), ContextUtils.getUserId(), false)
            + ")";
    ZTreeNode root =
        new ZTreeNode("TRUSTEE_ING", "0", name, "false", "false", "", "", "folder", "");
    treeNodes.add(root);

    name =
        getText("workflow.complete")
            + "("
            + taskService.getTrusteeTasksNum(
                getCompanyId(), getCurrentUser(), ContextUtils.getUserId(), true)
            + ")";
    root = new ZTreeNode("TRUSTEE_END", "0", name, "false", "false", "", "", "folder", "");
    treeNodes.add(root);
    renderText(JsonParser.object2Json(treeNodes));

    //		StringBuilder tree = new StringBuilder("[ ");
    //		tree.append(JsTreeUtils.generateJsTreeNodeDefault("TRUSTEE_ING", null,
    //				getText("workflow.doing") + "(" +
    //				taskService.getTrusteeTasksNum(getCompanyId(), getCurrentUser(),ContextUtils.getUserId(),
    // false) + ")" )).append(",");
    //		tree.append(JsTreeUtils.generateJsTreeNodeDefault("TRUSTEE_END", null,
    //				getText("workflow.complete") + "(" +
    //				taskService.getTrusteeTasksNum(getCompanyId(), getCurrentUser(),
    // ContextUtils.getUserId(),true) + ")" ));
    //
    //	tree.append(" ]");
    return null;
  }
Example #23
0
 public String delTransactorTree() throws Exception {
   StringBuilder tempTree = new StringBuilder();
   StringBuilder tree = new StringBuilder();
   tree.append("[");
   tree.append("{\"attr\":{")
       .append(JsTreeUtil1.treeAttrBefore)
       .append("company_company-company")
       .append(JsTreeUtil1.treeAttrMiddle)
       .append("company")
       .append(JsTreeUtil1.treeAttrAfter)
       .append("},\"state\":\"open\",\"data\":\"" + ContextUtils.getCompanyName() + "\"");
   // List<String[]> currentTransactors=taskService.getActivityTaskTransactors(workflowId);
   // List<String> currentPrincipals=taskService.getActivityTaskPrincipals(workflowId);
   taskList = taskService.getActivityTasks(workflowId, ContextUtils.getCompanyId());
   int transactNum = taskList.size();
   if (transactNum > 1) {
     tempTree.append(",\"children\":");
     tempTree.append("[");
     for (WorkflowTask t : taskList) {
       if (StringUtils.isEmpty(t.getTrustorName())) {
         tempTree
             .append(
                 JsTreeUtil1.generateJsTreeNodeNew(
                     "user_" + t.getTransactorName() + "-" + t.getTransactor(),
                     "",
                     t.getTransactorName(),
                     "user"))
             .append(",");
       } else {
         tempTree
             .append(
                 JsTreeUtil1.generateJsTreeNodeNew(
                     "user_" + t.getTransactorName() + "-" + t.getTransactor(),
                     "",
                     t.getTransactorName() + "(受托于" + t.getTrustorName() + ")",
                     "user"))
             .append(",");
       }
     }
     tree.append(delComma(tempTree.toString()));
     tree.append("]");
   }
   tree.append("}");
   tree.append("]");
   renderText(tree.toString());
   return null;
 }
Example #24
0
  @Transactional(readOnly = false)
  public void delegateMain() {
    try {
      // 权限委托
      List<TrustRecord> delegateMains = delegateMainManager.getDelegateMainsOnAssign();
      for (TrustRecord dm : delegateMains) {
        com.norteksoft.product.api.entity.User trustee =
            ApiFactory.getAcsService().getUserByLoginName(dm.getTrustee()); // 受托人
        com.norteksoft.product.api.entity.User trustor =
            ApiFactory.getAcsService().getUserByLoginName(dm.getTrustor()); // 委托人
        if (needEfficient(dm)) {
          ApiFactory.getAcsService()
              .assignTrustedRole(trustor.getId(), dm.getRoleIds().split(","), trustee.getId());
          dm.setState(TrustRecordState.EFFICIENT);
          delegateMainManager.saveDelegateMain(dm);
        }
        if (needEnd(dm)) {
          ApiFactory.getAcsService()
              .deleteTrustedRole(trustor.getId(), dm.getRoleIds().split(","), trustee.getId());
          dm.setState(TrustRecordState.END);
          delegateMainManager.saveDelegateMain(dm);
        }
      }

      // 流程委托
      List<TrustRecord> workflowDelegateMains =
          delegateMainManager.getAllStartWorkflowDelegateMain();
      for (TrustRecord wfdm : workflowDelegateMains) {
        if (needEfficient(wfdm)) {
          wfdm.setState(TrustRecordState.EFFICIENT);
          delegateMainManager.saveDelegateMain(wfdm);
        }
        if (needEnd(wfdm)) {
          wfdm.setState(TrustRecordState.END);
          delegateMainManager.saveDelegateMain(wfdm);
          // 委托结束时取回任务
          taskService.recieveDelegateTask(wfdm);
        }
      }
    } catch (Exception e) {
      log.error("定时委托异常:" + e.getMessage());
    }
  }
Example #25
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 #26
0
 /** 减签 */
 public String deleteTask() throws Exception {
   taskService.deleteWorkflowTask(ids);
   ApiFactory.getBussinessLogService().log("工作流平台", "减签", ContextUtils.getSystemId("wf"));
   return deleteCountersign();
 }
Example #27
0
 /** 转向减签页面 */
 public String deleteCountersign() throws Exception {
   taskList = taskService.getProcessCountersigns(taskId);
   return "deleteCountersign";
 }
Example #28
0
 /** 加签 */
 public String addTask() throws Exception {
   taskService.generateTask(taskId, transactors, TaskSource.ADD_SIGN, true);
   ApiFactory.getBussinessLogService().log("工作流平台", "加签", ContextUtils.getSystemId("wf"));
   return null;
 }
Example #29
0
 public String completeChoiceTransactor() throws Exception {
   taskService.completeChoiceTransactor(taskId, transactors);
   ApiFactory.getBussinessLogService().log("工作流管理", "指定办理人", ContextUtils.getSystemId("wf"));
   addActionMessage("办理人指定成功!");
   return input();
 }
Example #30
0
 /**
  * 取回任务
  *
  * @return
  * @throws Exception
  */
 public String getBack() throws Exception {
   retrieveResult = taskService.retrieve(taskId);
   ApiFactory.getBussinessLogService().log("工作流管理", "取回任务", ContextUtils.getSystemId("wf"));
   return input();
 }