Commit b9bd2440 by huangfusuper

增加接口 验证工作流全部完成

parent 3829d681
package com.byit.api;
import com.byit.dto.plugin.RunRecordingStatus;
import com.byit.service.RunRecordingService;
import com.byit.service.impl.RunRecordingServiceImpl;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 运行实例操作控制器
* @date 2020年10月14日21:29:34
* @author huangfu
*/
@Api(tags = "运行实例操作控制器")
@RestController
@RequestMapping("api/operating/runRecording/")
public class RunRecordingOperatingController {
private final RunRecordingService runRecordingService;
public RunRecordingOperatingController(RunRecordingService runRecordingService) {
this.runRecordingService = runRecordingService;
}
@RequestMapping("findNoEnd")
public Boolean findNoEnd(@RequestBody RunRecordingStatus runRecordingStatus) {
return runRecordingService.findNoEnd(runRecordingStatus);
}
}
package com.byit.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import java.io.Serializable;
......@@ -10,7 +12,10 @@ import java.io.Serializable;
*/
@Data
@ToString
@AllArgsConstructor
@NoArgsConstructor
public class FlowConditionDto implements Serializable {
private static final long serialVersionUID = -239650918380052969L;
private Integer workspaceId;
private String flowName;
}
......@@ -44,6 +44,7 @@ public interface RunRecordingMapper {
* @return
*/
List<RunRecording> findAllRunIng(FlowConditionDto flowConditionDto);
/**
* 查询已经完结的,并且没有告警的任务流
* @return
......@@ -70,6 +71,12 @@ public interface RunRecordingMapper {
List<RunRecording> findRunningRunRecording();
/**
* 查询运行中的数据
* @return
*/
List<RunRecording> findNoEnd(FlowConditionDto flowConditionDto);
/**
* 根据工作流查询对应的实例
* @param flowId
* @return
......
package com.byit.service;
import com.byit.dto.FlowConditionDto;
import com.byit.dto.plugin.RunRecordingStatus;
import com.byit.model.RunRecording;
import com.byit.model.vo.RunRecordingViewVo;
......@@ -33,6 +34,13 @@ public interface RunRecordingService {
List<RunRecording> findAll(FlowConditionDto flowConditionDto);
/**
*
* @param runRecordingStatus
* @return
*/
boolean findNoEnd(RunRecordingStatus runRecordingStatus);
/**
* 查询全部错误的节点
* @return
*/
......
......@@ -3,11 +3,15 @@ package com.byit.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.byit.dto.FlowConditionDto;
import com.byit.dto.StatisticsConditionDto;
import com.byit.dto.plugin.RunRecordingStatus;
import com.byit.enums.RunRecordingEnum;
import com.byit.mapper.RunRecordingMapper;
import com.byit.model.RunRecording;
import com.byit.model.Workspace;
import com.byit.model.vo.RunRecordingViewVo;
import com.byit.service.RunRecordingService;
import com.byit.service.WorkspaceService;
import com.byit.utils.ValidationUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -29,10 +33,12 @@ import java.util.stream.Collectors;
@Slf4j
public class RunRecordingServiceImpl implements RunRecordingService {
private final RunRecordingMapper runRecordingMapper;
private final WorkspaceService workspaceService;
@Autowired
public RunRecordingServiceImpl(RunRecordingMapper runRecordingMapper) {
public RunRecordingServiceImpl(RunRecordingMapper runRecordingMapper, WorkspaceService workspaceService) {
this.runRecordingMapper = runRecordingMapper;
this.workspaceService = workspaceService;
}
@Override
......@@ -73,6 +79,19 @@ public class RunRecordingServiceImpl implements RunRecordingService {
}
@Override
public boolean findNoEnd(RunRecordingStatus runRecordingStatus) {
ValidationUtil.dataNotNull(runRecordingStatus,"查询实体不能为Null");
ValidationUtil.dataNotBank(runRecordingStatus.getFlowName(),"工作流名称不能为null");
ValidationUtil.dataNotBank(runRecordingStatus.getWorkspaceName(),"工作空间不能为Null");
String workspaceName = runRecordingStatus.getWorkspaceName();
Workspace byName = workspaceService.getByName(workspaceName);
ValidationUtil.dataNotNull(byName,"工作空间不存在");
FlowConditionDto flowConditionDto = new FlowConditionDto(byName.getWorkspaceId(), runRecordingStatus.getFlowName());
List<RunRecording> noEnd = runRecordingMapper.findNoEnd(flowConditionDto);
return CollectionUtil.isNotEmpty(noEnd);
}
@Override
public List<RunRecordingViewVo> findAllError(FlowConditionDto flowConditionDto) {
List<RunRecording> allError = runRecordingMapper.findAllError(flowConditionDto);
return allError.stream().map(runRecording -> {
......
......@@ -122,6 +122,20 @@
where flow_status = '2' and schedule_type != 4
</select>
<select id="findNoEnd" parameterType="com.byit.dto.FlowConditionDto" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from run_recording
where (flow_status = '2' or flow_status = '3' or flow_status = '1')
and schedule_type != 4
<if test="workspaceId != null">
AND workspace_id = #{workspaceId,jdbcType=INTEGER}
</if>
<if test="flowName != null and flowName != ''">
AND flow_name = #{flowName,jdbcType=VARCHAR}
</if>
</select>
<select id="findRunRecordingByFlowId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
......
package com.byit.dto.plugin;
import lombok.Data;
import java.io.Serializable;
/**
* 运行实例状态长训实体
*
* @date 2020年10月14日21:23:56
* @author huangfu
*/
@Data
public class RunRecordingStatus implements Serializable {
private static final long serialVersionUID = 7767046728921397387L;
private String flowName;
private String workspaceName;
}
......@@ -132,6 +132,11 @@ public class JobUtils {
*/
public static final String SPECIAL_REQUEST_REPAIRFLOW = "/api/operating/node/specialRunBatch";
/**
* 查询工作流是否运行完成
*/
public static final String FIND_NOT_END_FLOW = "/api/operating/runRecording/findNoEnd";
private static final String REQUEST_REAL_EXECT = "/api/node/runNode";
private static final String REQUEST_RUN_HISTORY = "/api/node/runHistory";
......@@ -232,6 +237,15 @@ public class JobUtils {
}
public static ResponseResult specialRequestRepairflow(RunRecordingStatus runRecordingStatus) {
log.debug("-------------查询工作流实例是否全部完结{}----------------------",runRecordingStatus);
String response = createHttpRequest(FIND_NOT_END_FLOW, JSON.toJSONString(runRecordingStatus, WriteClassName));
log.debug("-------------查询工作流实例是否全部完结结束:{}----------------------",response);
return JSON.parseObject(response, ResponseResult.class);
}
public static ResponseResult findFlowResult(List<JobStatusDto> jobStatusDtos) {
log.debug("-------------查询对应工作流的运行状态----------------------");
String response = createHttpRequest(FIND_FLOW_RESULT, "param=" + JSON.toJSONString(jobStatusDtos, WriteClassName));
......
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