Commit 3b7e82ba by huangfusuper

增加对外接口 修改java执行日志

parent 16d7244e
package com.byit.api; package com.byit.api;
import com.byit.conf.MythJobAutoConfigure; import com.byit.conf.MythJobAutoConfigure;
import com.byit.dto.api.JavaCallbackLogDto;
import com.byit.dto.executor.JobRunResultDto; import com.byit.dto.executor.JobRunResultDto;
import com.byit.dto.web.ReturnResult;
import com.byit.packet.response.PluginRpcResponsePacket; import com.byit.packet.response.PluginRpcResponsePacket;
import com.byit.thread.JavaTaskCallbackThread; import com.byit.thread.JavaTaskCallbackThread;
import com.byit.thread.LogCallbackThread; import com.byit.thread.LogCallbackThread;
...@@ -11,6 +13,8 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -11,6 +13,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/** /**
* @author huangfu * @author huangfu
*/ */
...@@ -22,4 +26,16 @@ public class ApiCallbackController { ...@@ -22,4 +26,16 @@ public class ApiCallbackController {
public void callbackRes(@RequestBody PluginRpcResponsePacket pluginRpcResponsePacket){ public void callbackRes(@RequestBody PluginRpcResponsePacket pluginRpcResponsePacket){
MythJobAutoConfigure.LOG_CALLBACK.execute(new JavaTaskCallbackThread(pluginRpcResponsePacket)); MythJobAutoConfigure.LOG_CALLBACK.execute(new JavaTaskCallbackThread(pluginRpcResponsePacket));
} }
/**
* 供ddmp平台回调
* @param javaCallbackLogDto
*/
@PostMapping(value = "ddmp/callbackRes")
public void ddmpCallbackRes(@RequestBody JavaCallbackLogDto javaCallbackLogDto){
PluginRpcResponsePacket pluginRpcResponsePacket = new PluginRpcResponsePacket();
pluginRpcResponsePacket.setExtension(javaCallbackLogDto.getLogId());
pluginRpcResponsePacket.setResult(javaCallbackLogDto.getReturnResult());
MythJobAutoConfigure.LOG_CALLBACK.execute(new JavaTaskCallbackThread(pluginRpcResponsePacket));
}
} }
package com.byit.dto.api;
import com.byit.dto.web.ReturnResult;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author huangfu
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class JavaCallbackLogDto implements Serializable {
private static final long serialVersionUID = -2975178830254824276L;
private String logId;
private ReturnResult returnResult;
}
...@@ -2,9 +2,11 @@ package com.byit.utils; ...@@ -2,9 +2,11 @@ package com.byit.utils;
import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.byit.dto.api.JavaCallbackLogDto;
import com.byit.dto.executor.PluginBeanJobInfo; import com.byit.dto.executor.PluginBeanJobInfo;
import com.byit.dto.plugin.*; import com.byit.dto.plugin.*;
import com.byit.dto.web.ResponseResult; import com.byit.dto.web.ResponseResult;
import com.byit.dto.web.ReturnResult;
import com.byit.executor.handler.interfaces.IJobHandler; import com.byit.executor.handler.interfaces.IJobHandler;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -108,6 +110,11 @@ public class JobUtils { ...@@ -108,6 +110,11 @@ public class JobUtils {
* 获取节点运行的统计数据 * 获取节点运行的统计数据
*/ */
public static final String REQUEST_LOADNODESTATISTICDATA = "/api/flow/loadNodeStatisticData"; public static final String REQUEST_LOADNODESTATISTICDATA = "/api/flow/loadNodeStatisticData";
/**
* ddmp平台修改java接口
*/
public static final String JAVA_LOG_CALLBACK_DDMP = "/api/callback/ddmp/callbackRes";
/** /**
* 获取当前的工作流运行状态 * 获取当前的工作流运行状态
*/ */
...@@ -198,19 +205,6 @@ public class JobUtils { ...@@ -198,19 +205,6 @@ public class JobUtils {
return JSON.parseObject(response, ResponseResult.class); return JSON.parseObject(response, ResponseResult.class);
} }
public static void main(String[] args) {
JobUtils.setTOKEN("qqq");
JobUtils.setRequestUrl("http://10.0.120.208:8998/myth-job-admin");
JavaTask javaTask = new JavaTask();
javaTask.setTaskName("BaseLineWarnJob");
javaTask.setJobName("BaseLineWarnJob");
t t = new t();
t.setId("0000");
t.setTenant("");
javaTask.setParam(JSON.toJSONString(t));
System.out.println(JobUtils.runTask(javaTask));
}
/** /**
* 暂停指定的工作流 * 暂停指定的工作流
* @param runId * @param runId
...@@ -236,6 +230,22 @@ public class JobUtils { ...@@ -236,6 +230,22 @@ public class JobUtils {
return JSON.parseObject(response, ResponseResult.class); return JSON.parseObject(response, ResponseResult.class);
} }
public static ResponseResult javaUpdateStatusRunResult(JavaCallbackLogDto javaCallbackLogDto){
log.debug("---------------开始修改任务{}---------------------", javaCallbackLogDto);
String httpRequest = createHttpRequest(JAVA_LOG_CALLBACK_DDMP, JSON.toJSONString(javaCallbackLogDto));
log.debug("--------------------修改任务完成,添加结果为:{}------------------------", httpRequest);
return JSON.parseObject(httpRequest, ResponseResult.class);
}
public static void main(String[] args) {
JobUtils.setTOKEN("qqq");
JobUtils.setRequestUrl("http://127.0.0.1:8998/myth-job-admin");
JavaCallbackLogDto javaCallbackLogDto = new JavaCallbackLogDto();
javaCallbackLogDto.setLogId("123");
javaCallbackLogDto.setReturnResult(ReturnResult.SUCCESS);
JobUtils.javaUpdateStatusRunResult(javaCallbackLogDto);
}
/** /**
* 发布一个工作流 * 发布一个工作流
* @param pluginPackage * @param pluginPackage
...@@ -737,24 +747,4 @@ public class JobUtils { ...@@ -737,24 +747,4 @@ public class JobUtils {
return path; return path;
} }
}
class t{
private String tenant;
private String id;
public String getTenant() {
return tenant;
}
public void setTenant(String tenant) {
this.tenant = tenant;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment