Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Improvement-15489][api]the vo object suffix,converted to uppercase #15504

Merged
merged 3 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
import org.apache.dolphinscheduler.api.exceptions.ApiException;
import org.apache.dolphinscheduler.api.service.DataAnalysisService;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.api.vo.TaskInstanceCountVo;
import org.apache.dolphinscheduler.api.vo.WorkflowDefinitionCountVo;
import org.apache.dolphinscheduler.api.vo.WorkflowInstanceCountVo;
import org.apache.dolphinscheduler.api.vo.TaskInstanceCountVO;
import org.apache.dolphinscheduler.api.vo.WorkflowDefinitionCountVO;
import org.apache.dolphinscheduler.api.vo.WorkflowInstanceCountVO;
import org.apache.dolphinscheduler.common.constants.Constants;
import org.apache.dolphinscheduler.dao.entity.User;

Expand Down Expand Up @@ -71,7 +71,7 @@ public class DataAnalysisController extends BaseController {
@GetMapping(value = "/task-state-count")
@ResponseStatus(HttpStatus.OK)
@ApiException(TASK_INSTANCE_STATE_COUNT_ERROR)
public Result<TaskInstanceCountVo> getTaskInstanceStateCount(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result<TaskInstanceCountVO> getTaskInstanceStateCount(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "startDate", required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate,
@RequestParam(value = "projectCode", required = false) Long projectCode) {
Expand All @@ -91,7 +91,7 @@ public Result<TaskInstanceCountVo> getTaskInstanceStateCount(@Parameter(hidden =
@GetMapping(value = "/process-state-count")
@ResponseStatus(HttpStatus.OK)
@ApiException(COUNT_PROCESS_INSTANCE_STATE_ERROR)
public Result<WorkflowInstanceCountVo> getWorkflowInstanceStateCount(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result<WorkflowInstanceCountVO> getWorkflowInstanceStateCount(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "startDate", required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate,
@RequestParam(value = "projectCode", required = false) Long projectCode) {
Expand All @@ -109,7 +109,7 @@ public Result<WorkflowInstanceCountVo> getWorkflowInstanceStateCount(@Parameter(
@GetMapping(value = "/define-user-count")
@ResponseStatus(HttpStatus.OK)
@ApiException(COUNT_PROCESS_DEFINITION_USER_ERROR)
public Result<WorkflowDefinitionCountVo> countDefinitionByUser(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result<WorkflowDefinitionCountVO> countDefinitionByUser(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "projectCode", required = false) Long projectCode) {
if (projectCode == null) {
return Result.success(dataAnalysisService.getAllWorkflowDefinitionCount(loginUser));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
import org.apache.dolphinscheduler.api.dto.DefineUserDto;
import org.apache.dolphinscheduler.api.dto.TaskCountDto;
import org.apache.dolphinscheduler.api.dto.project.StatisticsStateRequest;
import org.apache.dolphinscheduler.api.vo.TaskInstanceCountVo;
import org.apache.dolphinscheduler.api.vo.WorkflowDefinitionCountVo;
import org.apache.dolphinscheduler.api.vo.WorkflowInstanceCountVo;
import org.apache.dolphinscheduler.api.vo.TaskInstanceCountVO;
import org.apache.dolphinscheduler.api.vo.WorkflowDefinitionCountVO;
import org.apache.dolphinscheduler.api.vo.WorkflowInstanceCountVO;
import org.apache.dolphinscheduler.dao.entity.User;

import java.util.List;
Expand All @@ -34,27 +34,27 @@
*/
public interface DataAnalysisService {

TaskInstanceCountVo getTaskInstanceStateCountByProject(User loginUser,
TaskInstanceCountVO getTaskInstanceStateCountByProject(User loginUser,
Long projectCode,
String startDate,
String endDate);

TaskInstanceCountVo getAllTaskInstanceStateCount(User loginUser,
TaskInstanceCountVO getAllTaskInstanceStateCount(User loginUser,
String startDate,
String endDate);

WorkflowInstanceCountVo getWorkflowInstanceStateCountByProject(User loginUser,
WorkflowInstanceCountVO getWorkflowInstanceStateCountByProject(User loginUser,
Long projectCodes,
String startDate,
String endDate);

WorkflowInstanceCountVo getAllWorkflowInstanceStateCount(User loginUser,
WorkflowInstanceCountVO getAllWorkflowInstanceStateCount(User loginUser,
String startDate,
String endDate);

WorkflowDefinitionCountVo getWorkflowDefinitionCountByProject(User loginUser, Long projectCode);
WorkflowDefinitionCountVO getWorkflowDefinitionCountByProject(User loginUser, Long projectCode);

WorkflowDefinitionCountVo getAllWorkflowDefinitionCount(User loginUser);
WorkflowDefinitionCountVO getAllWorkflowDefinitionCount(User loginUser);

/**
* statistics the workflow quantities of certain user
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
import org.apache.dolphinscheduler.api.exceptions.ServiceException;
import org.apache.dolphinscheduler.api.service.DataAnalysisService;
import org.apache.dolphinscheduler.api.service.ProjectService;
import org.apache.dolphinscheduler.api.vo.TaskInstanceCountVo;
import org.apache.dolphinscheduler.api.vo.WorkflowDefinitionCountVo;
import org.apache.dolphinscheduler.api.vo.WorkflowInstanceCountVo;
import org.apache.dolphinscheduler.api.vo.TaskInstanceCountVO;
import org.apache.dolphinscheduler.api.vo.WorkflowDefinitionCountVO;
import org.apache.dolphinscheduler.api.vo.WorkflowInstanceCountVO;
import org.apache.dolphinscheduler.common.constants.Constants;
import org.apache.dolphinscheduler.common.enums.AuthorizationType;
import org.apache.dolphinscheduler.common.enums.CommandType;
Expand Down Expand Up @@ -105,7 +105,7 @@ public class DataAnalysisServiceImpl extends BaseServiceImpl implements DataAnal
private TaskDefinitionMapper taskDefinitionMapper;

@Override
public TaskInstanceCountVo getTaskInstanceStateCountByProject(User loginUser,
public TaskInstanceCountVO getTaskInstanceStateCountByProject(User loginUser,
Long projectCode,
String startDate,
String endDate) {
Expand All @@ -114,26 +114,26 @@ public TaskInstanceCountVo getTaskInstanceStateCountByProject(User loginUser,
Date end = endDate == null ? null : transformDate(endDate);
List<TaskInstanceStatusCountDto> taskInstanceStatusCounts =
taskInstanceMapper.countTaskInstanceStateByProjectCodes(start, end, Lists.newArrayList(projectCode));
return TaskInstanceCountVo.of(taskInstanceStatusCounts);
return TaskInstanceCountVO.of(taskInstanceStatusCounts);
}

@Override
public TaskInstanceCountVo getAllTaskInstanceStateCount(User loginUser,
public TaskInstanceCountVO getAllTaskInstanceStateCount(User loginUser,
String startDate,
String endDate) {
List<Long> projectCodes = projectService.getAuthorizedProjectCodes(loginUser);
if (CollectionUtils.isEmpty(projectCodes)) {
return TaskInstanceCountVo.empty();
return TaskInstanceCountVO.empty();
}
Date start = startDate == null ? null : transformDate(startDate);
Date end = endDate == null ? null : transformDate(endDate);
List<TaskInstanceStatusCountDto> taskInstanceStatusCounts =
taskInstanceMapper.countTaskInstanceStateByProjectCodes(start, end, projectCodes);
return TaskInstanceCountVo.of(taskInstanceStatusCounts);
return TaskInstanceCountVO.of(taskInstanceStatusCounts);
}

@Override
public WorkflowInstanceCountVo getWorkflowInstanceStateCountByProject(User loginUser,
public WorkflowInstanceCountVO getWorkflowInstanceStateCountByProject(User loginUser,
Long projectCode,
String startDate,
String endDate) {
Expand All @@ -142,40 +142,40 @@ public WorkflowInstanceCountVo getWorkflowInstanceStateCountByProject(User login
Date end = endDate == null ? null : transformDate(endDate);
List<WorkflowInstanceStatusCountDto> workflowInstanceStatusCountDtos = processInstanceMapper
.countWorkflowInstanceStateByProjectCodes(start, end, Lists.newArrayList(projectCode));
return WorkflowInstanceCountVo.of(workflowInstanceStatusCountDtos);
return WorkflowInstanceCountVO.of(workflowInstanceStatusCountDtos);
}

@Override
public WorkflowInstanceCountVo getAllWorkflowInstanceStateCount(User loginUser,
public WorkflowInstanceCountVO getAllWorkflowInstanceStateCount(User loginUser,
String startDate,
String endDate) {
List<Long> projectCodes = projectService.getAuthorizedProjectCodes(loginUser);
if (CollectionUtils.isEmpty(projectCodes)) {
return WorkflowInstanceCountVo.empty();
return WorkflowInstanceCountVO.empty();
}
Date start = startDate == null ? null : transformDate(startDate);
Date end = endDate == null ? null : transformDate(endDate);

List<WorkflowInstanceStatusCountDto> workflowInstanceStatusCountDtos =
processInstanceMapper.countWorkflowInstanceStateByProjectCodes(start, end, projectCodes);
return WorkflowInstanceCountVo.of(workflowInstanceStatusCountDtos);
return WorkflowInstanceCountVO.of(workflowInstanceStatusCountDtos);
}

@Override
public WorkflowDefinitionCountVo getWorkflowDefinitionCountByProject(User loginUser, Long projectCode) {
public WorkflowDefinitionCountVO getWorkflowDefinitionCountByProject(User loginUser, Long projectCode) {
projectService.checkProjectAndAuthThrowException(loginUser, projectCode, PROJECT_OVERVIEW);
List<WorkflowDefinitionCountDto> workflowDefinitionCounts =
processDefinitionMapper.countDefinitionByProjectCodes(Lists.newArrayList(projectCode));
return WorkflowDefinitionCountVo.of(workflowDefinitionCounts);
return WorkflowDefinitionCountVO.of(workflowDefinitionCounts);
}

@Override
public WorkflowDefinitionCountVo getAllWorkflowDefinitionCount(User loginUser) {
public WorkflowDefinitionCountVO getAllWorkflowDefinitionCount(User loginUser) {
List<Long> projectCodes = projectService.getAuthorizedProjectCodes(loginUser);
if (CollectionUtils.isEmpty(projectCodes)) {
return WorkflowDefinitionCountVo.empty();
return WorkflowDefinitionCountVO.empty();
}
return WorkflowDefinitionCountVo.of(processDefinitionMapper.countDefinitionByProjectCodes(projectCodes));
return WorkflowDefinitionCountVO.of(processDefinitionMapper.countDefinitionByProjectCodes(projectCodes));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import org.apache.dolphinscheduler.api.service.SchedulerService;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.api.vo.ScheduleVo;
import org.apache.dolphinscheduler.api.vo.ScheduleVO;
import org.apache.dolphinscheduler.common.constants.Constants;
import org.apache.dolphinscheduler.common.enums.FailureStrategy;
import org.apache.dolphinscheduler.common.enums.Priority;
Expand Down Expand Up @@ -462,12 +462,12 @@ public Result querySchedule(User loginUser, long projectCode, long processDefine
scheduleMapper.queryByProjectAndProcessDefineCodePaging(page, projectCode, processDefineCode,
searchVal);

List<ScheduleVo> scheduleList = new ArrayList<>();
List<ScheduleVO> scheduleList = new ArrayList<>();
for (Schedule schedule : schedulePage.getRecords()) {
scheduleList.add(new ScheduleVo(schedule));
scheduleList.add(new ScheduleVO(schedule));
}

PageInfo<ScheduleVo> pageInfo = new PageInfo<>(pageNo, pageSize);
PageInfo<ScheduleVO> pageInfo = new PageInfo<>(pageNo, pageSize);
pageInfo.setTotal((int) schedulePage.getTotal());
pageInfo.setTotalList(scheduleList);
result.setData(pageInfo);
Expand Down Expand Up @@ -528,9 +528,9 @@ public Map<String, Object> queryScheduleList(User loginUser, long projectCode) {
}

List<Schedule> schedules = scheduleMapper.querySchedulerListByProjectName(project.getName());
List<ScheduleVo> scheduleList = new ArrayList<>();
List<ScheduleVO> scheduleList = new ArrayList<>();
for (Schedule schedule : schedules) {
scheduleList.add(new ScheduleVo(schedule));
scheduleList.add(new ScheduleVO(schedule));
}

result.put(Constants.DATA_LIST, scheduleList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import org.apache.dolphinscheduler.api.service.TaskDefinitionService;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.api.vo.TaskDefinitionVo;
import org.apache.dolphinscheduler.api.vo.TaskDefinitionVO;
import org.apache.dolphinscheduler.common.constants.Constants;
import org.apache.dolphinscheduler.common.enums.AuthorizationType;
import org.apache.dolphinscheduler.common.enums.ConditionType;
Expand Down Expand Up @@ -1167,7 +1167,7 @@ public Map<String, Object> queryTaskDefinitionDetail(User loginUser, long projec
taskRelationList = taskRelationList.stream()
.filter(v -> v.getPreTaskCode() != 0).collect(Collectors.toList());
}
TaskDefinitionVo taskDefinitionVo = TaskDefinitionVo.fromTaskDefinition(taskDefinition);
TaskDefinitionVO taskDefinitionVo = TaskDefinitionVO.fromTaskDefinition(taskDefinition);
taskDefinitionVo.setProcessTaskRelationList(taskRelationList);
result.put(Constants.DATA_LIST, taskDefinitionVo);
putMsg(result, Status.SUCCESS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import lombok.Data;

@Data
public class ScheduleVo {
public class ScheduleVO {

private int id;

Expand Down Expand Up @@ -140,7 +140,7 @@ public class ScheduleVo {
*/
private String environmentName;

public ScheduleVo(Schedule schedule) {
public ScheduleVO(Schedule schedule) {
this.setId(schedule.getId());
this.setCrontab(schedule.getCrontab());
this.setProjectName(schedule.getProjectName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@
* @author fanwanlong
*/
@Data
public class TaskDefinitionVo extends TaskDefinition {
public class TaskDefinitionVO extends TaskDefinition {

/**
* process task related list
*/
private List<ProcessTaskRelation> processTaskRelationList;

public TaskDefinitionVo() {
public TaskDefinitionVO() {
}

public TaskDefinitionVo(List<ProcessTaskRelation> processTaskRelationList) {
public TaskDefinitionVO(List<ProcessTaskRelation> processTaskRelationList) {
this.processTaskRelationList = processTaskRelationList;
}

public static TaskDefinitionVo fromTaskDefinition(TaskDefinition taskDefinition) {
TaskDefinitionVo taskDefinitionVo = new TaskDefinitionVo();
public static TaskDefinitionVO fromTaskDefinition(TaskDefinition taskDefinition) {
TaskDefinitionVO taskDefinitionVo = new TaskDefinitionVO();
BeanUtils.copyProperties(taskDefinition, taskDefinitionVo);
if (TimeoutFlag.CLOSE == taskDefinition.getTimeoutFlag()) {
taskDefinitionVo.setTimeoutNotifyStrategy(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@
@Data
@NoArgsConstructor
@AllArgsConstructor
public class TaskInstanceCountVo {
public class TaskInstanceCountVO {

private int totalCount;

private List<TaskInstanceStatusCountDto> taskInstanceStatusCounts;

public static TaskInstanceCountVo empty() {
public static TaskInstanceCountVO empty() {
return of(Collections.emptyList());
}

public static TaskInstanceCountVo of(List<TaskInstanceStatusCountDto> taskInstanceStatusCounts) {
public static TaskInstanceCountVO of(List<TaskInstanceStatusCountDto> taskInstanceStatusCounts) {
taskInstanceStatusCounts = new ArrayList<>(taskInstanceStatusCounts);

Map<TaskExecutionStatus, TaskInstanceStatusCountDto> taskInstanceStatusCountMap =
Expand All @@ -57,7 +57,7 @@ public static TaskInstanceCountVo of(List<TaskInstanceStatusCountDto> taskInstan
}
}

TaskInstanceCountVo taskInstanceCountVo = new TaskInstanceCountVo();
TaskInstanceCountVO taskInstanceCountVo = new TaskInstanceCountVO();
taskInstanceCountVo.setTaskInstanceStatusCounts(taskInstanceStatusCounts);
taskInstanceCountVo
.setTotalCount(taskInstanceStatusCounts.stream().mapToInt(TaskInstanceStatusCountDto::getCount).sum());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,21 @@
@Data
@NoArgsConstructor
@AllArgsConstructor
public class WorkflowDefinitionCountVo {
public class WorkflowDefinitionCountVO {

private int count;

private List<WorkflowDefinitionCountDto> userList;

public static WorkflowDefinitionCountVo empty() {
return new WorkflowDefinitionCountVo(0, Collections.emptyList());
public static WorkflowDefinitionCountVO empty() {
return new WorkflowDefinitionCountVO(0, Collections.emptyList());
}

public static WorkflowDefinitionCountVo of(List<WorkflowDefinitionCountDto> workflowDefinitionCounts) {
public static WorkflowDefinitionCountVO of(List<WorkflowDefinitionCountDto> workflowDefinitionCounts) {
if (CollectionUtils.isEmpty(workflowDefinitionCounts)) {
return empty();
}
WorkflowDefinitionCountVo workflowDefinitionCountVo = new WorkflowDefinitionCountVo();
WorkflowDefinitionCountVO workflowDefinitionCountVo = new WorkflowDefinitionCountVO();
workflowDefinitionCountVo.setUserList(workflowDefinitionCounts);
workflowDefinitionCountVo
.setCount(workflowDefinitionCounts.stream().mapToInt(WorkflowDefinitionCountDto::getCount).sum());
Expand Down
Loading
Loading