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 3cee0b9e86
commit 223064800a

View File

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