|
@@ -15,6 +15,7 @@ import com.aizuda.snailjob.model.response.JobApiResponse;
|
|
|
import com.aizuda.snailjob.model.response.JobBatchApiResponse;
|
|
import com.aizuda.snailjob.model.response.JobBatchApiResponse;
|
|
|
import com.aizuda.snailjob.model.response.WorkflowDetailApiResponse;
|
|
import com.aizuda.snailjob.model.response.WorkflowDetailApiResponse;
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
|
+import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.interfaces.api.SnailJobApi;
|
|
import com.ruoyi.interfaces.api.SnailJobApi;
|
|
@@ -38,7 +39,7 @@ public class SnailJobController extends BaseController {
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/jobList")
|
|
@GetMapping("/jobList")
|
|
|
- public TableDataInfo jobList(Job jobRequestVo){
|
|
|
|
|
|
|
+ public TableDataInfo jobList(Job jobRequestVo) {
|
|
|
startPage();
|
|
startPage();
|
|
|
List<Job> list = snailJobService.selectJobList(jobRequestVo);
|
|
List<Job> list = snailJobService.selectJobList(jobRequestVo);
|
|
|
return getDataTable(list);
|
|
return getDataTable(list);
|
|
@@ -50,24 +51,24 @@ public class SnailJobController extends BaseController {
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
@GetMapping("/getJobDetail")
|
|
@GetMapping("/getJobDetail")
|
|
|
- public JobApiResponse getJobDetail(Long jobId) {
|
|
|
|
|
- return SnailJobOpenApi.getJobDetail(jobId).execute();
|
|
|
|
|
|
|
+ public AjaxResult getJobDetail(Long jobId) {
|
|
|
|
|
+ return success(SnailJobOpenApi.getJobDetail(jobId).execute());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
@GetMapping("/getJobBatchDetail")
|
|
@GetMapping("/getJobBatchDetail")
|
|
|
- public JobBatchApiResponse getJobBatchDetail(Long jobId) {
|
|
|
|
|
- return SnailJobOpenApi.getJobBatchDetail(jobId).execute();
|
|
|
|
|
|
|
+ public AjaxResult getJobBatchDetail(Long jobId) {
|
|
|
|
|
+ return success(SnailJobOpenApi.getJobBatchDetail(jobId).execute());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
@GetMapping("/getWorkflowBatchDetail")
|
|
@GetMapping("/getWorkflowBatchDetail")
|
|
|
- public WorkflowDetailApiResponse getWorkflowBatchDetail(Long jobId) {
|
|
|
|
|
- return SnailJobOpenApi.getWorkflowBatchDetail(jobId).execute();
|
|
|
|
|
|
|
+ public AjaxResult getWorkflowBatchDetail(Long jobId) {
|
|
|
|
|
+ return success(SnailJobOpenApi.getWorkflowBatchDetail(jobId).execute());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -78,11 +79,11 @@ public class SnailJobController extends BaseController {
|
|
|
* @param status
|
|
* @param status
|
|
|
*/
|
|
*/
|
|
|
@GetMapping("/updateJobStatus")
|
|
@GetMapping("/updateJobStatus")
|
|
|
- public Boolean updateJobStatus(Long jobId, Long status) {
|
|
|
|
|
- return SnailJobOpenApi
|
|
|
|
|
|
|
+ public AjaxResult updateJobStatus(Long jobId, Long status) {
|
|
|
|
|
+ return success(SnailJobOpenApi
|
|
|
.updateJobStatus(jobId)
|
|
.updateJobStatus(jobId)
|
|
|
.setStatus(StatusEnum.YES.getStatus().equals(status.intValue()) ? StatusEnum.YES : StatusEnum.NO)
|
|
.setStatus(StatusEnum.YES.getStatus().equals(status.intValue()) ? StatusEnum.YES : StatusEnum.NO)
|
|
|
- .execute();
|
|
|
|
|
|
|
+ .execute());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -92,11 +93,11 @@ public class SnailJobController extends BaseController {
|
|
|
* @param status
|
|
* @param status
|
|
|
*/
|
|
*/
|
|
|
@GetMapping("/updateWorkFlowStatus")
|
|
@GetMapping("/updateWorkFlowStatus")
|
|
|
- public Boolean updateWorkFlowStatus(Long workFlowId, Long status) {
|
|
|
|
|
- return SnailJobOpenApi
|
|
|
|
|
|
|
+ public AjaxResult updateWorkFlowStatus(Long workFlowId, Long status) {
|
|
|
|
|
+ return success(SnailJobOpenApi
|
|
|
.updateWorkFlowStatus(workFlowId)
|
|
.updateWorkFlowStatus(workFlowId)
|
|
|
.setStatus(StatusEnum.YES.getStatus().equals(status.intValue()) ? StatusEnum.YES : StatusEnum.NO)
|
|
.setStatus(StatusEnum.YES.getStatus().equals(status.intValue()) ? StatusEnum.YES : StatusEnum.NO)
|
|
|
- .execute();
|
|
|
|
|
|
|
+ .execute());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -105,27 +106,27 @@ public class SnailJobController extends BaseController {
|
|
|
* @param jobId 任务Id
|
|
* @param jobId 任务Id
|
|
|
*/
|
|
*/
|
|
|
@GetMapping("/triggerJob")
|
|
@GetMapping("/triggerJob")
|
|
|
- public Boolean triggerJob(Long jobId, Integer taskType) {
|
|
|
|
|
|
|
+ public AjaxResult triggerJob(Long jobId, Integer taskType) {
|
|
|
switch (taskType) {
|
|
switch (taskType) {
|
|
|
case 1:
|
|
case 1:
|
|
|
- return SnailJobOpenApi.triggerClusterJob(jobId).execute();
|
|
|
|
|
|
|
+ return success(SnailJobOpenApi.triggerClusterJob(jobId).execute());
|
|
|
case 2:
|
|
case 2:
|
|
|
- return SnailJobOpenApi.triggerBroadcastJob(jobId).execute();
|
|
|
|
|
|
|
+ return success(SnailJobOpenApi.triggerBroadcastJob(jobId).execute());
|
|
|
case 3:
|
|
case 3:
|
|
|
- return SnailJobOpenApi.triggerShardingJob(jobId).execute();
|
|
|
|
|
|
|
+ return success(SnailJobOpenApi.triggerShardingJob(jobId).execute());
|
|
|
case 4:
|
|
case 4:
|
|
|
- return SnailJobOpenApi.triggerMapJob(jobId).execute();
|
|
|
|
|
|
|
+ return success(SnailJobOpenApi.triggerMapJob(jobId).execute());
|
|
|
case 5:
|
|
case 5:
|
|
|
- return SnailJobOpenApi.triggerMapReduceJob(jobId).execute();
|
|
|
|
|
|
|
+ return success(SnailJobOpenApi.triggerMapReduceJob(jobId).execute());
|
|
|
case 6:
|
|
case 6:
|
|
|
- return SnailJobOpenApi.triggerWorkFlow(jobId).execute();
|
|
|
|
|
|
|
+ return success(SnailJobOpenApi.triggerWorkFlow(jobId).execute());
|
|
|
}
|
|
}
|
|
|
- return false;
|
|
|
|
|
|
|
+ return success(false);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@DeleteMapping("job")
|
|
@DeleteMapping("job")
|
|
|
- public Boolean deleteJob(@RequestParam Set<Long> jobIds) {
|
|
|
|
|
- return SnailJobOpenApi.deleteJob(jobIds).execute();
|
|
|
|
|
|
|
+ public AjaxResult deleteJob(@RequestParam Set<Long> jobIds) {
|
|
|
|
|
+ return success(SnailJobOpenApi.deleteJob(jobIds).execute());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -134,53 +135,55 @@ public class SnailJobController extends BaseController {
|
|
|
* @param workflowIds 工作流任务ID
|
|
* @param workflowIds 工作流任务ID
|
|
|
*/
|
|
*/
|
|
|
@DeleteMapping("workflow")
|
|
@DeleteMapping("workflow")
|
|
|
- public Boolean deleteWorkflow(Set<Long> workflowIds) {
|
|
|
|
|
- return SnailJobOpenApi.deleteWorkflow(workflowIds).execute();
|
|
|
|
|
|
|
+ public AjaxResult deleteWorkflow(Set<Long> workflowIds) {
|
|
|
|
|
+ return success(SnailJobOpenApi.deleteWorkflow(workflowIds).execute());
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 新增任务
|
|
* 新增任务
|
|
|
|
|
+ *
|
|
|
* @param jobRequest
|
|
* @param jobRequest
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
@PostMapping()
|
|
@PostMapping()
|
|
|
- public Long saveJob(@RequestBody JobRequestVo jobRequest) {
|
|
|
|
|
|
|
+ public AjaxResult saveJob(@RequestBody JobRequestVo jobRequest) {
|
|
|
switch (jobRequest.getTaskType()) {
|
|
switch (jobRequest.getTaskType()) {
|
|
|
case 1:
|
|
case 1:
|
|
|
- return addClusterJob(jobRequest);
|
|
|
|
|
|
|
+ return success(addClusterJob(jobRequest));
|
|
|
case 2:
|
|
case 2:
|
|
|
- return addBroadcastJob(jobRequest);
|
|
|
|
|
|
|
+ return success(addBroadcastJob(jobRequest));
|
|
|
case 3:
|
|
case 3:
|
|
|
- return addShardingJob(jobRequest);
|
|
|
|
|
|
|
+ return success(addShardingJob(jobRequest));
|
|
|
case 4:
|
|
case 4:
|
|
|
- return addMapJob(jobRequest);
|
|
|
|
|
|
|
+ return success(addMapJob(jobRequest));
|
|
|
case 5:
|
|
case 5:
|
|
|
- return addMapReduceJob(jobRequest);
|
|
|
|
|
|
|
+ return success(addMapReduceJob(jobRequest));
|
|
|
}
|
|
}
|
|
|
- return 0L;
|
|
|
|
|
|
|
+ return success(0L);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 更新任务
|
|
* 更新任务
|
|
|
|
|
+ *
|
|
|
* @param jobRequest
|
|
* @param jobRequest
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
@PutMapping()
|
|
@PutMapping()
|
|
|
- public Boolean updateJob(@RequestBody JobRequestVo jobRequest) {
|
|
|
|
|
|
|
+ public AjaxResult updateJob(@RequestBody JobRequestVo jobRequest) {
|
|
|
switch (jobRequest.getTaskType()) {
|
|
switch (jobRequest.getTaskType()) {
|
|
|
case 1:
|
|
case 1:
|
|
|
- return updateClusterJob(jobRequest);
|
|
|
|
|
|
|
+ return success(updateClusterJob(jobRequest));
|
|
|
case 2:
|
|
case 2:
|
|
|
- return updateBroadcastJob(jobRequest);
|
|
|
|
|
|
|
+ return success(updateBroadcastJob(jobRequest));
|
|
|
case 3:
|
|
case 3:
|
|
|
- return updateShardingJob(jobRequest);
|
|
|
|
|
|
|
+ return success(updateShardingJob(jobRequest));
|
|
|
case 4:
|
|
case 4:
|
|
|
- return updateMapJob(jobRequest);
|
|
|
|
|
|
|
+ return success(updateMapJob(jobRequest));
|
|
|
case 5:
|
|
case 5:
|
|
|
- return updateMapReduceJob(jobRequest);
|
|
|
|
|
|
|
+ return success(updateMapReduceJob(jobRequest));
|
|
|
}
|
|
}
|
|
|
- return false;
|
|
|
|
|
|
|
+ return success(false);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|