Пример #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";
 }
Пример #2
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();
  }