fix(接口测试):解决接口导入覆盖版本不置新要区分url是否重复问题

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

View File

@ -241,8 +241,13 @@ public class ApiDefinitionImportUtilService {
//这里把数据库里与该接口相同的所有接口筛选出来包括不同的版本
//如果 sameRefIds toUpdates 相同就用 toUpdates 代替 sameRefIds因为toUpdates 可能会修改模块路径
if (CollectionUtils.isNotEmpty(repeatList)) {
sameRefIds = repeatList.stream().filter(t -> t.getRefId().equals(item.getRefId()) && t.getModuleId().equals(item.getModuleId())).collect(Collectors.toList());
if (urlRepeat) {
sameRefIds = repeatList.stream().filter(t -> t.getRefId().equals(item.getRefId()) && t.getModuleId().equals(item.getModuleId())).collect(Collectors.toList());
} else {
sameRefIds = repeatList.stream().filter(t -> t.getRefId().equals(item.getRefId())).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();
List<String> reduce1 = repeatIds.stream().filter(t -> !toUpDateIds.contains(t)).collect(Collectors.toList());