新增 query、trigger、updateStatus 相关demo
This commit is contained in:
parent
64ac13a1fd
commit
04b6ba9d4a
@ -0,0 +1,19 @@
|
||||
package com.example.snailjob.handler;
|
||||
|
||||
import com.aizuda.snailjob.client.job.core.dto.JobResponseVO;
|
||||
import com.aizuda.snailjob.client.job.core.openapi.SnailJobOpenApi;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class TestQueryJobHandler {
|
||||
|
||||
/**
|
||||
* 查看任务详情
|
||||
*
|
||||
* @param jobId
|
||||
* @return 任务详情
|
||||
*/
|
||||
public JobResponseVO queryJob(Long jobId){
|
||||
return SnailJobOpenApi.getJobDetail(jobId).execute();
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.example.snailjob.handler;
|
||||
|
||||
import com.aizuda.snailjob.client.job.core.openapi.SnailJobOpenApi;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class TestTriggerJobHandler {
|
||||
|
||||
/**
|
||||
* 手动调度任务
|
||||
*
|
||||
* @param jobId 任务ID
|
||||
* @return
|
||||
*/
|
||||
public Boolean triggerJob(Long jobId){
|
||||
return SnailJobOpenApi.triggerJob(jobId).execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* 手动调度工作流任务
|
||||
*
|
||||
* @param workFlowId 工作流任务ID
|
||||
* @return
|
||||
*/
|
||||
public Boolean triggerWorkFlow(Long workFlowId){
|
||||
return SnailJobOpenApi.triggerWorkFlow(workFlowId).execute();
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package com.example.snailjob.handler;
|
||||
|
||||
import com.aizuda.snailjob.client.job.core.openapi.SnailJobOpenApi;
|
||||
import com.aizuda.snailjob.common.core.enums.StatusEnum;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class TestUpdateJobStatusHandler {
|
||||
|
||||
/**
|
||||
* 更新定时任务状态
|
||||
*
|
||||
* @param jobId 定时任务ID
|
||||
* @return
|
||||
*/
|
||||
public Boolean updateJobStatus(Long jobId){
|
||||
return SnailJobOpenApi
|
||||
.updateJobStatus(jobId)
|
||||
.setStatus(StatusEnum.NO)
|
||||
.execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新工作流任务状态
|
||||
*
|
||||
* @param workFlowId 工作流ID
|
||||
* @return
|
||||
*/
|
||||
public Boolean updateWorkFlowStatus(Long workFlowId){
|
||||
return SnailJobOpenApi
|
||||
.updateWorkFlowStatus(workFlowId)
|
||||
.setStatus(StatusEnum.YES)
|
||||
.execute();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user