Commit f4889200 by huangfusuper

重跑错误处理

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