fix: 修复查询任务日志报错的问题

This commit is contained in:
2024-08-04 22:47:21 +08:00
parent 39aebf4441
commit 513d8d9324
2 changed files with 10 additions and 6 deletions

View File

@@ -16,7 +16,6 @@
package top.continew.admin.job.api;
import com.aizuda.snailjob.common.core.model.Result;
import com.aizuda.snailjob.common.core.model.Result;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -27,10 +26,9 @@ import org.springframework.web.service.annotation.HttpExchange;
import org.springframework.web.service.annotation.PostExchange;
import top.continew.admin.job.model.JobInstanceLogPageResult;
import top.continew.admin.job.model.JobPageResult;
import top.continew.admin.job.model.resp.JobLogResp;
import top.continew.admin.job.model.resp.JobInstanceResp;
import top.continew.admin.job.model.resp.JobLogResp;
import java.time.LocalDateTime;
import java.util.List;
/**
@@ -60,7 +58,7 @@ public interface JobBatchApi {
@RequestParam(value = "jobName", required = false) String jobName,
@RequestParam(value = "groupName", required = false) String groupName,
@RequestParam(value = "taskBatchStatus", required = false) Integer taskBatchStatus,
@RequestParam(value = "datetimeRange", required = false) LocalDateTime[] datetimeRange,
@RequestParam(value = "datetimeRange", required = false) String[] datetimeRange,
@RequestParam(value = "page") Integer page,
@RequestParam(value = "size") Integer size);

View File

@@ -16,6 +16,8 @@
package top.continew.admin.job.service.impl;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import top.continew.admin.job.api.JobBatchApi;
@@ -29,6 +31,7 @@ import top.continew.admin.job.model.resp.JobLogResp;
import top.continew.admin.job.service.JobLogService;
import top.continew.starter.extension.crud.model.resp.PageResp;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
@@ -48,9 +51,12 @@ public class JobLogServiceImpl implements JobLogService {
@Override
public PageResp<JobLogResp> page(JobLogQuery query) {
LocalDateTime[] datetimeRange = query.getDatetimeRange();
return jobClient.requestPage(() -> jobBatchApi.page(query.getJobId(), query.getJobName(), query
.getGroupName(), query.getTaskBatchStatus() != null ? query.getTaskBatchStatus().getValue() : null, query
.getDatetimeRange(), query.getPage(), query.getSize()));
.getGroupName(), query.getTaskBatchStatus() != null
? query.getTaskBatchStatus().getValue()
: null, new String[] {DateUtil.format(datetimeRange[0], DatePattern.UTC_SIMPLE_PATTERN), DateUtil
.format(datetimeRange[1], DatePattern.UTC_SIMPLE_PATTERN)}, query.getPage(), query.getSize()));
}
@Override