jobid查询接口;
This commit is contained in:
+5
-2
@@ -59,18 +59,20 @@ public class XxlJobOpenApiUtil {
|
|||||||
* @return jobId,查不到返回null
|
* @return jobId,查不到返回null
|
||||||
*/
|
*/
|
||||||
public Integer queryJobIdByDescAndParam(String jobDesc, String executorParam) {
|
public Integer queryJobIdByDescAndParam(String jobDesc, String executorParam) {
|
||||||
// 手动拼接query参数
|
|
||||||
String query = "jobGroup=&jobDesc="+cn.hutool.core.net.URLEncodeUtil.encode(jobDesc)
|
String query = "jobGroup=&jobDesc="+cn.hutool.core.net.URLEncodeUtil.encode(jobDesc)
|
||||||
+"&executorHandler=&executorParam="+cn.hutool.core.net.URLEncodeUtil.encode(executorParam)
|
+"&executorHandler=&executorParam="+cn.hutool.core.net.URLEncodeUtil.encode(executorParam)
|
||||||
+"&triggerStatus=-1&start=0&length=10";
|
+"&triggerStatus=-1&start=0&length=10";
|
||||||
|
|
||||||
String url = adminUrl + "/jobinfo/pageList?" + query;
|
String url = adminUrl + "/jobinfo/pageList?" + query;
|
||||||
|
log.info("[XxlJob] pageList请求url:{}",url);
|
||||||
try {
|
try {
|
||||||
HttpResponse response = HttpRequest.post(url)
|
// 重点:1. header名称是Cookie;2. 改用get请求
|
||||||
|
HttpResponse response = HttpRequest.get(url)
|
||||||
.header("Authorization", cookie)
|
.header("Authorization", cookie)
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
String jsonStr = response.body();
|
String jsonStr = response.body();
|
||||||
|
log.info("[XxlJob] pageList响应:{}",jsonStr);
|
||||||
if (StrUtil.isBlank(jsonStr)) {
|
if (StrUtil.isBlank(jsonStr)) {
|
||||||
log.warn("[XxlJob] pageList返回空响应");
|
log.warn("[XxlJob] pageList返回空响应");
|
||||||
return null;
|
return null;
|
||||||
@@ -99,6 +101,7 @@ public class XxlJobOpenApiUtil {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 暂停任务 POST /jobinfo/pause
|
* 暂停任务 POST /jobinfo/pause
|
||||||
* @param jobId xxl任务id
|
* @param jobId xxl任务id
|
||||||
|
|||||||
Reference in New Issue
Block a user