fix(功能用例): 修复可以重复关联需求问题

--bug=1044284 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001044284
This commit is contained in:
guoyuqi 2024-07-22 19:08:40 +08:00 committed by Craftsman
parent b0bcbc6cb7
commit 2f7ac16d86
1 changed files with 9 additions and 6 deletions

View File

@ -271,15 +271,18 @@ public class FunctionalCaseDemandService {
for (DemandDTO demandDTO : demandDTOList) {
FunctionalCaseDemand functionalCaseDemand = buildFunctionalCaseDemand(request.getCaseId(), request.getDemandPlatform(), userId, demandDTO);
//校验重复
List<FunctionalCaseDemand> 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<FunctionalCaseDemand> functionalCaseDemands = existMap.get(demandDTO.getDemandId());
if (CollectionUtils.isNotEmpty(functionalCaseDemands)) {
List<FunctionalCaseDemand> 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<FunctionalCaseDemand> functionalCaseDemands = existMap.get(demandDTO.getParent());
List<FunctionalCaseDemand> functionalCaseDemandParents = existMap.get(demandDTO.getParent());
List<DemandDTO> 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);