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);