ruanwenjun commented on code in PR #15193:
URL:
https://github.com/apache/dolphinscheduler/pull/15193#discussion_r1401412757
##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataAnalysisController.java:
##########
@@ -107,35 +91,30 @@ public Result<TaskCountDto>
countTaskState(@Parameter(hidden = true) @RequestAtt
@GetMapping(value = "/process-state-count")
@ResponseStatus(HttpStatus.OK)
@ApiException(COUNT_PROCESS_INSTANCE_STATE_ERROR)
- public Result<TaskCountDto> countProcessInstanceState(@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, defaultValue = "0") long projectCode) {
-
- TaskCountDto taskCountDto =
-
dataAnalysisService.countProcessInstanceStateByProject(loginUser, projectCode,
startDate, endDate);
- return Result.success(taskCountDto);
+ 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) {
+ if (projectCode == null) {
+ return
Result.success(dataAnalysisService.getAllWorkflowInstanceStateCount(loginUser,
startDate, endDate));
+ }
+ return Result.success(
+
dataAnalysisService.getWorkflowInstanceStateCountByProject(loginUser,
projectCode, startDate, endDate));
}
- /**
- * statistics the process definition quantities of certain person
- *
- * @param loginUser login user
- * @param projectCode project code
- * @return definition count in project code
- */
@Operation(summary = "countDefinitionByUser", description =
"COUNT_PROCESS_DEFINITION_BY_USER_NOTES")
@Parameters({
@Parameter(name = "projectCode", description = "PROJECT_CODE",
schema = @Schema(implementation = long.class, example = "100"))
})
@GetMapping(value = "/define-user-count")
@ResponseStatus(HttpStatus.OK)
@ApiException(COUNT_PROCESS_DEFINITION_USER_ERROR)
- public Result<DefineUserDto> countDefinitionByUser(@Parameter(hidden =
true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
- @RequestParam(value =
"projectCode", required = false, defaultValue = "0") long projectCode) {
-
- DefineUserDto defineUserDto =
dataAnalysisService.countDefinitionByUser(loginUser, projectCode);
- return Result.success(defineUserDto);
+ public Result<WorkflowDefinitionCountVo>
countDefinitionByUser(@Parameter(hidden = true) @RequestAttribute(value =
Constants.SESSION_USER) User loginUser,
+
@RequestParam(value = "projectCode", required = false) Long projectCode) {
+ if (projectCode == null || projectCode == 0) {
Review Comment:
Since if from home page the projectCode will be 0... this should be refactor.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]