/**
   * 保存工作组添加用户
   *
   * @return
   * @throws Exception
   */
  @Action("work-group-workgroupAddUser")
  public String workgroupAddUser() throws Exception {
    if (StringUtils.isNotEmpty(ids)) {
      userIds = new ArrayList<Long>();
      User user = userManager.getUserById(ContextUtils.getUserId());
      if ("ALLCOMPANYID".equals(ids)) { // 全公司
        userIds.add(0l);
      } else {
        if (roleManager.hasSystemAdminRole(user)) {
          for (String str : ids.split(",")) {
            userIds.add(Long.valueOf(str));
          }
        } else if (roleManager.hasBranchAdminRole(user)) {
          userIds = ApiFactory.getAcsService().getTreeUserIds(ids);
        }
      }

      String addUsers = workGroupManager.workgroupAddUser(workGroupId, userIds, 0);

      if (StringUtils.isNotEmpty(addUsers))
        ApiFactory.getBussinessLogService()
            .log("工作组管理", "工作组添加人员:" + addUsers, ContextUtils.getSystemId("acs"));
    }
    this.renderText("ok");
    return null;
  }
Пример #2
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;
 }
Пример #3
0
 public String saveChoice() throws Exception {
   CompleteTaskTipType completeTaskTipType =
       taskService.completeTacheChoice(taskId, transitionName);
   this.addSuccessMessage(completeTaskTipType.getContent());
   ApiFactory.getBussinessLogService().log("工作流管理", "完成选择环节", ContextUtils.getSystemId("wf"));
   return input();
 }
Пример #4
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;
  }
Пример #5
0
  /**
   * 意见
   *
   * @return
   * @throws Exception
   */
  public String opinion() throws Exception {
    // workflowInstance = workflowInstanceManager.getWorkflowInstance(workflowId);

    // authority(workflowInstance.getProcessDefinitionId(),task.getName());

    // if(view){
    // opinions =
    // workflowInstanceManager.getOpinionsByInstanceId(workflowInstance.getProcessInstanceId(),companyId);
    // }
    if (taskId == null) {
      view = true;
    } else {
      task = taskService.getWorkflowTask(taskId);
      if (task.getActive() == 2) {
        edit = false;
      }
    }
    workflowInstance = workflowInstanceManager.getWorkflowInstance(workflowId);
    opinions = workflowInstanceManager.getOpinions(taskId, task.getCompanyId());
    if (workflowRightsManager.mustOpinionRight(BeanUtil.turnToModelTask(task))
        && (opinions == null || opinions.size() <= 0)) {
      must = true;
    } else {
      must = false;
    }
    companyId = ContextUtils.getCompanyId();
    ApiFactory.getBussinessLogService().log("流程汇编", "意见列表", ContextUtils.getSystemId("wf"));
    return "opinion";
  }
Пример #6
0
 private String preView(String operate) {
   log.debug("*** preView 方法开始");
   log.debug(
       new StringBuilder("*** Received parameter:[")
           .append("task:")
           .append(task)
           .append("]")
           .toString());
   workflowInstance = workflowInstanceManager.getWorkflowInstance(task.getProcessInstanceId());
   workflowId = task.getProcessInstanceId();
   StringBuilder builder = new StringBuilder();
   builder
       .append("<input type=\"hidden\" name=\"dataId\" value=\"")
       .append(workflowInstance.getDataId())
       .append("\"/>");
   FormView form = formViewManager.getFormView(workflowInstance.getFormId());
   formHtml =
       workflowInstanceManager.setValueForHtml(workflowInstance.getDataId(), form, form.getHtml());
   formHtml = builder.toString() + formHtml;
   if (SAVE.equals(operate)) {
     formHtml =
         workflowInstanceManager.getFormHtml(
             workflowInstance, formHtml, workflowInstance.getDataId(), true, false);
     fieldPermission = ApiFactory.getFormService().getFieldPermission(task.getId());
   } else {
     formHtml =
         workflowInstanceManager.getFormHtml(
             workflowInstance, formHtml, workflowInstance.getDataId(), false, false);
     fieldPermission = workflowRightsManager.getFieldPermission(false);
   }
   ApiFactory.getBussinessLogService().log("工作流管理", "查看已完成任务", ContextUtils.getSystemId("wf"));
   log.debug("*** preView 方法结束");
   return "view";
 }
