feat(sj_1.1.0-beta1): DashboardController 时间段使用Mvc自动转换LocalDateTime
This commit is contained in:
parent
0a5a8848a1
commit
e5a5f9a9c5
@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@ -42,8 +43,8 @@ public class DashboardController {
|
||||
public DashboardRetryLineResponseVO retryLineList(BaseQueryVO baseQueryVO,
|
||||
@RequestParam(value = "groupName", required = false) String groupName,
|
||||
@RequestParam(value = "type", required = false, defaultValue = "WEEK") String type,
|
||||
@RequestParam(value = "startTime", required = false) String startTime,
|
||||
@RequestParam(value = "endTime", required = false) String endTime) {
|
||||
@RequestParam(value = "startTime", required = false) LocalDateTime startTime,
|
||||
@RequestParam(value = "endTime", required = false) LocalDateTime endTime) {
|
||||
return dashBoardService.retryLineList(baseQueryVO, groupName, type, startTime, endTime);
|
||||
}
|
||||
|
||||
@ -53,8 +54,8 @@ public class DashboardController {
|
||||
@RequestParam(value = "mode", required = false) String mode,
|
||||
@RequestParam(value = "groupName", required = false) String groupName,
|
||||
@RequestParam(value = "type", required = false, defaultValue = "WEEK") String type,
|
||||
@RequestParam(value = "startTime", required = false) String startTime,
|
||||
@RequestParam(value = "endTime", required = false) String endTime) {
|
||||
@RequestParam(value = "startTime", required = false) LocalDateTime startTime,
|
||||
@RequestParam(value = "endTime", required = false) LocalDateTime endTime) {
|
||||
return dashBoardService.jobLineList(baseQueryVO, mode, groupName, type, startTime, endTime);
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ import com.aizuda.snailjob.server.web.model.response.DashboardCardResponseVO;
|
||||
import com.aizuda.snailjob.server.web.model.response.DashboardRetryLineResponseVO;
|
||||
import com.aizuda.snailjob.server.web.model.response.ServerNodeResponseVO;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -17,9 +18,9 @@ public interface DashboardService {
|
||||
|
||||
DashboardCardResponseVO taskRetryJob();
|
||||
|
||||
DashboardRetryLineResponseVO retryLineList(BaseQueryVO baseQueryVO, String groupName, String type, String startTime, String endTime);
|
||||
DashboardRetryLineResponseVO retryLineList(BaseQueryVO baseQueryVO, String groupName, String type, LocalDateTime startTime, LocalDateTime endTime);
|
||||
|
||||
DashboardRetryLineResponseVO jobLineList(BaseQueryVO baseQueryVO, String mode, String groupName, String type, String startTime, String endTime);
|
||||
DashboardRetryLineResponseVO jobLineList(BaseQueryVO baseQueryVO, String mode, String groupName, String type, LocalDateTime startTime, LocalDateTime endTime);
|
||||
|
||||
PageResult<List<ServerNodeResponseVO>> pods(ServerNodeQueryVO serverNodeQueryVO);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.aizuda.snailjob.server.web.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.aizuda.snailjob.common.core.enums.NodeTypeEnum;
|
||||
import com.aizuda.snailjob.common.core.model.Result;
|
||||
@ -51,7 +52,6 @@ import org.springframework.web.client.RestTemplate;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -149,7 +149,7 @@ public class DashboardServiceImpl implements DashboardService {
|
||||
@Override
|
||||
public DashboardRetryLineResponseVO retryLineList(BaseQueryVO baseQueryVO,
|
||||
String groupName, String type,
|
||||
String startTime, String endTime) {
|
||||
LocalDateTime startTime, LocalDateTime endTime) {
|
||||
|
||||
// 查询登录用户权限
|
||||
UserSessionVO userSessionVO = UserSessionUtils.currentUserSession();
|
||||
@ -177,13 +177,9 @@ public class DashboardServiceImpl implements DashboardService {
|
||||
// 折线图
|
||||
DateTypeEnum dateTypeEnum = DateTypeEnum.valueOf(type);
|
||||
LocalDateTime startDateTime = dateTypeEnum.getStartTime().apply(
|
||||
StrUtil.isNotBlank(startTime) ?
|
||||
LocalDateTime.parse(startTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) :
|
||||
LocalDateTime.now());
|
||||
ObjUtil.isNotNull(startTime) ? startTime : LocalDateTime.now());
|
||||
LocalDateTime endDateTime = dateTypeEnum.getEndTime().apply(
|
||||
StrUtil.isNotBlank(endTime) ?
|
||||
LocalDateTime.parse(endTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) :
|
||||
LocalDateTime.now());
|
||||
ObjUtil.isNotNull(endTime) ? endTime : LocalDateTime.now());
|
||||
List<DashboardLineResponseDO> dashboardRetryLinkeResponseDOList = retrySummaryMapper.selectRetryLineList(
|
||||
DashboardLineEnum.dateFormat(type),
|
||||
new LambdaQueryWrapper<RetrySummary>()
|
||||
@ -213,7 +209,7 @@ public class DashboardServiceImpl implements DashboardService {
|
||||
@Override
|
||||
public DashboardRetryLineResponseVO jobLineList(BaseQueryVO baseQueryVO,
|
||||
String mode, String groupName, String type,
|
||||
String startTime, String endTime) {
|
||||
LocalDateTime startTime, LocalDateTime endTime) {
|
||||
|
||||
// 查询登录用户权限
|
||||
UserSessionVO userSessionVO = UserSessionUtils.currentUserSession();
|
||||
@ -248,13 +244,9 @@ public class DashboardServiceImpl implements DashboardService {
|
||||
// 折线图
|
||||
DateTypeEnum dateTypeEnum = DateTypeEnum.valueOf(type);
|
||||
LocalDateTime startDateTime = dateTypeEnum.getStartTime().apply(
|
||||
StrUtil.isNotBlank(startTime) ?
|
||||
LocalDateTime.parse(startTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) :
|
||||
LocalDateTime.now());
|
||||
ObjUtil.isNotNull(startTime) ? startTime : LocalDateTime.now());
|
||||
LocalDateTime endDateTime = dateTypeEnum.getEndTime().apply(
|
||||
StrUtil.isNotBlank(endTime) ?
|
||||
LocalDateTime.parse(endTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) :
|
||||
LocalDateTime.now());
|
||||
ObjUtil.isNotNull(endTime) ? endTime : LocalDateTime.now());
|
||||
List<DashboardLineResponseDO> dashboardLineResponseDOList = jobSummaryMapper.selectJobLineList(
|
||||
DashboardLineEnum.dateFormat(type),
|
||||
new LambdaQueryWrapper<JobSummary>()
|
||||
|
Loading…
Reference in New Issue
Block a user