Example #1
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";
 }
  /**
   * 保存工作组添加用户
   *
   * @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;
  }
Example #3
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;
 }
 @Override
 public String save() throws Exception {
   workGroupManager.saveWorkGroup(workGroup);
   addActionMessage("保存工作组成功");
   ApiFactory.getBussinessLogService().log("工作组管理", "保存工作组信息", ContextUtils.getSystemId("acs"));
   return RELOAD;
 }
Example #5
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 #6
0
 public String getTrustorSubCompanyName() {
   User user = ApiFactory.getAcsService().getUserById(trustorId);
   if (user != null) {
     return user.getSubCompanyName();
   }
   return ContextUtils.getCompanyName();
 }
Example #7
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 #8
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;
 }
Example #9
0
  /**
   * 流程监控/保存增加的办理人
   *
   * @return
   * @throws Exception
   */
  public String addTransactorSave() throws Exception {
    taskService.addTransactor(workflowId, transactors);

    ApiFactory.getBussinessLogService().log("流程监控", "增加办理人", ContextUtils.getSystemId("wf"));
    this.addSuccessMessage("办理人已增加");
    return addTransactor();
  }
Example #10
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 #11
0
 public static Set<String> getUsersByRoleName(String roleName, Long systemId, Long companyId) {
   Set<String> userNames = new HashSet<String>();
   for (User user : ApiFactory.getAcsService().getUsersByRoleName(systemId, roleName)) {
     userNames.add(user.getLoginName());
   }
   return userNames;
 }
Example #12
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 #13
0
 public static Set<String> getUsersExceptRoleName(Long systemId, String roleName) {
   Set<String> userNames = new HashSet<String>();
   for (User user : ApiFactory.getAcsService().getUsersWithoutRoleName(systemId, roleName)) {
     userNames.add(user.getLoginName());
   }
   return userNames;
 }
Example #14
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 #15
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";
  }
Example #16
0
 public static Set<String> getUsersByWorkGroup(Set<Workgroup> workgroupSet) {
   Set<String> userNames = new HashSet<String>();
   for (Workgroup workGroup : workgroupSet) {
     userNames.addAll(
         getUserLoginName(ApiFactory.getAcsService().getUsersByWorkgroupId(workGroup.getId())));
   }
   return userNames;
 }
Example #17
0
 public static Set<String> getUsersByDepartment(Set<Department> departmentSet) {
   Set<String> userNames = new HashSet<String>();
   for (Department department : departmentSet) {
     userNames.addAll(
         getUserLoginName(ApiFactory.getAcsService().getUsersByDepartmentId(department.getId())));
   }
   return userNames;
 }
 /**
  * 获得可供选择的办理人
  *
  * @return 可供选择的办理人登录名集合
  */
 public Collection<Long> getCanChoiceTransactorId() {
   if (canChoiceTransactorId.size() > 0) return canChoiceTransactorId;
   for (String transactor : canChoiceTransactor) {
     User user = ApiFactory.getAcsService().getUserByLoginName(transactor);
     canChoiceTransactorId.add(user.getId());
   }
   return canChoiceTransactorId;
 }
 /**
  * 工作组去除用户(小写字母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();
 }
Example #20
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";
 }
 /**
  * 获得可供选择的办理人
  *
  * @return 可供选择的办理人登录名集合
  */
 public Collection<String> getCanChoiceTransactor() {
   if (canChoiceTransactor.size() > 0) return canChoiceTransactor;
   for (Long transactorId : canChoiceTransactorId) {
     User user = ApiFactory.getAcsService().getUserById(transactorId);
     canChoiceTransactor.add(user.getLoginName());
   }
   return canChoiceTransactor;
 }
Example #22
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 #23
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";
 }
 // 新建word/excel
 @Action("office-createOffice")
 public String createOffice() throws Exception {
   WorkflowInstance instance = null;
   WorkflowTask task = null;
   if (id == null) {
     task = ApiFactory.getTaskService().getTask(taskId);
     instance = workflowInstanceManager.getWorkflowInstance(task.getProcessInstanceId());
     document.setTaskName(task.getName());
     document.setTaskMode(task.getProcessingMode());
     document.setWorkflowId(instance.getProcessInstanceId());
     document.setCreator(ContextUtils.getLoginName());
     document.setCreatorName(ContextUtils.getUserName());
     document.setCompanyId(ContextUtils.getCompanyId());
     document.setEditType("-1,0,0,0,0,0,1,1"); // 允许编辑,不显示和保留痕迹,允许批注
     document.setPrintSetting(true);
     document.setDownloadSetting(true);
     if (document.getFileType().equalsIgnoreCase("pdf")) {
       return "office-pdf";
     } else {
       String template =
           DefinitionXmlParse.getOfficialTextTemplate(
               instance.getProcessDefinitionId(), task.getName());
       if (StringUtils.isNotEmpty(template))
         document.setTemplateId(Long.valueOf(StringUtils.substringBetween(template, "[", "]")));
       setOfficeRight(document, instance, task);
       return "office-view";
     }
   } else {
     if (taskId == null) {
       instance = workflowInstanceManager.getWorkflowInstance(document.getWorkflowId());
       task = ApiFactory.getTaskService().getTask(instance.getFirstTaskId());
     } else {
       task = ApiFactory.getTaskService().getTask(taskId);
       instance = workflowInstanceManager.getWorkflowInstance(task.getProcessInstanceId());
     }
     setOfficeRight(document, instance, task);
     if (document.getFileType().equalsIgnoreCase("pdf")) {
       return "office-pdf";
     } else {
       return "office-view";
     }
   }
 }
Example #25
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 #26
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();
 }
 public ConditionVlaueInfo getValues(
     String conditionValue, List<PermissionItem> permissionItems, PermissionInfo permissionInfo) {
   String value = "";
   Long userId = permissionInfo.getUserId();
   List<User> users = ApiFactory.getDataDictService().getDirectLower(userId);
   for (User u : users) {
     value = value + u.getId() + ",";
   }
   if (value.indexOf(",") >= 0) value = value.substring(0, value.lastIndexOf(","));
   return new ConditionVlaueInfo(DataRuleConditionValueType.STANDARD_VALUE, value);
 }
Example #28
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 #29
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";
 }
Example #30
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();
 }