Commit ff7ec73b by huangfusuper

完成全部节点接口查询 完成当前版本节点接口查询 完成全部日志接口查询 完成错误日志接口查询

parent 0228b3e3
package com.byit.view;
import com.byit.model.vo.RunLogVo;
import com.byit.service.JobTaskRunLogService;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author huangfu
*/
@RestController
@RequestMapping("view/log")
public class RunLogViewController {
private final JobTaskRunLogService jobTaskRunLogService;
public RunLogViewController(JobTaskRunLogService jobTaskRunLogService) {
this.jobTaskRunLogService = jobTaskRunLogService;
}
@RequestMapping("findAllRunLog")
public List<RunLogVo> findAllRunLogIdByFlowIdAndRunId(@Param("flowId") Integer flowId, @Param("runId") String runId){
return jobTaskRunLogService.findAllRunLogIdByFlowIdAndRunId(flowId,runId);
}
}
package com.byit.view;
import com.byit.model.RunRecording;
import com.byit.model.vo.RunRecordingViewVo;
import com.byit.service.RunRecordingService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 运行记录视图查询
* @author huangfu
*/
@RestController
@RequestMapping("view/runRecording")
public class RunRecordingViewController {
private final RunRecordingService runRecordingService;
public RunRecordingViewController(RunRecordingService runRecordingService) {
this.runRecordingService = runRecordingService;
}
@RequestMapping("findAll")
public List<RunRecording> findAll(){
return runRecordingService.findAll();
}
@RequestMapping("findAllRunIng")
public List<RunRecording> findAllRunIng() {
return runRecordingService.findAllRunIng();
}
@RequestMapping("findAllRunRecordingViewVo")
public List<RunRecordingViewVo> findAllRunRecordingViewVo(){
return runRecordingService.findAllRunRecordingViewVo();
}
@RequestMapping("findAllError")
public List<RunRecordingViewVo> findAllError(){
return runRecordingService.findAllError();
}
}
......@@ -15,6 +15,23 @@ import java.util.List;
@Repository
public interface RunRecordingMapper {
/**
* 查询全部的数据
* @return
*/
List<RunRecording> findAll();
/**
* 查询全部错误的节点
* @return
*/
List<RunRecording> findAllError();
/**
* 查询运行中的数据
* @return
*/
List<RunRecording> findAllRunIng();
/**
* 查询已经完结的,并且没有告警的任务流
* @return
*/
......
......@@ -124,7 +124,7 @@ public class RunRecording implements Serializable {
/**
* 是否是内嵌工作流 0 否, 1 是
*/
@ApiModelProperty("是否是内嵌工作流 0 否, 1 是")
@ApiModelProperty("是否是内嵌工作流 1 否, 0 是")
private String isInner;
/**
......
package com.byit.model.vo;
import lombok.Data;
import java.util.Date;
/**
* @author huangfu
*/
@Data
public class RunLogVo {
private String rowKey;
private String nodeName;
private String jobType;
private Integer failedRemainingCount;
private String isVirtual;
private Integer mapFlowId;
private String triggerCode;
private String triggerMsg;
private String runCode;
private String runMsg;
private Date triggerTime;
private String jobGroupIp;
private Date startTime;
private Date endTime;
private String logRemotelyPath;
private String scriptUrls;
private Integer scheduleType;
private String operator;
private boolean hasTrigger;
}
package com.byit.model.vo;
import lombok.Data;
/**
* 运行实例
* @author huangfu
*/
@Data
public class RunRecordingViewVo {
private String rowKey;
private Integer flowId;
private String runId;
private String flowName;
private String flowVersionName;
private String flowStatus;
private String flowRunResult;
private boolean hasChildren;
}
......@@ -2,6 +2,7 @@ package com.byit.service;
import com.byit.model.JobTaskRunLog;
import com.byit.model.JobTaskRunLogWithBLOBs;
import com.byit.model.vo.RunLogVo;
import java.util.List;
......@@ -13,6 +14,8 @@ import java.util.List;
**/
public interface JobTaskRunLogService {
/**
* 查询没有结束的节点
* @param nodIds
......@@ -33,6 +36,15 @@ public interface JobTaskRunLogService {
* @return
*/
List<JobTaskRunLogWithBLOBs> findJobTaskRunLogWithBLOBsByFlowIdAndRunId(Integer flowId,String runId);
/**
* 根据工作流id和日志ID
* @param flowId
* @param runId
* @return
*/
List<RunLogVo> findAllRunLogIdByFlowIdAndRunId(Integer flowId,String runId);
/**
* 查询已经结束或者失败的节点
* @return
......
package com.byit.service;
import com.byit.model.RunRecording;
import com.byit.model.vo.RunRecordingViewVo;
import java.util.List;
......@@ -10,6 +11,28 @@ import java.util.List;
*/
public interface RunRecordingService {
/**
* 查询全部数据 映射成VO
* @return
*/
List<RunRecordingViewVo> findAllRunRecordingViewVo();
/**
* 查询全部的数据
* @return
*/
List<RunRecording> findAll();
/**
* 查询全部错误的节点
* @return
*/
List<RunRecordingViewVo> findAllError();
/**
* 查询运行中的数据
* @return
*/
List<RunRecording> findAllRunIng();
/**
* 查询已经完结的,并且没有告警的任务流
* @return
*/
......
package com.byit.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.byit.mapper.JobTaskRunLogMapper;
import com.byit.model.JobTask;
import com.byit.model.JobTaskRunLog;
import com.byit.model.JobTaskRunLogWithBLOBs;
import com.byit.model.vo.RunLogVo;
import com.byit.service.JobTaskRunLogService;
import com.byit.service.JobTaskService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
/**
* @program: byit-myth-job->JobTaskRunLogServiceImpl
......@@ -24,10 +32,12 @@ import java.util.List;
public class JobTaskRunLogServiceImpl implements JobTaskRunLogService {
private final JobTaskRunLogMapper jobTaskRunLogMapper;
private final JobTaskService jobTaskService;
@Autowired
public JobTaskRunLogServiceImpl(JobTaskRunLogMapper jobTaskRunLogMapper) {
public JobTaskRunLogServiceImpl(JobTaskRunLogMapper jobTaskRunLogMapper, JobTaskService jobTaskService) {
this.jobTaskRunLogMapper = jobTaskRunLogMapper;
this.jobTaskService = jobTaskService;
}
@Override
......@@ -46,6 +56,27 @@ public class JobTaskRunLogServiceImpl implements JobTaskRunLogService {
}
@Override
public List<RunLogVo> findAllRunLogIdByFlowIdAndRunId(Integer flowId, String runId) {
List<JobTaskRunLogWithBLOBs> jobTaskRunLogWithBLOBsByFlowIdAndRunId = jobTaskRunLogMapper.findJobTaskRunLogWithBLOBsByFlowIdAndRunId(flowId, runId);
List<RunLogVo> collect = jobTaskRunLogWithBLOBsByFlowIdAndRunId.stream().map(log -> {
RunLogVo runLogVo = new RunLogVo();
runLogVo.setHasTrigger(true);
runLogVo.setRowKey(UUID.randomUUID().toString().replace("-", ""));
BeanUtils.copyProperties(log, runLogVo);
return runLogVo;
}).collect(Collectors.toList());
//这个是还未运行的信息
List<JobTask> jobTaskByRunId = jobTaskService.findJobTaskByRunId(runId, flowId);
jobTaskByRunId.forEach(jobTask -> {
RunLogVo runLogVo = new RunLogVo();
runLogVo.setHasTrigger(false);
runLogVo.setRowKey(UUID.randomUUID().toString().replace("-",""));
collect.add(runLogVo);
});
return collect;
}
@Override
public List<JobTaskRunLog> findJobTaskRunLogEndOrFailureNode() {
return jobTaskRunLogMapper.findJobTaskRunLogEndOrFailureNode();
}
......
......@@ -3,11 +3,15 @@ package com.byit.service.impl;
import com.byit.enums.RunRecordingEnum;
import com.byit.mapper.RunRecordingMapper;
import com.byit.model.RunRecording;
import com.byit.model.vo.RunRecordingViewVo;
import com.byit.service.RunRecordingService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
/**
* @program: byit-myth-job->RunRecordingServiceImpl
......@@ -25,6 +29,40 @@ public class RunRecordingServiceImpl implements RunRecordingService {
}
@Override
public List<RunRecordingViewVo> findAllRunRecordingViewVo() {
List<RunRecording> runRecordings = findAll();
return runRecordings.stream().map(runRecording -> {
RunRecordingViewVo runRecordingViewVo = new RunRecordingViewVo();
runRecordingViewVo.setHasChildren(true);
BeanUtils.copyProperties(runRecording,runRecordingViewVo);
runRecordingViewVo.setRowKey(UUID.randomUUID().toString().replace("-",""));
return runRecordingViewVo;
}).collect(Collectors.toList());
}
@Override
public List<RunRecording> findAll() {
return runRecordingMapper.findAll();
}
@Override
public List<RunRecordingViewVo> findAllError() {
List<RunRecording> allError = runRecordingMapper.findAllError();
return allError.stream().map(runRecording -> {
RunRecordingViewVo runRecordingViewVo = new RunRecordingViewVo();
runRecordingViewVo.setHasChildren(true);
BeanUtils.copyProperties(runRecording,runRecordingViewVo);
runRecordingViewVo.setRowKey(UUID.randomUUID().toString().replace("-",""));
return runRecordingViewVo;
}).collect(Collectors.toList());
}
@Override
public List<RunRecording> findAllRunIng() {
return runRecordingMapper.findAllRunIng();
}
@Override
public List<RunRecording> findRunRecordingByEndAndNotIsAlarm() {
return runRecordingMapper.findRunRecordingByEndAndNotIsAlarm();
}
......
......@@ -32,6 +32,27 @@
flow_id, start_time, end_time, is_alarm,is_inner,fail_fast, flow_node_count, schedule_type, operator, re_run_id
</sql>
<select id="findAll" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from run_recording
</select>
<select id="findAllError" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from run_recording
where flow_run_result = '2' or flow_run_result = '4'
or flow_run_result = '5'
</select>
<select id="findAllRunIng" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from run_recording
where flow_status = '2' or flow_status = '3'
</select>
<!--查询已完结 没有告警的-->
<select id="findRunRecordingByEndAndNotIsAlarm" resultMap="BaseResultMap">
select
......
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