/** 已办任务. */
  public Page findFinishedTasks(String userId, int pageNo, int pageSize) {
    Page page =
        taskInfoManager.pagedQuery(
            "from TaskInfo where assignee=? and status='complete'", pageNo, pageSize, userId);
    List<TaskInfo> taskInfos = (List<TaskInfo>) page.getResult();
    List<HumanTaskDTO> humanTaskDtos = this.convertHumanTaskDtos(taskInfos);
    page.setResult(humanTaskDtos);

    return page;
  }
  /** 部署. */
  public Page findDeployments(String tenantId, Page page) {
    RepositoryService repositoryService = processEngine.getRepositoryService();
    long count = repositoryService.createDeploymentQuery().deploymentTenantId(tenantId).count();
    List<Deployment> deployments =
        repositoryService
            .createDeploymentQuery()
            .deploymentTenantId(tenantId)
            .listPage((int) page.getStart(), page.getPageSize());
    page.setResult(deployments);
    page.setTotalCount(count);

    return page;
  }
  /** 任务. */
  public Page findTasks(String tenantId, Page page) {
    TaskService taskService = processEngine.getTaskService();
    long count = taskService.createTaskQuery().taskTenantId(tenantId).count();
    List<Task> tasks =
        taskService
            .createTaskQuery()
            .taskTenantId(tenantId)
            .listPage((int) page.getStart(), page.getPageSize());
    page.setResult(tasks);
    page.setTotalCount(count);

    return page;
  }
  /** 作业. */
  public Page findJobs(String tenantId, Page page) {
    ManagementService managementService = processEngine.getManagementService();

    long count = managementService.createJobQuery().jobTenantId(tenantId).count();
    List<Job> jobs =
        managementService
            .createJobQuery()
            .jobTenantId(tenantId)
            .listPage((int) page.getStart(), page.getPageSize());
    page.setResult(jobs);
    page.setTotalCount(count);

    return page;
  }
  /** 历史任务. */
  public Page findHistoricTaskInstances(String tenantId, Page page) {
    HistoryService historyService = processEngine.getHistoryService();

    long count = historyService.createHistoricTaskInstanceQuery().taskTenantId(tenantId).count();
    List<HistoricTaskInstance> historicTaskInstances =
        historyService
            .createHistoricTaskInstanceQuery()
            .taskTenantId(tenantId)
            .listPage((int) page.getStart(), page.getPageSize());
    page.setResult(historicTaskInstances);
    page.setTotalCount(count);

    return page;
  }
  /** 流程实例. */
  public Page findProcessInstances(String tenantId, Page page) {
    RuntimeService runtimeService = processEngine.getRuntimeService();
    long count =
        runtimeService.createProcessInstanceQuery().processInstanceTenantId(tenantId).count();
    List<ProcessInstance> processInstances =
        runtimeService
            .createProcessInstanceQuery()
            .processInstanceTenantId(tenantId)
            .listPage((int) page.getStart(), page.getPageSize());
    page.setResult(processInstances);
    page.setTotalCount(count);

    return page;
  }
  @RequestMapping("user-status-list")
  public String list(
      @ModelAttribute Page page, @RequestParam Map<String, Object> parameterMap, Model model) {
    List<PropertyFilter> propertyFilters = PropertyFilter.buildFromMap(parameterMap);
    propertyFilters.add(new PropertyFilter("EQS_scopeId", ScopeHolder.getScopeId()));
    page = userStatusManager.pagedQuery(page, propertyFilters);

    List<UserStatus> userStatuses = (List<UserStatus>) page.getResult();
    List<UserStatusDTO> userStatusDtos =
        userStatusConverter.createUserStatusDtos(
            userStatuses, ScopeHolder.getUserRepoRef(), ScopeHolder.getScopeId());
    page.setResult(userStatusDtos);
    model.addAttribute("page", page);

    return "auth/user-status-list";
  }
  /** 流程定义. */
  public Page findProcessDefinitions(String tenantId, Page page) {
    RepositoryService repositoryService = processEngine.getRepositoryService();
    long count =
        repositoryService
            .createProcessDefinitionQuery()
            .processDefinitionTenantId(tenantId)
            .count();
    List<ProcessDefinition> processDefinitions =
        repositoryService
            .createProcessDefinitionQuery()
            .processDefinitionTenantId(tenantId)
            .listPage((int) page.getStart(), page.getPageSize());
    page.setResult(processDefinitions);
    page.setTotalCount(count);

    return page;
  }
  @POST
  @Path("tasks")
  @Produces(MediaType.APPLICATION_JSON)
  public BaseDTO tasks(@HeaderParam("sessionId") String sessionId) throws Exception {
    logger.info("start");

    PimDevice pimDevice = pimDeviceManager.findUniqueBy("sessionId", sessionId);

    if (pimDevice == null) {
      BaseDTO result = new BaseDTO();
      result.setCode(401);
      result.setMessage("auth fail");

      return result;
    }

    String userId = pimDevice.getUserId();
    String tenantId = "1";
    Page page = humanTaskConnector.findPersonalTasks(userId, tenantId, 1, 10);
    List<HumanTaskDTO> humanTaskDtos = (List<HumanTaskDTO>) page.getResult();
    List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();

    DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    for (HumanTaskDTO humanTaskDto : humanTaskDtos) {
      Map<String, Object> map = new HashMap<String, Object>();
      map.put("id", humanTaskDto.getId());
      map.put("name", humanTaskDto.getName());
      map.put("presentationSubject", humanTaskDto.getPresentationSubject());
      map.put("createTime", dateFormat.format(humanTaskDto.getCreateTime()));
      map.put("assignee", humanTaskDto.getAssignee());
      map.put("assigneeDisplayName", userConnector.findById(userId).getDisplayName());
      list.add(map);
    }

    String json = jsonMapper.toJson(list);
    BaseDTO result = new BaseDTO();
    result.setCode(200);
    result.setData(json);
    logger.info("end");

    return result;
  }
