修复测试任务时节点不存在就报错问题
parent
0b688226bb
commit
da16ad74ac
|
@ -100,14 +100,20 @@ public class NodeUtils {
|
||||||
nodeTypeList.forEach(nodeType -> {
|
nodeTypeList.forEach(nodeType -> {
|
||||||
// 根据节点类型查询对应类型节点
|
// 根据节点类型查询对应类型节点
|
||||||
List<Node> nodes = nodeMapAll.get(nodeType.getNodeTypeCode());
|
List<Node> nodes = nodeMapAll.get(nodeType.getNodeTypeCode());
|
||||||
|
|
||||||
Integer maxNum = nodeType.getNodeMaxNum();
|
Integer maxNum = nodeType.getNodeMaxNum();
|
||||||
Integer minNum = nodeType.getNodeMinNum();
|
Integer minNum = nodeType.getNodeMinNum();
|
||||||
|
if (!nodes.isEmpty()){
|
||||||
int num = nodes.size();
|
int num = nodes.size();
|
||||||
if (minNum != -1 && num < minNum){
|
if (minNum != -1 && num < minNum){
|
||||||
throw new TaskException("节点 " + nodeType.getNodeTypeName() + " 数量不足,至少需要 " + minNum + " 个");
|
throw new TaskException("节点 " + nodeType.getNodeTypeName() + " 数量不足,至少需要 " + minNum + " 个");
|
||||||
}else if (maxNum != -1 && num > maxNum){
|
}else if (maxNum != -1 && num > maxNum){
|
||||||
throw new TaskException("节点 " + nodeType.getNodeTypeName() + " 数量超出范围,最多允许 " + maxNum + " 个");
|
throw new TaskException("节点 " + nodeType.getNodeTypeName() + " 数量超出范围,最多允许 " + maxNum + " 个");
|
||||||
}
|
}
|
||||||
|
}else if (minNum != -1){
|
||||||
|
throw new TaskException("节点 " + nodeType.getNodeTypeName() + " 数量不足,至少需要 " + minNum + " 个");
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue