Search in sources :

Example 1 with TaskPaginateList

use of com.plumdo.flow.rest.task.TaskPaginateList in project plumdo-work by wengwh.

the class TaskDoneResource method getTasks.

@GetMapping(value = "/tasks/done", name = "已办任务查询")
public PageResponse getTasks(@RequestParam Map<String, String> requestParams) {
    HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery();
    if (ObjectUtils.isNotEmpty(requestParams.get("processInstanceId"))) {
        query.processInstanceId(requestParams.get("processInstanceId"));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("processInstanceBusinessKey"))) {
        query.processInstanceBusinessKeyLike(ObjectUtils.convertToLike(requestParams.get("processInstanceBusinessKey")));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("processDefinitionKey"))) {
        query.processDefinitionKeyLike(ObjectUtils.convertToLike(requestParams.get("processDefinitionKey")));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("processDefinitionId"))) {
        query.processDefinitionId(requestParams.get("processDefinitionId"));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("processDefinitionName"))) {
        query.processDefinitionNameLike(ObjectUtils.convertToLike(requestParams.get("processDefinitionName")));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("taskCreatedBefore"))) {
        query.taskCreatedBefore(ObjectUtils.convertToDatetime(requestParams.get("taskCreatedBefore")));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("taskCreatedAfter"))) {
        query.taskCreatedAfter(ObjectUtils.convertToDatetime(requestParams.get("taskCreatedAfter")));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("taskCompletedBefore"))) {
        query.taskCompletedBefore(ObjectUtils.convertToDatetime(requestParams.get("taskCompletedBefore")));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("taskCompletedAfter"))) {
        query.taskCompletedAfter(ObjectUtils.convertToDatetime(requestParams.get("taskCompletedAfter")));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("processFinished"))) {
        boolean isProcessFinished = ObjectUtils.convertToBoolean(requestParams.get("processFinished"));
        if (isProcessFinished) {
            query.processFinished();
        } else {
            query.processUnfinished();
        }
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("tenantId"))) {
        query.taskTenantId(requestParams.get("tenantId"));
    }
    query.finished().or().taskAssignee(Authentication.getUserId()).taskOwner(Authentication.getUserId()).endOr();
    return new TaskPaginateList(restResponseFactory).paginateList(getPageable(requestParams), query, allowedSortProperties);
}
Also used : TaskPaginateList(com.plumdo.flow.rest.task.TaskPaginateList) HistoricTaskInstanceQuery(org.flowable.task.api.history.HistoricTaskInstanceQuery) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 2 with TaskPaginateList

use of com.plumdo.flow.rest.task.TaskPaginateList in project plumdo-work by wengwh.

the class TaskResource method getTasks.

@GetMapping(value = "/tasks", name = "任务查询")
public PageResponse getTasks(@RequestParam Map<String, String> requestParams) {
    HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery();
    if (ObjectUtils.isNotEmpty(requestParams.get("taskId"))) {
        query.taskId(requestParams.get("taskId"));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("processInstanceId"))) {
        query.processInstanceId(requestParams.get("processInstanceId"));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("processInstanceBusinessKey"))) {
        query.processInstanceBusinessKeyLike(ObjectUtils.convertToLike(requestParams.get("processInstanceBusinessKey")));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("processDefinitionKey"))) {
        query.processDefinitionKeyLike(ObjectUtils.convertToLike(requestParams.get("processDefinitionKey")));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("processDefinitionId"))) {
        query.processDefinitionId(requestParams.get("processDefinitionId"));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("processDefinitionName"))) {
        query.processDefinitionNameLike(ObjectUtils.convertToLike(requestParams.get("processDefinitionName")));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("executionId"))) {
        query.executionId(requestParams.get("executionId"));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("taskName"))) {
        query.taskNameLike(ObjectUtils.convertToLike(requestParams.get("taskName")));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("taskDescription"))) {
        query.taskDescriptionLike(ObjectUtils.convertToLike(requestParams.get("taskDescription")));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("taskDefinitionKey"))) {
        query.taskDefinitionKeyLike(ObjectUtils.convertToLike(requestParams.get("taskDefinitionKey")));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("taskAssignee"))) {
        query.taskAssignee(requestParams.get("taskAssignee"));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("taskOwner"))) {
        query.taskOwner(requestParams.get("taskOwner"));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("taskInvolvedUser"))) {
        query.taskInvolvedUser(requestParams.get("taskInvolvedUser"));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("taskPriority"))) {
        query.taskPriority(ObjectUtils.convertToInteger(requestParams.get("taskPriority")));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("finished"))) {
        boolean isFinished = ObjectUtils.convertToBoolean(requestParams.get("finished"));
        if (isFinished) {
            query.finished();
        } else {
            query.unfinished();
        }
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("processFinished"))) {
        boolean isProcessFinished = ObjectUtils.convertToBoolean(requestParams.get("processFinished"));
        if (isProcessFinished) {
            query.processFinished();
        } else {
            query.processUnfinished();
        }
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("parentTaskId"))) {
        query.taskParentTaskId(requestParams.get("parentTaskId"));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("dueDateAfter"))) {
        query.taskDueAfter(ObjectUtils.convertToDatetime(requestParams.get("dueDateAfter")));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("dueDateBefore"))) {
        query.taskDueBefore(ObjectUtils.convertToDatetime(requestParams.get("dueDateBefore")));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("taskCreatedBefore"))) {
        query.taskCreatedBefore(ObjectUtils.convertToDatetime(requestParams.get("taskCreatedBefore")));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("taskCreatedAfter"))) {
        query.taskCreatedAfter(ObjectUtils.convertToDatetime(requestParams.get("taskCreatedAfter")));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("taskCompletedBefore"))) {
        query.taskCompletedBefore(ObjectUtils.convertToDatetime(requestParams.get("taskCompletedBefore")));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("taskCompletedAfter"))) {
        query.taskCompletedAfter(ObjectUtils.convertToDatetime(requestParams.get("taskCompletedAfter")));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("tenantId"))) {
        query.taskTenantId(requestParams.get("tenantId"));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("taskCandidateUser"))) {
        query.taskCandidateUser(requestParams.get("taskCandidateUser"));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("taskCandidateGroup"))) {
        query.taskCandidateGroup(requestParams.get("taskCandidateGroup"));
    }
    if (ObjectUtils.isNotEmpty(requestParams.get("taskCandidateGroups"))) {
        String[] candidateGroups = requestParams.get("taskCandidateGroups").split(",");
        query.taskCandidateGroupIn(Arrays.asList(candidateGroups));
    }
    return new TaskPaginateList(restResponseFactory).paginateList(getPageable(requestParams), query, allowedSortProperties);
}
Also used : TaskPaginateList(com.plumdo.flow.rest.task.TaskPaginateList) HistoricTaskInstanceQuery(org.flowable.task.api.history.HistoricTaskInstanceQuery) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Aggregations

TaskPaginateList (com.plumdo.flow.rest.task.TaskPaginateList)2 HistoricTaskInstanceQuery (org.flowable.task.api.history.HistoricTaskInstanceQuery)2 GetMapping (org.springframework.web.bind.annotation.GetMapping)2