Commit 40467a8b by guo_minglei@163.com

实时运行任务节点

parent d2c8977f
package com.byit.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.byit.enums.NodePropertyEnum;
import com.byit.mapper.JobTaskScheduleMapper;
import com.byit.model.JobTaskSchedule;
import com.byit.service.ApiNodeService;
import com.byit.utils.ValidationUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
@Service
@Transactional(rollbackFor = Exception.class)
public class ApiNodeServiceImpl implements ApiNodeService {
@Resource
private JobTaskScheduleMapper jobTaskScheduleMapper;
@Override
public String runNode(String param) {
......@@ -18,6 +25,7 @@ public class ApiNodeServiceImpl implements ApiNodeService {
JSONObject jsonObject = JSONObject.parseObject(param);
String nodeId = jsonObject.getString("nodeId");
ValidationUtil.dataNotBank(nodeId, "节点id不允许为空!");
String runId = "REAL-EXEC-" + nodeId;
String nodeName = jsonObject.getString("nodeName");
ValidationUtil.dataNotBank(nodeName, "节点名称不允许为空!");
String runCmd = jsonObject.getString("runCmd");
......@@ -27,8 +35,22 @@ public class ApiNodeServiceImpl implements ApiNodeService {
String runSource = jsonObject.getString("runSource");
String jobType = jsonObject.getString("jobType");
ValidationUtil.dataNotBank(jobType, "节点类型不允许为空!");
JobTaskSchedule schedule = new JobTaskSchedule();
return null;
schedule.setNodeId(Integer.valueOf(nodeId));
schedule.setRunId(runId);
schedule.setNodeName(nodeName);
schedule.setIsVirtual(NodePropertyEnum.ISNOT_VIRTUAL.getCode());
schedule.setRunParam(runParam);
schedule.setRunCommand(runCmd);
schedule.setRunSource(runSource);
schedule.setScriptUrls(scriptUrl);
schedule.setJobType(jobType);
schedule.setTriggerTime(System.currentTimeMillis());
jobTaskScheduleMapper.saveJobTaskSchedule(schedule);
return runId;
}
}
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