From 11dc5915f83121a2cbee12eeaecbba8e883cb5fb Mon Sep 17 00:00:00 2001 From: aike <17730485278@139.com> Date: Tue, 9 Sep 2025 17:50:13 +0800 Subject: [PATCH] =?UTF-8?q?demand:=20TMS=E7=B3=BB=E7=BB=9F=20-=20=E8=BF=90?= =?UTF-8?q?=E8=BE=93=E7=AE=A1=E7=90=86=20-=20=E4=BC=98=E5=8C=96=E6=BC=8F?= =?UTF-8?q?=E7=BB=84=E6=89=B9=E6=AC=A1=E8=AE=A2=E5=8D=95=E5=AE=9A=E6=97=B6?= =?UTF-8?q?/=E5=AE=9E=E6=97=B6=E6=89=AB=E6=8F=8F=E7=AD=96=E7=95=A5?= =?UTF-8?q?=EF=BC=8C=E7=B2=BE=E7=A1=AE=E6=BC=8F=E7=BB=84=E6=89=B9=E6=AC=A1?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=8E=A8=E8=8D=90=E8=8C=83=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit committer: heyu --- .../erp/emis/service/EmisBaseService.java | 49 +++++++++++++------ 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/service/EmisBaseService.java b/emis-biz/src/main/java/com/xdadan/erp/emis/service/EmisBaseService.java index d133b38be..2ca357da4 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/service/EmisBaseService.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/service/EmisBaseService.java @@ -5134,7 +5134,7 @@ public class EmisBaseService { // 检查第一级是否至少有一个节点匹配 boolean hasFirstLevelMatch = false; - // 收集所有第一级节点的子节点(第二级) + // 收集第一级节点的子节点(第二级) Set secondLevelRules = new HashSet<>(); for (EmisTransPlanRule firstLevelRule : firstLevelRules) { @@ -5148,18 +5148,26 @@ public class EmisBaseService { && !batch.getEtd().before(firstLevelRule.getStartDate())) { firstLevelMatch = true; list.add(firstLevelRule); - // 收集当前第一级节点的所有子节点到第二级集合中 - if (!CollectionUtil.isEmpty(firstLevelRule.getChildren())) { - secondLevelRules.addAll(firstLevelRule.getChildren()); - } break; } } if (firstLevelMatch) { hasFirstLevelMatch = true; + // 如果当前节点匹配,则只收集该节点的子节点 + if (!CollectionUtil.isEmpty(firstLevelRule.getChildren())) { + secondLevelRules.addAll(firstLevelRule.getChildren()); + } } + } + // 如果第一级都不满足,则收集所有第一级节点的子节点 + if (!hasFirstLevelMatch) { + for (EmisTransPlanRule firstLevelRule : firstLevelRules) { + if (!CollectionUtil.isEmpty(firstLevelRule.getChildren())) { + secondLevelRules.addAll(firstLevelRule.getChildren()); + } + } } // 如果第二级为空,说明已经到底了,返回当前节点匹配且第一级至少有一个匹配的结果 @@ -5183,18 +5191,26 @@ public class EmisBaseService { && !batch.getEtd().before(secondLevelRule.getStartDate())) { secondLevelMatch = true; list.add(secondLevelRule); - // 收集当前第二级节点的所有子节点到第三级集合中 - if (!CollectionUtil.isEmpty(secondLevelRule.getChildren())) { - thirdLevelRules.addAll(secondLevelRule.getChildren()); - } break; } } if (secondLevelMatch) { hasSecondLevelMatch = true; + // 如果当前节点匹配,则只收集该节点的子节点 + if (!CollectionUtil.isEmpty(secondLevelRule.getChildren())) { + thirdLevelRules.addAll(secondLevelRule.getChildren()); + } } + } + // 如果第二级都不满足,则收集所有第二级节点的子节点 + if (!hasSecondLevelMatch) { + for (EmisTransPlanRule secondLevelRule : secondLevelRules) { + if (!CollectionUtil.isEmpty(secondLevelRule.getChildren())) { + thirdLevelRules.addAll(secondLevelRule.getChildren()); + } + } } // 递归处理下一级,并收集结果 @@ -5236,14 +5252,19 @@ public class EmisBaseService { if (currentLevelMatch) { hasCurrentLevelMatch = true; - if (CollectionUtil.isEmpty(currentLevelRule.getChildren())) { - return true; + // 如果当前节点匹配,则只收集该节点的子节点 + if (!CollectionUtil.isEmpty(currentLevelRule.getChildren())) { + nextLevelRules.addAll(currentLevelRule.getChildren()); } } + } - // 收集当前级节点的所有子节点到下一级集合中 - if (!CollectionUtil.isEmpty(currentLevelRule.getChildren())) { - nextLevelRules.addAll(currentLevelRule.getChildren()); + // 如果当前级都不满足,则收集所有当前级节点的子节点 + if (!hasCurrentLevelMatch) { + for (EmisTransPlanRule currentLevelRule : currentLevelRules) { + if (!CollectionUtil.isEmpty(currentLevelRule.getChildren())) { + nextLevelRules.addAll(currentLevelRule.getChildren()); + } } }