From 2f7ac16d861917a012b4ce12e72e86dc9aeba1bf Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Mon, 22 Jul 2024 19:08:40 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8F=AF=E4=BB=A5=E9=87=8D=E5=A4=8D=E5=85=B3?= =?UTF-8?q?=E8=81=94=E9=9C=80=E6=B1=82=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1044284 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001044284 --- .../service/FunctionalCaseDemandService.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseDemandService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseDemandService.java index 3bebdde09c..dc1d9455d9 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseDemandService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseDemandService.java @@ -271,15 +271,18 @@ public class FunctionalCaseDemandService { for (DemandDTO demandDTO : demandDTOList) { FunctionalCaseDemand functionalCaseDemand = buildFunctionalCaseDemand(request.getCaseId(), request.getDemandPlatform(), userId, demandDTO); //校验重复 - List list = existDemands.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getDemandId(), functionalCaseDemand.getDemandId()) && StringUtils.equalsIgnoreCase(t.getParent(), functionalCaseDemand.getParent()) - && StringUtils.equalsIgnoreCase(t.getDemandName(), functionalCaseDemand.getDemandName()) && StringUtils.equalsIgnoreCase(t.getDemandUrl(), functionalCaseDemand.getDemandUrl())).toList(); - if (CollectionUtils.isNotEmpty(list)) { - continue; + List functionalCaseDemands = existMap.get(demandDTO.getDemandId()); + if (CollectionUtils.isNotEmpty(functionalCaseDemands)) { + List list = functionalCaseDemands.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getDemandId(), functionalCaseDemand.getDemandId()) && StringUtils.equalsIgnoreCase(t.getParent(), functionalCaseDemand.getParent()) + && StringUtils.equalsIgnoreCase(t.getDemandName(), functionalCaseDemand.getDemandName()) && StringUtils.equalsIgnoreCase(t.getDemandUrl(), functionalCaseDemand.getDemandUrl())).toList(); + if (CollectionUtils.isNotEmpty(list)) { + continue; + } } //校验当前关联的需求在系统或传入的数据结构中是否带有父节点,如果有置为true,用来做查询的root节点 - List functionalCaseDemands = existMap.get(demandDTO.getParent()); + List functionalCaseDemandParents = existMap.get(demandDTO.getParent()); List demandDTOList1 = insertMap.get(demandDTO.getParent()); - if (CollectionUtils.isNotEmpty(functionalCaseDemands) || CollectionUtils.isNotEmpty(demandDTOList1)) { + if (CollectionUtils.isNotEmpty(functionalCaseDemandParents) || CollectionUtils.isNotEmpty(demandDTOList1)) { functionalCaseDemand.setWithParent(Boolean.TRUE); } else { functionalCaseDemand.setWithParent(Boolean.FALSE);