Пример #7
0
 /**
  * 批量环节跳转/选择环节
  *
  * @return
  * @throws Exception
  */
 @Action("task-volumeBackView")
 public String volumeBackView() throws Exception {
   String[] str = instanceIds.split(",");
   workflowIds = "";
   for (String s : str) {
     workflowInstance = workflowInstanceManager.getWorkflowInstance(Long.valueOf(s));
     if (workflowInstance != null) wfdId = workflowInstance.getWorkflowDefinitionId();
     workflowId = workflowInstance.getProcessInstanceId();
     boolean isForkTask = taskService.isForkTask(workflowId);
     if (!isForkTask) { // 当前任务是分支汇聚任务时不让跳转
       List<String> temp = taskService.getTaskNames(workflowId);
       if (temp != null && temp.size() > 0) {
         if (StringUtils.isNotEmpty(workflowIds)) {
           workflowIds += ",";
         }
         canBackTo = temp;
         workflowIds += workflowId;
       }
     } else {
       break;
     }
   }
   if (canBackTo == null) {
     canBackTo = new ArrayList<String>();
   }
   ApiFactory.getBussinessLogService().log("流程监控", "批量环节跳转选择环节页面", ContextUtils.getSystemId("wf"));
   return SUCCESS;
 }
Пример #8
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;
 }
Пример #9
0
  /**
   * 流程监控/保存增加的办理人
   *
   * @return
   * @throws Exception
   */
  public String addTransactorSave() throws Exception {
    taskService.addTransactor(workflowId, transactors);

    ApiFactory.getBussinessLogService().log("流程监控", "增加办理人", ContextUtils.getSystemId("wf"));
    this.addSuccessMessage("办理人已增加");
    return addTransactor();
  }
 @Override
 public String save() throws Exception {
   workGroupManager.saveWorkGroup(workGroup);
   addActionMessage("保存工作组成功");
   ApiFactory.getBussinessLogService().log("工作组管理", "保存工作组信息", ContextUtils.getSystemId("acs"));
   return RELOAD;
 }
Пример #11
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";
 }
 /**
  * 工作组去除用户(小写字母g)
  *
  * @return
  * @throws Exception
  */
 @Action("work-group-removeWorkgroupToUsers")
 public String removeWorkgroupToUsers() throws Exception {
   String removeUsers = workGroupManager.workgroupAddUser(workGroupId, userIds, 1);
   if (StringUtils.isNotEmpty(removeUsers))
     ApiFactory.getBussinessLogService()
         .log("工作组管理", "工作组移除人员:" + removeUsers, ContextUtils.getSystemId("acs"));
   return getUserByWorkGroup();
 }
Пример #13
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";
 }
Пример #14
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();
 }
Пример #15
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();
 }
Пример #16
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();
   }
 }
Пример #17
0
 /** 保存审批结果 */
 public String saveOpinion() throws Exception {
   workflowInstance = workflowInstanceManager.getWorkflowInstance(workflowId);
   Opinion opi = new Opinion();
   opi.setTransactor(ContextUtils.getUserName());
   opi.setCreatedTime(new Date());
   opi.setOpinion(opinion);
   opi.setWorkflowId(workflowInstance.getProcessInstanceId());
   opi.setCompanyId(ContextUtils.getCompanyId());
   opi.setTaskId(taskId);
   workflowInstanceManager.saveOpinion(opi);
   ApiFactory.getBussinessLogService().log("流程汇编", "保存意见", ContextUtils.getSystemId("wf"));
   return opinion();
 }
