Exemple #1
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();
  }
 @Before
 public void init() {
   ThreadParameters parameters = new ThreadParameters(null, null);
   parameters.setCompanyId(1L);
   ParameterUtils.setParameters(parameters);
 }