Exemple #10
0
  public void exportExcel() throws Exception {
    List<PropertyFilter> propertyFilters =
        PropertyFilter.buildFromHttpRequest(ServletActionContext.getRequest());
    page = roleManager.pagedQuery(page, propertyFilters);

    List<Role> roles = (List<Role>) page.getResult();
    TableModel tableModel = new TableModel();
    tableModel.setName("role");
    tableModel.addHeaders("id", "name", "descn");
    tableModel.setData(roles);
    exportor.exportExcel(ServletActionContext.getResponse(), tableModel);
  }
Exemple #11
0
  public void exportExcel() throws Exception {
    List<PropertyFilter> propertyFilters =
        PropertyFilter.buildFromHttpRequest(ServletActionContext.getRequest());
    page = aclSidManager.pagedQuery(page, propertyFilters);

    List<AclSid> aclSids = (List<AclSid>) page.getResult();

    TableModel tableModel = new TableModel();
    tableModel.setName("AclSid");
    tableModel.addHeaders("id");
    tableModel.setData(aclSids);
    exportor.exportExcel(ServletActionContext.getResponse(), tableModel);
  }
  /** 参与流程. */
  public Page findInvolvedProcessInstances(String userId, String tenantId, Page page) {
    HistoryService historyService = processEngine.getHistoryService();

    // TODO: finished(), unfinished()
    long count =
        historyService
            .createHistoricProcessInstanceQuery()
            .processInstanceTenantId(tenantId)
            .involvedUser(userId)
            .count();
    List<HistoricProcessInstance> historicProcessInstances =
        historyService
            .createHistoricProcessInstanceQuery()
            .processInstanceTenantId(tenantId)
            .involvedUser(userId)
            .listPage((int) page.getStart(), page.getPageSize());

    page.setResult(historicProcessInstances);
    page.setTotalCount(count);

    return page;
  }
  /** 未结流程. */
  public Page findRunningProcessInstances(String userId, String tenantId, Page page) {
    HistoryService historyService = processEngine.getHistoryService();

    // TODO: 改成通过runtime表搜索,提高效率
    long count =
        historyService
            .createHistoricProcessInstanceQuery()
            .processInstanceTenantId(tenantId)
            .startedBy(userId)
            .unfinished()
            .count();
    List<HistoricProcessInstance> historicProcessInstances =
        historyService
            .createHistoricProcessInstanceQuery()
            .processInstanceTenantId(tenantId)
            .startedBy(userId)
            .unfinished()
            .listPage((int) page.getStart(), page.getPageSize());

    page.setResult(historicProcessInstances);
    page.setTotalCount(count);

    return page;
  }
  @RequestMapping("role-def-export")
  public void export(
      @ModelAttribute Page page,
      @RequestParam Map<String, Object> parameterMap,
      HttpServletResponse response)
      throws Exception {
    List<PropertyFilter> propertyFilters = PropertyFilter.buildFromMap(parameterMap);
    page = roleDefManager.pagedQuery(page, propertyFilters);

    List<RoleDef> roleDefs = (List<RoleDef>) page.getResult();
    TableModel tableModel = new TableModel();
    tableModel.setName("role");
    tableModel.addHeaders("id", "name", "descn");
    tableModel.setData(roleDefs);
    exportor.export(response, tableModel);
  }
  @RequestMapping("bpm-category-export")
  public void export(
      @ModelAttribute Page page,
      @RequestParam Map<String, Object> parameterMap,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    List<PropertyFilter> propertyFilters = PropertyFilter.buildFromMap(parameterMap);
    page = bpmCategoryManager.pagedQuery(page, propertyFilters);

    List<BpmCategory> bpmCategories = (List<BpmCategory>) page.getResult();
    TableModel tableModel = new TableModel();
    tableModel.setName("bpm-category");
    tableModel.addHeaders("id", "name");
    tableModel.setData(bpmCategories);
    exportor.export(request, response, tableModel);
  }
  @RequestMapping("perm-type-export")
  public void export(
      @ModelAttribute Page page,
      @RequestParam Map<String, Object> parameterMap,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    List<PropertyFilter> propertyFilters = PropertyFilter.buildFromMap(parameterMap);
    page = permTypeManager.pagedQuery(page, propertyFilters);

    List<PermType> permTypees = (List<PermType>) page.getResult();
    TableModel tableModel = new TableModel();
    tableModel.setName("permType");
    tableModel.addHeaders("id", "type", "value", "perm.name", "priority", "app.name");
    tableModel.setData(permTypees);
    exportor.export(request, response, tableModel);
  }
  @RequestMapping("portal-widget-export")
  public void export(
      @ModelAttribute Page page,
      @RequestParam Map<String, Object> parameterMap,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    List<PropertyFilter> propertyFilters = PropertyFilter.buildFromMap(parameterMap);
    page = portalWidgetManager.pagedQuery(page, propertyFilters);

    List<PortalWidget> portalWidgets = (List<PortalWidget>) page.getResult();

    TableModel tableModel = new TableModel();
    tableModel.setName("portal base");
    tableModel.addHeaders("id", "client", "server", "resource");
    tableModel.setData(portalWidgets);
    exportor.export(request, response, tableModel);
  }
  @RequestMapping("party-entity-export")
  public void export(
      @ModelAttribute Page page,
      @RequestParam Map<String, Object> parameterMap,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    List<PropertyFilter> propertyFilters = PropertyFilter.buildFromMap(parameterMap);
    page = partyEntityManager.pagedQuery(page, propertyFilters);

    List<PartyEntity> partyEntities = (List<PartyEntity>) page.getResult();
    List<PartyEntityDTO> partyDtos = partyEntityConverter.createPartyEntityDtos(partyEntities);
    TableModel tableModel = new TableModel();
    tableModel.setName("party entity");
    tableModel.addHeaders("id", "type", "code", "name");
    tableModel.setData(partyDtos);
    exportor.export(request, response, tableModel);
  }
  @RequestMapping("user-status-export")
  public void export(
      @ModelAttribute Page page,
      @RequestParam Map<String, Object> parameterMap,
      HttpServletResponse response)
      throws Exception {
    List<PropertyFilter> propertyFilters = PropertyFilter.buildFromMap(parameterMap);
    page = userStatusManager.pagedQuery(page, propertyFilters);

    List<UserStatus> userStatuses = (List<UserStatus>) page.getResult();
    List<UserStatusDTO> userStatusDtos =
        userStatusConverter.createUserStatusDtos(
            userStatuses, ScopeHolder.getUserRepoRef(), ScopeHolder.getScopeId());
    TableModel tableModel = new TableModel();
    tableModel.setName("user status");
    tableModel.addHeaders("id", "username", "enabled", "authorities");
    tableModel.setData(userStatusDtos);
    exportor.export(response, tableModel);
  }
  @RequestMapping("whitelist-type-export")
  public void export(
      @ModelAttribute Page page,
      @RequestParam Map<String, Object> parameterMap,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    String tenantId = tenantHolder.getTenantId();
    List<PropertyFilter> propertyFilters = PropertyFilter.buildFromMap(parameterMap);
    propertyFilters.add(new PropertyFilter("EQS_tenantId", tenantId));
    page = whitelistTypeManager.pagedQuery(page, propertyFilters);

    List<WhitelistType> whitelistTypes = (List<WhitelistType>) page.getResult();

    TableModel tableModel = new TableModel();
    tableModel.setName("whitelistType");
    tableModel.addHeaders("id", "name");
    tableModel.setData(whitelistTypes);
    exportor.export(request, response, tableModel);
  }