Skip to content

Commit 600f447

Browse files
committed
refactor(schedule): 暂时下线查询日志详情功能(Snail Job 日志详情 API 变更为 WebSocket 模式)
1 parent 819be06 commit 600f447

File tree

12 files changed

+16
-316
lines changed

12 files changed

+16
-316
lines changed

continew-plugin/continew-plugin-schedule/src/main/java/top/continew/admin/schedule/api/JobApi.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919
import com.aizuda.snailjob.common.core.model.Result;
2020
import org.springframework.cloud.openfeign.FeignClient;
2121
import org.springframework.cloud.openfeign.SpringQueryMap;
22-
import org.springframework.web.bind.annotation.*;
22+
import org.springframework.web.bind.annotation.GetMapping;
23+
import org.springframework.web.bind.annotation.PostMapping;
24+
import org.springframework.web.bind.annotation.PutMapping;
25+
import org.springframework.web.bind.annotation.RequestBody;
2326
import top.continew.admin.schedule.config.FeignRequestInterceptor;
2427
import top.continew.admin.schedule.model.JobPageResult;
2528
import top.continew.admin.schedule.model.query.JobQuery;
@@ -28,7 +31,6 @@
2831
import top.continew.admin.schedule.model.resp.JobResp;
2932

3033
import java.util.List;
31-
import java.util.Set;
3234

3335
/**
3436
* 任务 REST API
@@ -67,15 +69,6 @@ public interface JobApi {
6769
@PutMapping
6870
Result<Boolean> update(@RequestBody JobReq req);
6971

70-
/**
71-
* 删除
72-
*
73-
* @param ids ID 列表
74-
* @return 响应信息
75-
*/
76-
@DeleteMapping("/ids")
77-
Result<Boolean> delete(@RequestBody Set<Long> ids);
78-
7972
/**
8073
* 执行
8174
*

continew-plugin/continew-plugin-schedule/src/main/java/top/continew/admin/schedule/api/JobBatchApi.java

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,8 @@
2323
import org.springframework.web.bind.annotation.PathVariable;
2424
import org.springframework.web.bind.annotation.PostMapping;
2525
import top.continew.admin.schedule.config.FeignRequestInterceptor;
26-
import top.continew.admin.schedule.model.JobInstanceLogPageResult;
2726
import top.continew.admin.schedule.model.JobPageResult;
28-
import top.continew.admin.schedule.model.query.JobInstanceLogQuery;
29-
import top.continew.admin.schedule.model.query.JobInstanceQuery;
3027
import top.continew.admin.schedule.model.query.JobLogQuery;
31-
import top.continew.admin.schedule.model.resp.JobInstanceResp;
3228
import top.continew.admin.schedule.model.resp.JobLogResp;
3329

3430
import java.util.List;
@@ -69,22 +65,4 @@ public interface JobBatchApi {
6965
*/
7066
@PostMapping("/batch/retry/{id}")
7167
Result<Boolean> retry(@PathVariable("id") Long id);
72-
73-
/**
74-
* 分页查询任务实例列表
75-
*
76-
* @param query 查询条件
77-
* @return 响应信息
78-
*/
79-
@GetMapping("/task/list")
80-
JobPageResult<List<JobInstanceResp>> pageTask(@SpringQueryMap JobInstanceQuery query);
81-
82-
/**
83-
* 分页查询任务实例日志列表
84-
*
85-
* @param query 查询条件
86-
* @return 响应信息
87-
*/
88-
@GetMapping("/log/list")
89-
Result<JobInstanceLogPageResult> pageLog(@SpringQueryMap JobInstanceLogQuery query);
9068
}

