Commit f4889200 by huangfusuper

重跑错误处理

parent b7e04437
...@@ -116,7 +116,7 @@ public class ApiFlowController { ...@@ -116,7 +116,7 @@ public class ApiFlowController {
@PostMapping("reRunJob") @PostMapping("reRunJob")
@ApiOperation("重跑节点") @ApiOperation("重跑节点")
public ResponseResult reRunJob(String param) { public ResponseResult reRunJob(@RequestBody RunInfo param) {
apiFlowService.reRunJob(param); apiFlowService.reRunJob(param);
return ResponseResult.ok("SUCCESS"); return ResponseResult.ok("SUCCESS");
} }
......
...@@ -49,7 +49,7 @@ public interface ApiFlowService { ...@@ -49,7 +49,7 @@ public interface ApiFlowService {
* 重跑任务 * 重跑任务
* @param param * @param param
*/ */
void reRunJob(String param); void reRunJob(RunInfo param);
/** /**
* 手动置为成功 * 手动置为成功
......
...@@ -8,7 +8,6 @@ import com.alibaba.fastjson.JSON; ...@@ -8,7 +8,6 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.byit.dto.StatisticsConditionDto; import com.byit.dto.StatisticsConditionDto;
import com.byit.dto.api.DeleteDto; import com.byit.dto.api.DeleteDto;
import com.byit.dto.executor.RunParamWrapped;
import com.byit.dto.executor.ScriptParamAndPlaceholderDto; import com.byit.dto.executor.ScriptParamAndPlaceholderDto;
import com.byit.dto.plugin.*; import com.byit.dto.plugin.*;
import com.byit.dto.recording.LoadScheduleCondition; import com.byit.dto.recording.LoadScheduleCondition;
...@@ -18,7 +17,6 @@ import com.byit.enums.*; ...@@ -18,7 +17,6 @@ import com.byit.enums.*;
import com.byit.enums.plugin.PluginNodeTypeEnum; import com.byit.enums.plugin.PluginNodeTypeEnum;
import com.byit.job.utils.CronExpression; import com.byit.job.utils.CronExpression;
import com.byit.job.utils.CurrentUserUtils; import com.byit.job.utils.CurrentUserUtils;
import com.byit.job.utils.PlaceholderUtils;
import com.byit.mapper.*; import com.byit.mapper.*;
import com.byit.model.JobTaskRunLog; import com.byit.model.JobTaskRunLog;
import com.byit.model.RunRecording; import com.byit.model.RunRecording;
...@@ -152,11 +150,11 @@ public class ApiFlowServiceImpl implements ApiFlowService { ...@@ -152,11 +150,11 @@ public class ApiFlowServiceImpl implements ApiFlowService {
*/ */
private Flow saveFlow(PluginFlow pluginFlow, Integer workspaceId, boolean isInnner, String upFlowName) throws Exception { private Flow saveFlow(PluginFlow pluginFlow, Integer workspaceId, boolean isInnner, String upFlowName) throws Exception {
//拼装工作流名称 //拼装工作流名称
upFlowName = String.format("%s:%s",upFlowName,pluginFlow.getName()); upFlowName = String.format("%s:%s", upFlowName, pluginFlow.getName());
Flow flow = new Flow(); Flow flow = new Flow();
FlowExtendedConfiguration extendedConfiguration = pluginFlow.getConfig().getExtendedConfiguration(); FlowExtendedConfiguration extendedConfiguration = pluginFlow.getConfig().getExtendedConfiguration();
if(extendedConfiguration == null) { if (extendedConfiguration == null) {
extendedConfiguration = new FlowExtendedConfiguration(); extendedConfiguration = new FlowExtendedConfiguration();
} }
extendedConfiguration.setFlowEmbedLogo(upFlowName); extendedConfiguration.setFlowEmbedLogo(upFlowName);
...@@ -493,12 +491,11 @@ public class ApiFlowServiceImpl implements ApiFlowService { ...@@ -493,12 +491,11 @@ public class ApiFlowServiceImpl implements ApiFlowService {
/** /**
* 重跑任务 * 重跑任务
* *
* @param param * @param runInfo
*/ */
@Override @Override
public void reRunJob(String param) { public void reRunJob(RunInfo runInfo) {
ValidationUtil.dataNotBank(param, "请求参数不允许为空!"); ValidationUtil.dataNotNull(runInfo, "请求参数不允许为空!");
RunInfo runInfo = JSON.parseObject(param, RunInfo.class);
//获取工作空间名称 //获取工作空间名称
ValidationUtil.dataNotBank(runInfo.getWorkspaceName(), "工作空间名称不允许为空!"); ValidationUtil.dataNotBank(runInfo.getWorkspaceName(), "工作空间名称不允许为空!");
//获取工作流名称 //获取工作流名称
...@@ -528,8 +525,7 @@ public class ApiFlowServiceImpl implements ApiFlowService { ...@@ -528,8 +525,7 @@ public class ApiFlowServiceImpl implements ApiFlowService {
JobTaskRunLog jobTaskRunLog = jobTaskRunLogMapper.findByRunIdAndFlowIdAndNodeName(runInfo.getRunId(), flow.getFlowId(), runInfo.getNodeName()); JobTaskRunLog jobTaskRunLog = jobTaskRunLogMapper.findByRunIdAndFlowIdAndNodeName(runInfo.getRunId(), flow.getFlowId(), runInfo.getNodeName());
ValidationUtil.dataNotNull(jobTaskRunLog, "查无此运行记录"); ValidationUtil.dataNotNull(jobTaskRunLog, "查无此运行记录");
String userName = currentUserUtils.account(); String userName = runInfo.getOperator();
//校验上级是否成功 //校验上级是否成功
if (StringUtils.isNotEmpty(jobTaskRunLog.getNodeDepend())) { if (StringUtils.isNotEmpty(jobTaskRunLog.getNodeDepend())) {
List<String> dependNodeList = Arrays.asList(jobTaskRunLog.getNodeDepend().split(",")); List<String> dependNodeList = Arrays.asList(jobTaskRunLog.getNodeDepend().split(","));
...@@ -664,7 +660,7 @@ public class ApiFlowServiceImpl implements ApiFlowService { ...@@ -664,7 +660,7 @@ public class ApiFlowServiceImpl implements ApiFlowService {
Node node = nodeMapper.getByMapFlowId(flow.getFlowId()); Node node = nodeMapper.getByMapFlowId(flow.getFlowId());
RunInfo nodeRun = RunInfo.builder().workspaceName(runInfo.getWorkspaceName()).flowName(runInfo.getFlowName()) RunInfo nodeRun = RunInfo.builder().workspaceName(runInfo.getWorkspaceName()).flowName(runInfo.getFlowName())
.nodeName(node.getNodeName()).runId(runInfo.getRunId()).runState("1").build(); .nodeName(node.getNodeName()).runId(runInfo.getRunId()).runState("1").build();
reRunJob(JSON.toJSONString(nodeRun, WriteClassName)); reRunJob(nodeRun);
} else { } else {
//不是内嵌工作流 //不是内嵌工作流
Long triggerTime = System.currentTimeMillis(); Long triggerTime = System.currentTimeMillis();
...@@ -1335,14 +1331,14 @@ public class ApiFlowServiceImpl implements ApiFlowService { ...@@ -1335,14 +1331,14 @@ public class ApiFlowServiceImpl implements ApiFlowService {
waitingRecord.setWaitOrder(++order); waitingRecord.setWaitOrder(++order);
String extendedConfiguration = flow.getExtendedConfiguration(); String extendedConfiguration = flow.getExtendedConfiguration();
FlowExtendedConfiguration flowExtendedConfiguration = JSON.parseObject(extendedConfiguration, FlowExtendedConfiguration.class); FlowExtendedConfiguration flowExtendedConfiguration = JSON.parseObject(extendedConfiguration, FlowExtendedConfiguration.class);
Map<String,String> publicParamMap = JSON.parseObject(flowExtendedConfiguration.getPublicParam(), Map.class); Map<String, String> publicParamMap = JSON.parseObject(flowExtendedConfiguration.getPublicParam(), Map.class);
if(CollectionUtil.isEmpty(publicParamMap)){ if (CollectionUtil.isEmpty(publicParamMap)) {
publicParamMap = new HashMap<>(8); publicParamMap = new HashMap<>(8);
} }
publicParamMap.put(PlaceholderEnum.DATE_PLACEHOLDER.getName(), repairTime); publicParamMap.put(PlaceholderEnum.DATE_PLACEHOLDER.getName(), repairTime);
publicParamMap.put(PlaceholderEnum.NOW_DATE_PLACEHOLDER.getName(), DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss")); publicParamMap.put(PlaceholderEnum.NOW_DATE_PLACEHOLDER.getName(), DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
flowExtendedConfiguration.setPublicParam(JSON.toJSONString(publicParamMap)); flowExtendedConfiguration.setPublicParam(JSON.toJSONString(publicParamMap));
waitingRecord.setExtendedConfiguration(JSON.toJSONString(flowExtendedConfiguration)); waitingRecord.setExtendedConfiguration(JSON.toJSONString(flowExtendedConfiguration));
//需要按着时间先后来设置时间 //需要按着时间先后来设置时间
...@@ -1417,11 +1413,11 @@ public class ApiFlowServiceImpl implements ApiFlowService { ...@@ -1417,11 +1413,11 @@ public class ApiFlowServiceImpl implements ApiFlowService {
scriptParamAndPlaceholderDto = new ScriptParamAndPlaceholderDto(); scriptParamAndPlaceholderDto = new ScriptParamAndPlaceholderDto();
} }
Map<String, String> param = scriptParamAndPlaceholderDto.getParam(); Map<String, String> param = scriptParamAndPlaceholderDto.getParam();
if(param == null){ if (param == null) {
param = new HashMap<>(8); param = new HashMap<>(8);
} }
Map<String, String> placeholder = scriptParamAndPlaceholderDto.getPlaceholder(); Map<String, String> placeholder = scriptParamAndPlaceholderDto.getPlaceholder();
if(placeholder == null){ if (placeholder == null) {
placeholder = new HashMap<>(8); placeholder = new HashMap<>(8);
} }
......
...@@ -537,7 +537,7 @@ public class JobUtils { ...@@ -537,7 +537,7 @@ public class JobUtils {
*/ */
public static ResponseResult reRunJob(RunInfo runInfo) { public static ResponseResult reRunJob(RunInfo runInfo) {
//发送请求 添加任务 //发送请求 添加任务
String response = createHttpRequest(REQUEST_FLOW_RERUNJOB, "param=" + JSON.toJSONString(runInfo, WriteClassName)); String response = createHttpRequest(REQUEST_FLOW_RERUNJOB, JSON.toJSONString(runInfo, WriteClassName));
log.debug("--------------------重跑节点接口调用成功,结果为:{}------------------------", response); log.debug("--------------------重跑节点接口调用成功,结果为:{}------------------------", response);
return JSON.parseObject(response, ResponseResult.class); return JSON.parseObject(response, ResponseResult.class);
} }
......
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