Пример #18
0
 /**
  * 环节跳转/选择环节
  *
  * @return
  * @throws Exception
  */
 public String backView() throws Exception {
   workflowInstance = workflowInstanceManager.getWorkflowInstance(instanceId);
   if (workflowInstance != null) wfdId = workflowInstance.getWorkflowDefinitionId();
   workflowId = workflowInstance.getProcessInstanceId();
   boolean isForkTask = taskService.isForkTask(workflowId);
   if (!isForkTask) { // 当前任务是分支汇聚任务时不让跳转
     canBackTo = taskService.getTaskNames(workflowId);
   } else {
     canBackTo = new ArrayList<String>();
   }
   ApiFactory.getBussinessLogService().log("流程监控", "环节跳转选择环节页面", ContextUtils.getSystemId("wf"));
   return "goback";
 }
  /** 保存新建工作组信息 */
  @Action("work-group-saveWorkGroup")
  public String saveWorkGroup() throws Exception {
    boolean logSign = true; // 该字段只是为了标识日志信息:true表示新建工作组、false表示修改工作组
    if (id == null) {
      Company company = companyManager.getCompany(companyId);
      workGroup.setCompany(company);
      workGroupManager.saveWorkGroup(workGroup);
    } else {
      workGroupManager.saveWorkGroup(workGroup);
      logSign = false;
    }

    if (logSign) {
      ApiFactory.getBussinessLogService()
          .log("工作组管理", "新建工作组:" + workGroup.getName(), ContextUtils.getSystemId("acs"));
    } else {
      ApiFactory.getBussinessLogService()
          .log("工作组管理", "修改工作组:" + workGroup.getName(), ContextUtils.getSystemId("acs"));
    }
    addSuccessMessage("保存成功");
    return null;
  }
Пример #20
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;
 }
Пример #21
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;
 }
 @Override
 @Action("work-group-delete")
 public String delete() throws Exception {
   String logSign = ""; // 该字段只是为了标识日志信息:工作组名称
   String[] str = ides.split(",");
   for (String sid : str) {
     workGroup = workGroupManager.getWorkGroup(Long.valueOf(sid));
     workGroupManager.cleanWorkGroup(workGroup.getId());
     if (StringUtils.isNotEmpty(logSign)) {
       logSign += ",";
     }
     logSign += workGroup.getName();
     workGroupManager.deleteWorkGroup(Long.valueOf(sid));
   }
   ApiFactory.getBussinessLogService()
       .log("工作组管理", "删除工作组:" + logSign, ContextUtils.getSystemId("acs"));
   this.renderText("ok");
   return null;
 }
Пример #23
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;
  }
Пример #24
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();
  }
Пример #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;
 }
Пример #26
0
 /** 减签 */
 public String deleteTask() throws Exception {
   taskService.deleteWorkflowTask(ids);
   ApiFactory.getBussinessLogService().log("工作流平台", "减签", ContextUtils.getSystemId("wf"));
   return deleteCountersign();
 }
Пример #27
0
 /** 加签 */
 public String addTask() throws Exception {
   taskService.generateTask(taskId, transactors, TaskSource.ADD_SIGN, true);
   ApiFactory.getBussinessLogService().log("工作流平台", "加签", ContextUtils.getSystemId("wf"));
   return null;
 }
Пример #28
0
 /**
  * 转向流转历史
  *
  * @return
  * @throws Exception
  */
 public String flowHistory() throws Exception {
   companyId = ContextUtils.getCompanyId();
   ApiFactory.getBussinessLogService().log("工作流平台", "查看流转历史", ContextUtils.getSystemId("wf"));
   return "flowHistory";
 }
Пример #29
0
 /**
  * 取回任务
  *
  * @return
  * @throws Exception
  */
 public String getBack() throws Exception {
   retrieveResult = taskService.retrieve(taskId);
   ApiFactory.getBussinessLogService().log("工作流管理", "取回任务", ContextUtils.getSystemId("wf"));
   return input();
 }
Пример #30
0
 public String completeChoiceTransactor() throws Exception {
   taskService.completeChoiceTransactor(taskId, transactors);
   ApiFactory.getBussinessLogService().log("工作流管理", "指定办理人", ContextUtils.getSystemId("wf"));
   addActionMessage("办理人指定成功!");
   return input();
 }