|
@@ -4960,13 +4960,13 @@ public R<Object> customAddContractNode(@RequestBody CustomAddContractNodeDTO dto
|
|
|
|
|
|
// 安全检测1:防止循环引用导致无限循环
|
|
// 安全检测1:防止循环引用导致无限循环
|
|
if (processedCount > totalNodes * 2) {
|
|
if (processedCount > totalNodes * 2) {
|
|
- throw new IllegalStateException("处理节点数超过预期,可能存在循环引用。已处理: "
|
|
|
|
|
|
+ throw new ServiceException("处理节点数超过预期,可能存在循环引用。已处理: "
|
|
+ processedCount + ",总节点: " + totalNodes);
|
|
+ processedCount + ",总节点: " + totalNodes);
|
|
}
|
|
}
|
|
|
|
|
|
// 安全检测2:防止路径过长
|
|
// 安全检测2:防止路径过长
|
|
if (parent.getAncestorsPId().split(",").length > MAX_DEPTH) {
|
|
if (parent.getAncestorsPId().split(",").length > MAX_DEPTH) {
|
|
- throw new IllegalStateException("祖级路径超过最大深度限制: " + MAX_DEPTH);
|
|
|
|
|
|
+ throw new ServiceException("祖级路径超过最大深度限制: " + MAX_DEPTH);
|
|
}
|
|
}
|
|
|
|
|
|
List<WbsTreeContract> children = childrenMap.get(parent.getPKeyId());
|
|
List<WbsTreeContract> children = childrenMap.get(parent.getPKeyId());
|
|
@@ -4975,7 +4975,7 @@ public R<Object> customAddContractNode(@RequestBody CustomAddContractNodeDTO dto
|
|
for (WbsTreeContract child : children) {
|
|
for (WbsTreeContract child : children) {
|
|
// 安全检测3:检查循环引用
|
|
// 安全检测3:检查循环引用
|
|
if (visited.contains(child.getPKeyId())) {
|
|
if (visited.contains(child.getPKeyId())) {
|
|
- throw new IllegalStateException("检测到循环引用: 节点" + child.getPKeyId()
|
|
|
|
|
|
+ throw new ServiceException("检测到循环引用: 节点" + child.getPKeyId()
|
|
+ " -> 节点" + parent.getPKeyId());
|
|
+ " -> 节点" + parent.getPKeyId());
|
|
}
|
|
}
|
|
|
|
|