continew-plugin/continew-plugin-schedule/src/main/java/top/continew/admin/schedule/controller/JobController.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import top.continew.admin.schedule.model.req.JobTriggerReq;
3232
import top.continew.admin.schedule.model.resp.JobResp;
3333
import top.continew.admin.schedule.service.JobService;
34+
import top.continew.starter.core.util.validation.CheckUtils;
3435
import top.continew.starter.extension.crud.model.resp.PageResp;
3536
import top.continew.starter.extension.crud.validation.CrudValidationGroup;
3637
import top.continew.starter.log.annotation.Log;
@@ -64,7 +65,7 @@ public PageResp<JobResp> page(JobQuery query) {
6465
@PostMapping
6566
@Validated(CrudValidationGroup.Create.class)
6667
public void create(@RequestBody @Valid JobReq req) {
67-
baseService.create(req);
68+
CheckUtils.throwIf(!baseService.create(req), "任务创建失败");
6869
}
6970

7071
@Operation(summary = "修改任务", description = "修改任务")
@@ -73,22 +74,22 @@ public void create(@RequestBody @Valid JobReq req) {
7374
@PutMapping("/{id}")
7475
@Validated(CrudValidationGroup.Update.class)
7576
public void update(@RequestBody @Valid JobReq req, @PathVariable Long id) {
76-
baseService.update(req, id);
77+
CheckUtils.throwIf(!baseService.update(req, id), "任务修改失败");
7778
}
7879

7980
@Operation(summary = "修改任务状态", description = "修改任务状态")
8081
@SaCheckPermission("schedule:job:update")
8182
@PatchMapping("/{id}/status")
8283
public void updateStatus(@RequestBody @Valid JobStatusReq req, @PathVariable Long id) {
83-
baseService.updateStatus(req, id);
84+
CheckUtils.throwIf(!baseService.updateStatus(req, id), "任务状态修改失败");
8485
}
8586

8687
@Operation(summary = "删除任务", description = "删除任务")
8788
@Parameter(name = "id", description = "ID", example = "1", in = ParameterIn.PATH)
8889
@SaCheckPermission("schedule:job:delete")
8990
@DeleteMapping("/{id}")
9091
public void delete(@PathVariable Long id) {
91-
baseService.delete(id);
92+
CheckUtils.throwIf(!baseService.delete(id), "任务删除失败");
9293
}
9394

9495
@Operation(summary = "执行任务", description = "执行任务")
@@ -98,7 +99,7 @@ public void delete(@PathVariable Long id) {
9899
public void trigger(@PathVariable Long id) {
99100
JobTriggerReq req = new JobTriggerReq();
100101
req.setJobId(id);
101-
baseService.trigger(req);
102+
CheckUtils.throwIf(!baseService.trigger(req), "任务执行失败");
102103
}
103104

104105
@Log(ignore = true)

continew-plugin/continew-plugin-schedule/src/main/java/top/continew/admin/schedule/controller/JobLogController.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,11 @@
2424
import jakarta.validation.Valid;
2525
import lombok.RequiredArgsConstructor;
2626
import org.springframework.web.bind.annotation.*;
27-
import top.continew.admin.schedule.model.JobInstanceLogPageResult;
28-
import top.continew.admin.schedule.model.query.JobInstanceLogQuery;
29-
import top.continew.admin.schedule.model.query.JobInstanceQuery;
3027
import top.continew.admin.schedule.model.query.JobLogQuery;
31-
import top.continew.admin.schedule.model.resp.JobInstanceResp;
3228
import top.continew.admin.schedule.model.resp.JobLogResp;
3329
import top.continew.admin.schedule.service.JobLogService;
3430
import top.continew.starter.extension.crud.model.resp.PageResp;
3531

36-
import java.util.List;
37-
3832
/**
3933
* 任务日志 API
4034
*
@@ -72,18 +66,4 @@ public void stop(@PathVariable Long id) {
7266
public void retry(@PathVariable Long id) {
7367
baseService.retry(id);
7468
}
75-
76-
@Operation(summary = "查询任务实例列表", description = "查询任务实例列表")
77-
@SaCheckPermission("schedule:log:list")
78-
@GetMapping("/instance")
79-
public List<JobInstanceResp> listInstance(@Valid JobInstanceQuery query) {
80-
return baseService.listInstance(query);
81-
}
82-
83-
@Operation(summary = "分页查询任务实例日志列表", description = "分页查询任务实例日志列表")
84-
@SaCheckPermission("schedule:log:list")
85-
@GetMapping("/instance/log")
86-
public JobInstanceLogPageResult pageInstanceLog(@Valid JobInstanceLogQuery query) {
87-
return baseService.pageInstanceLog(query);
88-
}
8969
}

continew-plugin/continew-plugin-schedule/src/main/java/top/continew/admin/schedule/model/query/JobInstanceLogQuery.java

Lines changed: 0 additions & 77 deletions
This file was deleted.

continew-plugin/continew-plugin-schedule/src/main/java/top/continew/admin/schedule/model/query/JobInstanceQuery.java

Lines changed: 0 additions & 49 deletions
This file was deleted.

continew-plugin/continew-plugin-schedule/src/main/java/top/continew/admin/schedule/model/resp/JobInstanceResp.java

Lines changed: 0 additions & 86 deletions
This file was deleted.

0 commit comments

Comments
 (0)