refactor(接口测试): 首次导入时文件存下重复接口的导入优化

--story=1011301 --user=郭雨琦
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001011301
This commit is contained in:
guoyuqi 2023-03-10 14:01:22 +08:00 committed by 刘瑞斌
parent 0418a5b31c
commit ee0a5f1a49
1 changed files with 7 additions and 1 deletions

View File

@ -303,12 +303,18 @@ public class ApiDefinitionImportUtilService {
}
}
//取出当前操作接口应该导入的case用于对比名字重复加序号
List<String> nameList = new ArrayList<>();
List<ApiTestCaseWithBLOBs> importCaseList = importCaseMap.get(apiId);
List<String> nameList = importCaseList.stream().map(ApiTestCaseWithBLOBs::getName).toList();
if (CollectionUtils.isNotEmpty(importCaseList)) {
nameList = importCaseList.stream().map(ApiTestCaseWithBLOBs::getName).toList();
}
for (int i = 0; i < apiTestCaseWithBLOBs.size(); i++) {
ApiTestCaseWithBLOBs apiTestCaseWithBLOBs1 = apiTestCaseWithBLOBs.get(i);
if (nameList.contains(apiTestCaseWithBLOBs1.getName())) {
apiTestCaseWithBLOBs1.setName(apiTestCaseWithBLOBs1.getName() + "0" + i);
nameList.add(apiTestCaseWithBLOBs1.getName() + "0" + i);
} else {
nameList.add(apiTestCaseWithBLOBs1.getName());
}
}
optionDataCases.addAll(apiTestCaseWithBLOBs);