优化校验

master
面包骑士 2024-09-05 18:00:47 +08:00
parent da16ad74ac
commit b450a4c2af
2 changed files with 12 additions and 5 deletions

View File

@ -150,8 +150,12 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>
List<Node> nodeListAll = nodeService.selectNodeList(new NodeReq().buildTaskCode(taskCode)); List<Node> nodeListAll = nodeService.selectNodeList(new NodeReq().buildTaskCode(taskCode));
// 节点初始化 // 节点初始化
HashMap<String, List<Node>> nodeMap = NodeUtils.nodeInit(nodeListAll); HashMap<String, List<Node>> nodeMap = NodeUtils.nodeInit(nodeListAll);
List<NodeType> nodeTypeList = selectNodeTypeList();
/* 节点组成校验 */
NodeUtils.nodeCheckMakeUp(nodeListAll, nodeTypeList);
/* 节点连接规范校验 */ /* 节点连接规范校验 */
NodeUtils.nodeCheckNorm(nodeListAll,selectNodeTypeList()); NodeUtils.nodeCheckNorm(nodeListAll, nodeTypeList);
// 开始节点处理 // 开始节点处理
Node thisNode = nodeMap.get("start").get(0); Node thisNode = nodeMap.get("start").get(0);
@ -176,9 +180,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>
}else if (StringUtils.equals(thisNode.getNodeType(), "unite")){ }else if (StringUtils.equals(thisNode.getNodeType(), "unite")){
findSql = NodeUtils.nodeDispUnite(dispList); findSql = NodeUtils.nodeDispUnite(dispList);
}else if (StringUtils.equals(thisNode.getNodeType(), "exportation")){ }else if (StringUtils.equals(thisNode.getNodeType(), "exportation")){
if (StringUtils.isEmpty(findSql)){
throw new TaskException("数据输出节点必须紧跟在数据输入/操作节点之后");
}
// 执行查询语句 // 执行查询语句
log.info("任务执行查询阶段结束,查询sql为: [{}]", findSql); log.info("任务执行查询阶段结束,查询sql为: [{}]", findSql);
Result<List<DataModel>> tableValue = remoteDataSourceService.findTableValue(new DataValueModel(4L, findSql)); Result<List<DataModel>> tableValue = remoteDataSourceService.findTableValue(new DataValueModel(4L, findSql));

View File

@ -131,6 +131,13 @@ public class NodeUtils {
List<Node> nodes = nodeMapAll.get(nodeType.getNodeTypeCode()); List<Node> nodes = nodeMapAll.get(nodeType.getNodeTypeCode());
if (nodes != null) { if (nodes != null) {
nodes.forEach(node -> { nodes.forEach(node -> {
if (StringUtils.equals(node.getNodeType(), "exportation")){
Node nextNode = getPreNode(node, nodeListAll);
if (!StringUtils.equals(nextNode.getNodeType(), "start") &&
!StringUtils.equals(nextNode.getNodeType(), "unit")) {
throw new TaskException("数据输出节点必须紧跟在数据输入/操作节点之后");
}
}
// 获取该节点的下级节点 // 获取该节点的下级节点
List<Node> nextNodeList = getNextNode(node, nodeListAll); List<Node> nextNodeList = getNextNode(node, nodeListAll);
if (nextNodeList != null && !nextNodeList.isEmpty()){ if (nextNodeList != null && !nextNodeList.isEmpty()){
@ -145,7 +152,6 @@ public class NodeUtils {
} }
}); });
} }
}); });
} }