fix(接口测试): 修复测试报告删除全部数据报错的缺陷

--bug=1015797 --user=王孝刚 [接口测试]
github#16849接口报表-场景报告,批量删除9000条记录时,加载了十几分钟后提示删除失败
https://www.tapd.cn/55049933/s/1224560
This commit is contained in:
wxg0103 2022-08-16 18:16:36 +08:00 committed by f2c-ci-robot[bot]
parent 60001ee081
commit f2bd84af30
1 changed files with 5 additions and 5 deletions

View File

@ -767,7 +767,7 @@ public class ApiScenarioReportService {
reportRequest.setIds(myList); reportRequest.setIds(myList);
//为预防数量太多调用删除方法时引起SQL过长的Bug此处采取分批执行的方式 //为预防数量太多调用删除方法时引起SQL过长的Bug此处采取分批执行的方式
//每次处理的数据数量 //每次处理的数据数量
int handleCount = 5000; int handleCount = 2000;
//每次处理的集合 //每次处理的集合
while (ids.size() > handleCount) { while (ids.size() > handleCount) {
List<String> handleIdList = new ArrayList<>(handleCount); List<String> handleIdList = new ArrayList<>(handleCount);
@ -961,10 +961,10 @@ public class ApiScenarioReportService {
if (StringUtils.isNotEmpty(dto.getRunMode()) && dto.getRunMode().startsWith("UI")) { if (StringUtils.isNotEmpty(dto.getRunMode()) && dto.getRunMode().startsWith("UI")) {
try { try {
errorSize = dto.getRequestResults().stream().filter(requestResult -> errorSize = dto.getRequestResults().stream().filter(requestResult ->
StringUtils.isNotEmpty(requestResult.getResponseResult().getHeaders()) StringUtils.isNotEmpty(requestResult.getResponseResult().getHeaders())
&& JSONArray.parseArray(requestResult.getResponseResult().getHeaders()).stream().filter( && JSONArray.parseArray(requestResult.getResponseResult().getHeaders()).stream().filter(
r -> ((JSONObject) r).containsKey("success") && !((JSONObject) r).getBoolean("success") r -> ((JSONObject) r).containsKey("success") && !((JSONObject) r).getBoolean("success")
).count() > 0) ).count() > 0)
.count(); .count();
} catch (Exception e) { } catch (Exception e) {
// UI 返回的结果在 headers 里面格式不符合规范的直接认定结果为失败 // UI 返回的结果在 headers 里面格式不符合规范的直接认定结果为失败