mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-10-31 10:57:13 +08:00 
			
		
		
		
	refactor(schedule): 暂时下线查询日志详情功能(Snail Job 日志详情 API 变更为 WebSocket 模式)
This commit is contained in:
		| @@ -19,7 +19,10 @@ package top.continew.admin.schedule.api; | |||||||
| import com.aizuda.snailjob.common.core.model.Result; | import com.aizuda.snailjob.common.core.model.Result; | ||||||
| import org.springframework.cloud.openfeign.FeignClient; | import org.springframework.cloud.openfeign.FeignClient; | ||||||
| import org.springframework.cloud.openfeign.SpringQueryMap; | import org.springframework.cloud.openfeign.SpringQueryMap; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.GetMapping; | ||||||
|  | import org.springframework.web.bind.annotation.PostMapping; | ||||||
|  | import org.springframework.web.bind.annotation.PutMapping; | ||||||
|  | import org.springframework.web.bind.annotation.RequestBody; | ||||||
| import top.continew.admin.schedule.config.FeignRequestInterceptor; | import top.continew.admin.schedule.config.FeignRequestInterceptor; | ||||||
| import top.continew.admin.schedule.model.JobPageResult; | import top.continew.admin.schedule.model.JobPageResult; | ||||||
| import top.continew.admin.schedule.model.query.JobQuery; | import top.continew.admin.schedule.model.query.JobQuery; | ||||||
| @@ -28,7 +31,6 @@ import top.continew.admin.schedule.model.req.JobTriggerReq; | |||||||
| import top.continew.admin.schedule.model.resp.JobResp; | import top.continew.admin.schedule.model.resp.JobResp; | ||||||
|  |  | ||||||
| import java.util.List; | import java.util.List; | ||||||
| import java.util.Set; |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * 任务 REST API |  * 任务 REST API | ||||||
| @@ -67,15 +69,6 @@ public interface JobApi { | |||||||
|     @PutMapping |     @PutMapping | ||||||
|     Result<Boolean> update(@RequestBody JobReq req); |     Result<Boolean> update(@RequestBody JobReq req); | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 删除 |  | ||||||
|      * |  | ||||||
|      * @param ids ID 列表 |  | ||||||
|      * @return 响应信息 |  | ||||||
|      */ |  | ||||||
|     @DeleteMapping("/ids") |  | ||||||
|     Result<Boolean> delete(@RequestBody Set<Long> ids); |  | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 执行 |      * 执行 | ||||||
|      * |      * | ||||||
|   | |||||||
| @@ -23,12 +23,8 @@ import org.springframework.web.bind.annotation.GetMapping; | |||||||
| import org.springframework.web.bind.annotation.PathVariable; | import org.springframework.web.bind.annotation.PathVariable; | ||||||
| import org.springframework.web.bind.annotation.PostMapping; | import org.springframework.web.bind.annotation.PostMapping; | ||||||
| import top.continew.admin.schedule.config.FeignRequestInterceptor; | import top.continew.admin.schedule.config.FeignRequestInterceptor; | ||||||
| import top.continew.admin.schedule.model.JobInstanceLogPageResult; |  | ||||||
| import top.continew.admin.schedule.model.JobPageResult; | import top.continew.admin.schedule.model.JobPageResult; | ||||||
| import top.continew.admin.schedule.model.query.JobInstanceLogQuery; |  | ||||||
| import top.continew.admin.schedule.model.query.JobInstanceQuery; |  | ||||||
| import top.continew.admin.schedule.model.query.JobLogQuery; | import top.continew.admin.schedule.model.query.JobLogQuery; | ||||||
| import top.continew.admin.schedule.model.resp.JobInstanceResp; |  | ||||||
| import top.continew.admin.schedule.model.resp.JobLogResp; | import top.continew.admin.schedule.model.resp.JobLogResp; | ||||||
|  |  | ||||||
| import java.util.List; | import java.util.List; | ||||||
| @@ -69,22 +65,4 @@ public interface JobBatchApi { | |||||||
|      */ |      */ | ||||||
|     @PostMapping("/batch/retry/{id}") |     @PostMapping("/batch/retry/{id}") | ||||||
|     Result<Boolean> retry(@PathVariable("id") Long id); |     Result<Boolean> retry(@PathVariable("id") Long id); | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 分页查询任务实例列表 |  | ||||||
|      * |  | ||||||
|      * @param query 查询条件 |  | ||||||
|      * @return 响应信息 |  | ||||||
|      */ |  | ||||||
|     @GetMapping("/task/list") |  | ||||||
|     JobPageResult<List<JobInstanceResp>> pageTask(@SpringQueryMap JobInstanceQuery query); |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 分页查询任务实例日志列表 |  | ||||||
|      * |  | ||||||
|      * @param query 查询条件 |  | ||||||
|      * @return 响应信息 |  | ||||||
|      */ |  | ||||||
|     @GetMapping("/log/list") |  | ||||||
|     Result<JobInstanceLogPageResult> pageLog(@SpringQueryMap JobInstanceLogQuery query); |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -31,6 +31,7 @@ import top.continew.admin.schedule.model.req.JobStatusReq; | |||||||
| import top.continew.admin.schedule.model.req.JobTriggerReq; | import top.continew.admin.schedule.model.req.JobTriggerReq; | ||||||
| import top.continew.admin.schedule.model.resp.JobResp; | import top.continew.admin.schedule.model.resp.JobResp; | ||||||
| import top.continew.admin.schedule.service.JobService; | import top.continew.admin.schedule.service.JobService; | ||||||
|  | import top.continew.starter.core.util.validation.CheckUtils; | ||||||
| import top.continew.starter.extension.crud.model.resp.PageResp; | import top.continew.starter.extension.crud.model.resp.PageResp; | ||||||
| import top.continew.starter.extension.crud.validation.CrudValidationGroup; | import top.continew.starter.extension.crud.validation.CrudValidationGroup; | ||||||
| import top.continew.starter.log.annotation.Log; | import top.continew.starter.log.annotation.Log; | ||||||
| @@ -64,7 +65,7 @@ public class JobController { | |||||||
|     @PostMapping |     @PostMapping | ||||||
|     @Validated(CrudValidationGroup.Create.class) |     @Validated(CrudValidationGroup.Create.class) | ||||||
|     public void create(@RequestBody @Valid JobReq req) { |     public void create(@RequestBody @Valid JobReq req) { | ||||||
|         baseService.create(req); |         CheckUtils.throwIf(!baseService.create(req), "任务创建失败"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Operation(summary = "修改任务", description = "修改任务") |     @Operation(summary = "修改任务", description = "修改任务") | ||||||
| @@ -73,14 +74,14 @@ public class JobController { | |||||||
|     @PutMapping("/{id}") |     @PutMapping("/{id}") | ||||||
|     @Validated(CrudValidationGroup.Update.class) |     @Validated(CrudValidationGroup.Update.class) | ||||||
|     public void update(@RequestBody @Valid JobReq req, @PathVariable Long id) { |     public void update(@RequestBody @Valid JobReq req, @PathVariable Long id) { | ||||||
|         baseService.update(req, id); |         CheckUtils.throwIf(!baseService.update(req, id), "任务修改失败"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Operation(summary = "修改任务状态", description = "修改任务状态") |     @Operation(summary = "修改任务状态", description = "修改任务状态") | ||||||
|     @SaCheckPermission("schedule:job:update") |     @SaCheckPermission("schedule:job:update") | ||||||
|     @PatchMapping("/{id}/status") |     @PatchMapping("/{id}/status") | ||||||
|     public void updateStatus(@RequestBody @Valid JobStatusReq req, @PathVariable Long id) { |     public void updateStatus(@RequestBody @Valid JobStatusReq req, @PathVariable Long id) { | ||||||
|         baseService.updateStatus(req, id); |         CheckUtils.throwIf(!baseService.updateStatus(req, id), "任务状态修改失败"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Operation(summary = "删除任务", description = "删除任务") |     @Operation(summary = "删除任务", description = "删除任务") | ||||||
| @@ -88,7 +89,7 @@ public class JobController { | |||||||
|     @SaCheckPermission("schedule:job:delete") |     @SaCheckPermission("schedule:job:delete") | ||||||
|     @DeleteMapping("/{id}") |     @DeleteMapping("/{id}") | ||||||
|     public void delete(@PathVariable Long id) { |     public void delete(@PathVariable Long id) { | ||||||
|         baseService.delete(id); |         CheckUtils.throwIf(!baseService.delete(id), "任务删除失败"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Operation(summary = "执行任务", description = "执行任务") |     @Operation(summary = "执行任务", description = "执行任务") | ||||||
| @@ -98,7 +99,7 @@ public class JobController { | |||||||
|     public void trigger(@PathVariable Long id) { |     public void trigger(@PathVariable Long id) { | ||||||
|         JobTriggerReq req = new JobTriggerReq(); |         JobTriggerReq req = new JobTriggerReq(); | ||||||
|         req.setJobId(id); |         req.setJobId(id); | ||||||
|         baseService.trigger(req); |         CheckUtils.throwIf(!baseService.trigger(req), "任务执行失败"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Log(ignore = true) |     @Log(ignore = true) | ||||||
|   | |||||||
| @@ -24,17 +24,11 @@ import io.swagger.v3.oas.annotations.tags.Tag; | |||||||
| import jakarta.validation.Valid; | import jakarta.validation.Valid; | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| import top.continew.admin.schedule.model.JobInstanceLogPageResult; |  | ||||||
| import top.continew.admin.schedule.model.query.JobInstanceLogQuery; |  | ||||||
| import top.continew.admin.schedule.model.query.JobInstanceQuery; |  | ||||||
| import top.continew.admin.schedule.model.query.JobLogQuery; | import top.continew.admin.schedule.model.query.JobLogQuery; | ||||||
| import top.continew.admin.schedule.model.resp.JobInstanceResp; |  | ||||||
| import top.continew.admin.schedule.model.resp.JobLogResp; | import top.continew.admin.schedule.model.resp.JobLogResp; | ||||||
| import top.continew.admin.schedule.service.JobLogService; | import top.continew.admin.schedule.service.JobLogService; | ||||||
| import top.continew.starter.extension.crud.model.resp.PageResp; | import top.continew.starter.extension.crud.model.resp.PageResp; | ||||||
|  |  | ||||||
| import java.util.List; |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * 任务日志 API |  * 任务日志 API | ||||||
|  * |  * | ||||||
| @@ -72,18 +66,4 @@ public class JobLogController { | |||||||
|     public void retry(@PathVariable Long id) { |     public void retry(@PathVariable Long id) { | ||||||
|         baseService.retry(id); |         baseService.retry(id); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Operation(summary = "查询任务实例列表", description = "查询任务实例列表") |  | ||||||
|     @SaCheckPermission("schedule:log:list") |  | ||||||
|     @GetMapping("/instance") |  | ||||||
|     public List<JobInstanceResp> listInstance(@Valid JobInstanceQuery query) { |  | ||||||
|         return baseService.listInstance(query); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Operation(summary = "分页查询任务实例日志列表", description = "分页查询任务实例日志列表") |  | ||||||
|     @SaCheckPermission("schedule:log:list") |  | ||||||
|     @GetMapping("/instance/log") |  | ||||||
|     public JobInstanceLogPageResult pageInstanceLog(@Valid JobInstanceLogQuery query) { |  | ||||||
|         return baseService.pageInstanceLog(query); |  | ||||||
|     } |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,77 +0,0 @@ | |||||||
| /* |  | ||||||
|  * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. |  | ||||||
|  * |  | ||||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); |  | ||||||
|  * you may not use this file except in compliance with the License. |  | ||||||
|  * You may obtain a copy of the License at |  | ||||||
|  * |  | ||||||
|  *     http://www.apache.org/licenses/LICENSE-2.0 |  | ||||||
|  * |  | ||||||
|  * Unless required by applicable law or agreed to in writing, software |  | ||||||
|  * distributed under the License is distributed on an "AS IS" BASIS, |  | ||||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |  | ||||||
|  * See the License for the specific language governing permissions and |  | ||||||
|  * limitations under the License. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| package top.continew.admin.schedule.model.query; |  | ||||||
|  |  | ||||||
| import io.swagger.v3.oas.annotations.media.Schema; |  | ||||||
| import jakarta.validation.constraints.Min; |  | ||||||
| import lombok.Data; |  | ||||||
| import org.hibernate.validator.constraints.Range; |  | ||||||
|  |  | ||||||
| import java.io.Serial; |  | ||||||
| import java.io.Serializable; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 任务实例日志查询条件 |  | ||||||
|  * |  | ||||||
|  * @author KAI |  | ||||||
|  * @since 2024/6/28 16:58 |  | ||||||
|  */ |  | ||||||
| @Data |  | ||||||
| @Schema(description = "任务实例日志查询条件") |  | ||||||
| public class JobInstanceLogQuery implements Serializable { |  | ||||||
|  |  | ||||||
|     @Serial |  | ||||||
|     private static final long serialVersionUID = 1L; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 任务 ID |  | ||||||
|      */ |  | ||||||
|     @Schema(description = "任务ID", example = "1") |  | ||||||
|     private Long jobId; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 任务批次 ID |  | ||||||
|      */ |  | ||||||
|     @Schema(description = "任务批次ID", example = "1") |  | ||||||
|     private Long taskBatchId; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 任务实例 ID |  | ||||||
|      */ |  | ||||||
|     @Schema(description = "任务实例ID", example = "1") |  | ||||||
|     private Long taskId; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 开始 ID |  | ||||||
|      */ |  | ||||||
|     @Schema(description = "开始ID", example = "2850") |  | ||||||
|     private Integer startId; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 起始索引 |  | ||||||
|      */ |  | ||||||
|     @Schema(description = "起始索引", example = "0") |  | ||||||
|     @Min(value = 0, message = "起始索引最小值为 {value}") |  | ||||||
|     private Integer fromIndex = 0; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 每页条数 |  | ||||||
|      */ |  | ||||||
|     @Schema(description = "每页条数", example = "50") |  | ||||||
|     @Range(min = 1, max = 1000, message = "每页条数(取值范围 {min}-{max})") |  | ||||||
|     private Integer size = 50; |  | ||||||
| } |  | ||||||
| @@ -1,49 +0,0 @@ | |||||||
| /* |  | ||||||
|  * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. |  | ||||||
|  * |  | ||||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); |  | ||||||
|  * you may not use this file except in compliance with the License. |  | ||||||
|  * You may obtain a copy of the License at |  | ||||||
|  * |  | ||||||
|  *     http://www.apache.org/licenses/LICENSE-2.0 |  | ||||||
|  * |  | ||||||
|  * Unless required by applicable law or agreed to in writing, software |  | ||||||
|  * distributed under the License is distributed on an "AS IS" BASIS, |  | ||||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |  | ||||||
|  * See the License for the specific language governing permissions and |  | ||||||
|  * limitations under the License. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| package top.continew.admin.schedule.model.query; |  | ||||||
|  |  | ||||||
| import io.swagger.v3.oas.annotations.media.Schema; |  | ||||||
| import lombok.Data; |  | ||||||
|  |  | ||||||
| import java.io.Serial; |  | ||||||
| import java.io.Serializable; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 任务实例查询条件 |  | ||||||
|  * |  | ||||||
|  * @author KAI |  | ||||||
|  * @since 2024/6/28 16:58 |  | ||||||
|  */ |  | ||||||
| @Data |  | ||||||
| @Schema(description = "任务实例查询条件") |  | ||||||
| public class JobInstanceQuery implements Serializable { |  | ||||||
|  |  | ||||||
|     @Serial |  | ||||||
|     private static final long serialVersionUID = 1L; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 任务 ID |  | ||||||
|      */ |  | ||||||
|     @Schema(description = "任务ID", example = "1") |  | ||||||
|     private Long jobId; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 任务批次 ID |  | ||||||
|      */ |  | ||||||
|     @Schema(description = "任务批次ID", example = "1") |  | ||||||
|     private Long taskBatchId; |  | ||||||
| } |  | ||||||
| @@ -1,86 +0,0 @@ | |||||||
| /* |  | ||||||
|  * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. |  | ||||||
|  * |  | ||||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); |  | ||||||
|  * you may not use this file except in compliance with the License. |  | ||||||
|  * You may obtain a copy of the License at |  | ||||||
|  * |  | ||||||
|  *     http://www.apache.org/licenses/LICENSE-2.0 |  | ||||||
|  * |  | ||||||
|  * Unless required by applicable law or agreed to in writing, software |  | ||||||
|  * distributed under the License is distributed on an "AS IS" BASIS, |  | ||||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |  | ||||||
|  * See the License for the specific language governing permissions and |  | ||||||
|  * limitations under the License. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| package top.continew.admin.schedule.model.resp; |  | ||||||
|  |  | ||||||
| import io.swagger.v3.oas.annotations.media.Schema; |  | ||||||
| import lombok.Data; |  | ||||||
|  |  | ||||||
| import java.io.Serial; |  | ||||||
| import java.io.Serializable; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 任务实例响应参数 |  | ||||||
|  * |  | ||||||
|  * @author KAI |  | ||||||
|  * @author Charles7c |  | ||||||
|  * @since 2024/6/28 16:58 |  | ||||||
|  */ |  | ||||||
| @Data |  | ||||||
| @Schema(description = "任务实例响应参数") |  | ||||||
| public class JobInstanceResp implements Serializable { |  | ||||||
|  |  | ||||||
|     @Serial |  | ||||||
|     private static final long serialVersionUID = 1L; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * ID |  | ||||||
|      */ |  | ||||||
|     @Schema(description = "ID", example = "1") |  | ||||||
|     private Long id; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 任务组 |  | ||||||
|      */ |  | ||||||
|     @Schema(description = "任务组", example = "continew-admin") |  | ||||||
|     private String groupName; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 任务 ID |  | ||||||
|      */ |  | ||||||
|     @Schema(description = "任务ID", example = "1") |  | ||||||
|     private Long jobId; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 任务批次 ID |  | ||||||
|      */ |  | ||||||
|     @Schema(description = "任务批次ID", example = "1") |  | ||||||
|     private Long taskBatchId; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 执行状态 |  | ||||||
|      */ |  | ||||||
|     @Schema(description = "执行状态", example = "1") |  | ||||||
|     private Integer taskStatus; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 重试次数 |  | ||||||
|      */ |  | ||||||
|     @Schema(description = "重试次数", example = "1") |  | ||||||
|     private Integer retryCount; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 执行结果 |  | ||||||
|      */ |  | ||||||
|     @Schema(description = "执行结果", example = "") |  | ||||||
|     private String resultMessage; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 客户端信息 |  | ||||||
|      */ |  | ||||||
|     @Schema(description = "客户端信息", example = "1812406095098114048@192.168.138.48:1789") |  | ||||||
|     private String clientInfo; |  | ||||||
| } |  | ||||||
| @@ -16,16 +16,10 @@ | |||||||
|  |  | ||||||
| package top.continew.admin.schedule.service; | package top.continew.admin.schedule.service; | ||||||
|  |  | ||||||
| import top.continew.admin.schedule.model.JobInstanceLogPageResult; |  | ||||||
| import top.continew.admin.schedule.model.query.JobInstanceLogQuery; |  | ||||||
| import top.continew.admin.schedule.model.query.JobInstanceQuery; |  | ||||||
| import top.continew.admin.schedule.model.query.JobLogQuery; | import top.continew.admin.schedule.model.query.JobLogQuery; | ||||||
| import top.continew.admin.schedule.model.resp.JobInstanceResp; |  | ||||||
| import top.continew.admin.schedule.model.resp.JobLogResp; | import top.continew.admin.schedule.model.resp.JobLogResp; | ||||||
| import top.continew.starter.extension.crud.model.resp.PageResp; | import top.continew.starter.extension.crud.model.resp.PageResp; | ||||||
|  |  | ||||||
| import java.util.List; |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * 任务日志业务接口 |  * 任务日志业务接口 | ||||||
|  * |  * | ||||||
| @@ -58,20 +52,4 @@ public interface JobLogService { | |||||||
|      * @return 重试结果 |      * @return 重试结果 | ||||||
|      */ |      */ | ||||||
|     boolean retry(Long id); |     boolean retry(Long id); | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 查询任务实例列表 |  | ||||||
|      * |  | ||||||
|      * @param query 查询条件 |  | ||||||
|      * @return 列表信息 |  | ||||||
|      */ |  | ||||||
|     List<JobInstanceResp> listInstance(JobInstanceQuery query); |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 分页查询任务实例日志列表 |  | ||||||
|      * |  | ||||||
|      * @param query 查询条件 |  | ||||||
|      * @return 分页列表信息 |  | ||||||
|      */ |  | ||||||
|     JobInstanceLogPageResult pageInstanceLog(JobInstanceLogQuery query); |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -20,17 +20,11 @@ import lombok.RequiredArgsConstructor; | |||||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||||
| import top.continew.admin.schedule.api.JobBatchApi; | import top.continew.admin.schedule.api.JobBatchApi; | ||||||
| import top.continew.admin.schedule.api.JobClient; | import top.continew.admin.schedule.api.JobClient; | ||||||
| import top.continew.admin.schedule.model.JobInstanceLogPageResult; |  | ||||||
| import top.continew.admin.schedule.model.query.JobInstanceLogQuery; |  | ||||||
| import top.continew.admin.schedule.model.query.JobInstanceQuery; |  | ||||||
| import top.continew.admin.schedule.model.query.JobLogQuery; | import top.continew.admin.schedule.model.query.JobLogQuery; | ||||||
| import top.continew.admin.schedule.model.resp.JobInstanceResp; |  | ||||||
| import top.continew.admin.schedule.model.resp.JobLogResp; | import top.continew.admin.schedule.model.resp.JobLogResp; | ||||||
| import top.continew.admin.schedule.service.JobLogService; | import top.continew.admin.schedule.service.JobLogService; | ||||||
| import top.continew.starter.extension.crud.model.resp.PageResp; | import top.continew.starter.extension.crud.model.resp.PageResp; | ||||||
|  |  | ||||||
| import java.util.List; |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * 任务日志业务实现 |  * 任务日志业务实现 | ||||||
|  * |  * | ||||||
| @@ -59,14 +53,4 @@ public class JobLogServiceImpl implements JobLogService { | |||||||
|     public boolean retry(Long id) { |     public boolean retry(Long id) { | ||||||
|         return Boolean.TRUE.equals(jobClient.request(() -> jobBatchApi.retry(id))); |         return Boolean.TRUE.equals(jobClient.request(() -> jobBatchApi.retry(id))); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public List<JobInstanceResp> listInstance(JobInstanceQuery query) { |  | ||||||
|         return jobClient.requestPage(() -> jobBatchApi.pageTask(query)).getList(); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public JobInstanceLogPageResult pageInstanceLog(JobInstanceLogQuery query) { |  | ||||||
|         return jobClient.request(() -> jobBatchApi.pageLog(query)); |  | ||||||
|     } |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -32,8 +32,8 @@ import top.continew.admin.schedule.model.resp.JobResp; | |||||||
| import top.continew.admin.schedule.service.JobService; | import top.continew.admin.schedule.service.JobService; | ||||||
| import top.continew.starter.extension.crud.model.resp.PageResp; | import top.continew.starter.extension.crud.model.resp.PageResp; | ||||||
|  |  | ||||||
| import java.util.Collections; |  | ||||||
| import java.util.List; | import java.util.List; | ||||||
|  | import java.util.Set; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * 任务业务实现 |  * 任务业务实现 | ||||||
| @@ -75,7 +75,7 @@ public class JobServiceImpl implements JobService { | |||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public boolean delete(Long id) { |     public boolean delete(Long id) { | ||||||
|         return Boolean.TRUE.equals(jobClient.request(() -> jobApi.delete(Collections.singleton(id)))); |         return SnailJobOpenApi.deleteJob(Set.of(id)).execute(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|   | |||||||
| @@ -17,6 +17,5 @@ VALUES | |||||||
|  |  | ||||||
| (8020, '任务日志', 8000, 2, '/schedule/log', 'ScheduleLog', 'schedule/log/index', NULL, 'find-replace', b'0', b'0', b'0', NULL, 2, 1, 1, NOW()), | (8020, '任务日志', 8000, 2, '/schedule/log', 'ScheduleLog', 'schedule/log/index', NULL, 'find-replace', b'0', b'0', b'0', NULL, 2, 1, 1, NOW()), | ||||||
| (8021, '列表', 8020, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'schedule:log:list', 1, 1, 1, NOW()), | (8021, '列表', 8020, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'schedule:log:list', 1, 1, 1, NOW()), | ||||||
| (8022, '详情', 8020, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'schedule:log:get', 2, 1, 1, NOW()), | (8022, '停止', 8020, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'schedule:log:stop', 3, 1, 1, NOW()), | ||||||
| (8023, '停止', 8020, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'schedule:log:stop', 3, 1, 1, NOW()), | (8023, '重试', 8020, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'schedule:log:retry', 4, 1, 1, NOW()); | ||||||
| (8024, '重试', 8020, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'schedule:log:retry', 4, 1, 1, NOW()); |  | ||||||
|   | |||||||
| @@ -17,6 +17,5 @@ VALUES | |||||||
|  |  | ||||||
| (8020, '任务日志', 8000, 2, '/schedule/log', 'ScheduleLog', 'schedule/log/index', NULL, 'find-replace', false, false, false, NULL, 2, 1, 1, NOW()), | (8020, '任务日志', 8000, 2, '/schedule/log', 'ScheduleLog', 'schedule/log/index', NULL, 'find-replace', false, false, false, NULL, 2, 1, 1, NOW()), | ||||||
| (8021, '列表', 8020, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'schedule:log:list', 1, 1, 1, NOW()), | (8021, '列表', 8020, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'schedule:log:list', 1, 1, 1, NOW()), | ||||||
| (8022, '详情', 8020, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'schedule:log:get', 2, 1, 1, NOW()), | (8022, '停止', 8020, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'schedule:log:stop', 3, 1, 1, NOW()), | ||||||
| (8023, '停止', 8020, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'schedule:log:stop', 3, 1, 1, NOW()), | (8023, '重试', 8020, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'schedule:log:retry', 4, 1, 1, NOW()); | ||||||
| (8024, '重试', 8020, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'schedule:log:retry', 4, 1, 1, NOW()); |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user