Commit 372734b7 by guominglei

添加运行节点查看历史接口

parent 8bd1f7af
package com.byit.api; package com.byit.api;
import com.byit.dto.web.ResponseResult; import com.byit.dto.web.ResponseResult;
import com.byit.model.JobTaskRunLog;
import com.byit.service.ApiNodeService; import com.byit.service.ApiNodeService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
...@@ -9,6 +10,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -9,6 +10,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
@Api(tags = "任务节点api") @Api(tags = "任务节点api")
@RestController @RestController
...@@ -27,4 +29,10 @@ public class ApiNodeController { ...@@ -27,4 +29,10 @@ public class ApiNodeController {
return ResponseResult.ok(monitorKey); return ResponseResult.ok(monitorKey);
} }
@PostMapping("runHistory")
public ResponseResult runHistory(String nodeId){
List<JobTaskRunLog> jobTaskRunLogList = apiNodeService.runHistory(nodeId);
return ResponseResult.ok(jobTaskRunLogList);
}
} }
package com.byit.service; package com.byit.service;
import com.byit.model.JobTaskRunLog;
import java.util.List;
/** /**
* 任务节点service * 任务节点service
*/ */
...@@ -10,4 +14,11 @@ public interface ApiNodeService { ...@@ -10,4 +14,11 @@ public interface ApiNodeService {
* @return * @return
*/ */
String runNode(String param); String runNode(String param);
/**
* 根据nodeid查询运行历史
* @param nodeId
* @return
*/
List<JobTaskRunLog> runHistory(String nodeId);
} }
...@@ -4,10 +4,11 @@ import com.alibaba.fastjson.JSON; ...@@ -4,10 +4,11 @@ import com.alibaba.fastjson.JSON;
import com.byit.dto.plugin.RunLog; import com.byit.dto.plugin.RunLog;
import com.byit.dto.plugin.RunNode; import com.byit.dto.plugin.RunNode;
import com.byit.enums.NodePropertyEnum; import com.byit.enums.NodePropertyEnum;
import com.byit.enums.ScheduleEnum;
import com.byit.job.WorkRoulette; import com.byit.job.WorkRoulette;
import com.byit.job.utils.PlaceholderUtils; import com.byit.job.utils.PlaceholderUtils;
import com.byit.mapper.JobTaskRunLogMapper; import com.byit.mapper.JobTaskRunLogMapper;
import com.byit.mapper.JobTaskScheduleMapper; import com.byit.model.JobTaskRunLog;
import com.byit.model.JobTaskRunLogWithBLOBs; import com.byit.model.JobTaskRunLogWithBLOBs;
import com.byit.model.JobTaskSchedule; import com.byit.model.JobTaskSchedule;
import com.byit.service.ApiNodeService; import com.byit.service.ApiNodeService;
...@@ -20,6 +21,8 @@ import org.springframework.stereotype.Service; ...@@ -20,6 +21,8 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
import static com.alibaba.fastjson.serializer.SerializerFeature.WriteClassName; import static com.alibaba.fastjson.serializer.SerializerFeature.WriteClassName;
/** /**
...@@ -60,6 +63,7 @@ public class ApiNodeServiceImpl implements ApiNodeService { ...@@ -60,6 +63,7 @@ public class ApiNodeServiceImpl implements ApiNodeService {
schedule.setScriptUrls(runNode.getScriptUrl()); schedule.setScriptUrls(runNode.getScriptUrl());
schedule.setJobType(runNode.getJobType()); schedule.setJobType(runNode.getJobType());
schedule.setTriggerTime(triggerTime); schedule.setTriggerTime(triggerTime);
schedule.setScheduleType(ScheduleEnum.REAL.getCode());
schedule.setRunParam(PlaceholderUtils.formatParam(schedule.getRunParam())); schedule.setRunParam(PlaceholderUtils.formatParam(schedule.getRunParam()));
...@@ -80,4 +84,15 @@ public class ApiNodeServiceImpl implements ApiNodeService { ...@@ -80,4 +84,15 @@ public class ApiNodeServiceImpl implements ApiNodeService {
return runKey; return runKey;
} }
@Override
public List<JobTaskRunLog> runHistory(String nodeId) {
ValidationUtil.dataNotBank(nodeId, "nodeId不允许为空!");
String runId = "REAL-EXEC-" + nodeId;
List<JobTaskRunLog> jobTaskRunLogList = jobTaskRunLogMapper.findByRunId(runId);
return jobTaskRunLogList;
}
} }
...@@ -9,7 +9,8 @@ public enum ScheduleEnum { ...@@ -9,7 +9,8 @@ public enum ScheduleEnum {
NORMAL(1, "正常跑批"), NORMAL(1, "正常跑批"),
REPEAT(2, "重跑"), REPEAT(2, "重跑"),
REPAIR(3, "补批") REPAIR(3, "补批"),
REAL(4, "插件端立即运行")
; ;
private Integer code; private Integer code;
......
...@@ -219,9 +219,9 @@ public class JobTask implements Serializable { ...@@ -219,9 +219,9 @@ public class JobTask implements Serializable {
private String operator; private String operator;
/** /**
* 跑批类型 1 正常跑批 2 重跑 3 补批 * 跑批类型 1 正常跑批 2 重跑 3 补批 4 插件端立即运行
*/ */
@ApiModelProperty("跑批类型 1 正常跑批 2 重跑 3 补批") @ApiModelProperty("跑批类型 1 正常跑批 2 重跑 3 补批 4 插件端立即运行")
private Integer scheduleType; private Integer scheduleType;
/** /**
......
...@@ -198,9 +198,9 @@ public class JobTaskRunLog implements Serializable { ...@@ -198,9 +198,9 @@ public class JobTaskRunLog implements Serializable {
private String operator; private String operator;
/** /**
* 跑批类型 1 正常跑批 2 重跑 3 补批 * 跑批类型 1 正常跑批 2 重跑 3 补批 4 插件端立即运行
*/ */
@ApiModelProperty("跑批类型 1 正常跑批 2 重跑 3 补批") @ApiModelProperty("跑批类型 1 正常跑批 2 重跑 3 补批 4 插件端立即运行")
private Integer scheduleType; private Integer scheduleType;
/** /**
* *
......
...@@ -213,9 +213,9 @@ public class JobTaskSchedule implements Serializable { ...@@ -213,9 +213,9 @@ public class JobTaskSchedule implements Serializable {
private String operator; private String operator;
/** /**
* 跑批类型 1 正常跑批 2 重跑 3 补批 * 跑批类型 1 正常跑批 2 重跑 3 补批 4 插件端立即运行
*/ */
@ApiModelProperty("跑批类型 1 正常跑批 2 重跑 3 补批") @ApiModelProperty("跑批类型 1 正常跑批 2 重跑 3 补批 4 插件端立即运行")
private Integer scheduleType; private Integer scheduleType;
/** /**
......
...@@ -139,9 +139,9 @@ public class RunRecording implements Serializable { ...@@ -139,9 +139,9 @@ public class RunRecording implements Serializable {
private Integer flowNodeCount; private Integer flowNodeCount;
/** /**
* 跑批类型 1 正常跑批 2 重跑 3 补批 * 跑批类型 1 正常跑批 2 重跑 3 补批 4 插件端立即运行
*/ */
@ApiModelProperty("跑批类型 1 正常跑批 2 重跑 3 补批") @ApiModelProperty("跑批类型 1 正常跑批 2 重跑 3 补批 4 插件端立即运行")
private Integer scheduleType; private Integer scheduleType;
/** /**
......
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
<select id="findByRunId" resultMap="BaseResultMap"> <select id="findByRunId" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> select <include refid="Base_Column_List"/>
from job_task_run_log from job_task_run_log
where node_id = #{nodeId} where run_id = #{runId}
</select> </select>
<select id="findJobTaskRunLogWithBLOBsByFlowIdAndRunId" resultMap="ResultMapWithBLOBs"> <select id="findJobTaskRunLogWithBLOBsByFlowIdAndRunId" resultMap="ResultMapWithBLOBs">
......
...@@ -83,6 +83,8 @@ public class JobUtils { ...@@ -83,6 +83,8 @@ public class JobUtils {
private static final String REQUEST_FLOW_MAKESUCCESS = "/api/flow/madeSuccess"; private static final String REQUEST_FLOW_MAKESUCCESS = "/api/flow/madeSuccess";
private static final String REQUEST_REAL_EXECT = "/api/node/runNode"; private static final String REQUEST_REAL_EXECT = "/api/node/runNode";
private static final String REQUEST_RUN_HISTORY = "/api/node/runHistory";
/** /**
* 当前项目运行环境 jar file * 当前项目运行环境 jar file
*/ */
...@@ -325,6 +327,13 @@ public class JobUtils { ...@@ -325,6 +327,13 @@ public class JobUtils {
return JSON.parseObject(response, ResponseResult.class); return JSON.parseObject(response, ResponseResult.class);
} }
public static ResponseResult runHistroy(String nodeId){
log.info("-------------获取运行历史----------------------");
String response = createHttpRequest(REQUEST_RUN_HISTORY, "nodeId=" + nodeId);
log.info("--------------------获取运行历史,结果为:{}------------------------",response);
return JSON.parseObject(response, ResponseResult.class);
}
/** /**
* 判断当前的运行环境是什么 jar : table of Contents(目录) * 判断当前的运行环境是什么 jar : table of Contents(目录)
* @return jar -->true 目录 -->false * @return jar -->true 目录 -->false
......
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