fix(接口测试):解决接口导入覆盖版本不置新以及导入项目中没有的接口创建时间为文件内时间问题

--bug=1025126 --user=郭雨琦
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001025126
This commit is contained in:
guoyuqi 2023-04-04 19:25:38 +08:00 committed by xiaomeinvG
parent 72f903a303
commit ef9c6f56de
1 changed files with 3 additions and 2 deletions

View File

@ -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<String> repeatIds = sameRefIds.stream().map(ApiDefinition::getId).toList();
List<ApiDefinitionWithBLOBs> toUpdates = toUpdateList.stream().filter(t -> t.getRefId().equals(item.getRefId())).collect(Collectors.toList());
List<String> 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<ApiDefinitionWithBLOBs> 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);