fix(测试跟踪): 导出自动化用例报告报告详情的分页逻辑

--bug=1027608 --user=宋昌昌 【测试跟踪】测试报告导出报错 https://www.tapd.cn/55049933/s/1392783
This commit is contained in:
song-cc-rock 2023-07-13 16:22:00 +08:00 committed by jianxing
parent 9e9b55ef63
commit 730eb1a244
4 changed files with 16 additions and 24 deletions

View File

@ -4,6 +4,7 @@ import io.metersphere.base.domain.ApiDefinitionExecResultWithBLOBs;
import io.metersphere.commons.constants.MicroServiceName;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.SubListUtil;
import io.metersphere.dto.*;
import io.metersphere.plan.dto.*;
import io.metersphere.plan.request.api.ApiTestCaseRequest;
@ -184,12 +185,9 @@ public class PlanTestPlanApiCaseService extends ApiTestService {
}
//分批处理参数时为了不影响初始参数这里使用新的对象进行处理
List<TestPlanApiDTO> returnList = new ArrayList<>();
List<TestPlanApiDTO> paramList = new ArrayList<>(apiAllCases);
while (CollectionUtils.isNotEmpty(paramList)) {
List<TestPlanApiDTO> requestList = BatchProcessingUtil.subList(paramList, 20);
returnList.addAll(microService.postForDataArray(serviceName, BASE_UEL + "/build/response", requestList, TestPlanApiDTO.class));
paramList.removeAll(requestList);
}
SubListUtil.dealForSubList(apiAllCases, 200, (list) -> {
returnList.addAll(microService.postForDataArray(serviceName, BASE_UEL + "/build/response", list, TestPlanApiDTO.class));
});
return returnList;
}

View File

@ -4,6 +4,7 @@ import io.metersphere.base.domain.TestPlanReport;
import io.metersphere.commons.constants.MicroServiceName;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.SubListUtil;
import io.metersphere.dto.*;
import io.metersphere.plan.constant.ApiReportStatus;
import io.metersphere.plan.dto.*;
@ -197,13 +198,10 @@ public class PlanTestPlanScenarioCaseService extends ApiTestService {
return null;
}
//分批处理参数时为了不影响初始参数这里使用新的对象进行处理
List<TestPlanScenarioDTO> paramList = new ArrayList<>(scenarioCases);
List<TestPlanScenarioDTO> returnList = new ArrayList<>();
while (CollectionUtils.isNotEmpty(paramList)) {
List<TestPlanScenarioDTO> requestList = BatchProcessingUtil.subList(paramList, 5);
returnList.addAll(microService.postForDataArray(serviceName, BASE_UEL + "/build/response", scenarioCases, TestPlanScenarioDTO.class));
paramList.removeAll(requestList);
}
SubListUtil.dealForSubList(scenarioCases, 20, (list) -> {
returnList.addAll(microService.postForDataArray(serviceName, BASE_UEL + "/build/response", list, TestPlanScenarioDTO.class));
});
return returnList;
}

View File

@ -4,6 +4,7 @@ import io.metersphere.commons.constants.MicroServiceName;
import io.metersphere.commons.constants.TestPlanLoadCaseStatus;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.SubListUtil;
import io.metersphere.dto.PlanReportCaseDTO;
import io.metersphere.dto.TestPlanLoadCaseDTO;
import io.metersphere.dto.TestPlanLoadResultReportDTO;
@ -140,13 +141,10 @@ public class PlanTestPlanLoadCaseService extends LoadTestService {
return null;
}
//分批处理参数时为了不影响初始参数这里使用新的对象进行处理
List<TestPlanLoadCaseDTO> paramList = new ArrayList<>(loadCases);
List<TestPlanLoadCaseDTO> returnList = new ArrayList<>();
while (CollectionUtils.isNotEmpty(paramList)) {
List<TestPlanLoadCaseDTO> requestList = BatchProcessingUtil.subList(paramList, 5);
returnList.addAll(microService.postForDataArray(serviceName, BASE_UEL + "/build/response", loadCases, TestPlanLoadCaseDTO.class));
paramList.removeAll(requestList);
}
SubListUtil.dealForSubList(loadCases, 20, (paramList) -> {
returnList.addAll(microService.postForDataArray(serviceName, BASE_UEL + "/build/response", paramList, TestPlanLoadCaseDTO.class));
});
return returnList;
}

View File

@ -6,6 +6,7 @@ import io.metersphere.base.domain.UiScenarioReportWithBLOBs;
import io.metersphere.commons.constants.MicroServiceName;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.SubListUtil;
import io.metersphere.dto.*;
import io.metersphere.plan.constant.ApiReportStatus;
import io.metersphere.plan.dto.*;
@ -161,13 +162,10 @@ public class PlanTestPlanUiScenarioCaseService extends UiTestService {
}
//分批处理参数时为了不影响初始参数这里使用新的对象进行处理
List<TestPlanUiScenarioDTO> paramList = new ArrayList<>(uiCases);
List<TestPlanUiScenarioDTO> returnList = new ArrayList<>();
while (CollectionUtils.isNotEmpty(paramList)) {
List<TestPlanUiScenarioDTO> requestList = BatchProcessingUtil.subList(paramList, 5);
returnList.addAll(microService.postForDataArray(serviceName, BASE_URL + "/build/response", uiCases, TestPlanUiScenarioDTO.class));
paramList.removeAll(requestList);
}
SubListUtil.dealForSubList(uiCases, 20, list -> {
returnList.addAll(microService.postForDataArray(serviceName, BASE_URL + "/build/response", list, TestPlanUiScenarioDTO.class));
});
return returnList;
}