From ef9c6f56deaa201eb38d56543034bd5a03fb2237 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Tue, 4 Apr 2023 19:25:38 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=8E=A5=E5=8F=A3=E5=AF=BC=E5=85=A5=E8=A6=86?= =?UTF-8?q?=E7=9B=96=E7=89=88=E6=9C=AC=E4=B8=8D=E7=BD=AE=E6=96=B0=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E5=AF=BC=E5=85=A5=E9=A1=B9=E7=9B=AE=E4=B8=AD=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E7=9A=84=E6=8E=A5=E5=8F=A3=E5=88=9B=E5=BB=BA=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E4=B8=BA=E6=96=87=E4=BB=B6=E5=86=85=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1025126 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001025126 --- .../service/definition/ApiDefinitionImportUtilService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionImportUtilService.java b/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionImportUtilService.java index e02e7240f1..a66e9e05bb 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionImportUtilService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionImportUtilService.java @@ -241,7 +241,7 @@ public class ApiDefinitionImportUtilService { //这里把数据库里与该接口相同的所有接口筛选出来包括不同的版本 //如果 sameRefIds 与 toUpdates 相同,就用 toUpdates 代替 sameRefIds,因为toUpdates 可能会修改模块路径 if (CollectionUtils.isNotEmpty(repeatList)) { - sameRefIds = repeatList.stream().filter(t -> t.getRefId().equals(item.getRefId())).collect(Collectors.toList()); + sameRefIds = repeatList.stream().filter(t -> t.getRefId().equals(item.getRefId()) && t.getModuleId().equals(item.getModuleId())).collect(Collectors.toList()); List repeatIds = sameRefIds.stream().map(ApiDefinition::getId).toList(); List toUpdates = toUpdateList.stream().filter(t -> t.getRefId().equals(item.getRefId())).collect(Collectors.toList()); List toUpDateIds = toUpdates.stream().map(ApiDefinition::getId).toList(); @@ -813,6 +813,7 @@ public class ApiDefinitionImportUtilService { apiTestCaseWithBLOBs.setId(UUID.randomUUID().toString()); apiTestCaseWithBLOBs.setCreateUserId(Objects.requireNonNull(SessionUtils.getUser()).getId()); apiTestCaseWithBLOBs.setUpdateUserId(Objects.requireNonNull(SessionUtils.getUser()).getId()); + apiTestCaseWithBLOBs.setCreateTime(System.currentTimeMillis()); BeanUtils.copyBean(apiTestCaseDTO, apiTestCaseWithBLOBs); apiTestCaseDTO.setUpdated(false); apiTestCaseMapper.insert(apiTestCaseWithBLOBs); @@ -1105,7 +1106,7 @@ public class ApiDefinitionImportUtilService { List moduleData = moduleOptionData.get(modulePath); if (moduleData != null && moduleData.size() <= 1) { ApiModule apiModule = moduleMap.get(modulePath); - if (parentIdModuleMap.get(apiModule.getId()) == null) { + if (apiModule != null && parentIdModuleMap.get(apiModule.getId()) == null) { moduleMap.remove(modulePath); } moduleData.remove(apiDefinitionWithBLOBs);