fix(测试跟踪): 测试计划用例列表排序总数有误的问题

--bug=1015743 --user=宋昌昌 [测试跟踪]github#16785测试计划-功能用例排序不正确 https://www.tapd.cn/55049933/s/1229336
This commit is contained in:
song-cc-rock 2022-08-22 15:28:04 +08:00 committed by f2c-ci-robot[bot]
parent d6e1458b3b
commit 2133ab291b
2 changed files with 24 additions and 20 deletions

View File

@ -30,8 +30,10 @@ public class TestPlanTestCaseController {
@PostMapping("/list/{goPage}/{pageSize}")
public Pager<List<TestPlanCaseDTO>> getTestPlanCases(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestPlanCaseRequest request) {
QueryTestPlanCaseRequest paramRequest = testPlanTestCaseService.setCustomNumOrderParam(request);
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, testPlanTestCaseService.list(request));
List<TestPlanCaseDTO> list = testPlanTestCaseService.list(paramRequest);
return PageUtils.setPageInfo(page, list);
}
/*jenkins测试计划下全部用例*/

View File

@ -94,6 +94,26 @@ public class TestPlanTestCaseService {
}
public List<TestPlanCaseDTO> list(QueryTestPlanCaseRequest request) {
List<TestPlanCaseDTO> list = extTestPlanTestCaseMapper.list(request);
if (CollectionUtils.isNotEmpty(list)) {
// 设置版本信息
ServiceUtils.buildVersionInfo(list);
ServiceUtils.buildProjectInfo(list);
ServiceUtils.buildCustomNumInfo(list);
QueryMemberRequest queryMemberRequest = new QueryMemberRequest();
queryMemberRequest.setProjectId(request.getProjectId());
Map<String, String> userMap = userService.getProjectMemberList(queryMemberRequest)
.stream().collect(Collectors.toMap(User::getId, User::getName));
list.forEach(item -> {
item.setExecutorName(userMap.get(item.getExecutor()));
item.setMaintainerName(userMap.get(item.getMaintainer()));
});
}
return list;
}
public QueryTestPlanCaseRequest setCustomNumOrderParam(QueryTestPlanCaseRequest request) {
List<OrderRequest> orders = ServiceUtils.getDefaultSortOrder(request.getOrders());
// CUSTOM_NUM ORDER
boolean customOrderFlag = orders.stream().anyMatch(order -> StringUtils.equals(order.getName(), CUSTOM_NUM));
@ -111,25 +131,7 @@ public class TestPlanTestCaseService {
});
}
request.setOrders(orders);
List<TestPlanCaseDTO> list = extTestPlanTestCaseMapper.list(request);
if (CollectionUtils.isNotEmpty(list)) {
// 设置版本信息
ServiceUtils.buildVersionInfo(list);
ServiceUtils.buildProjectInfo(list);
ServiceUtils.buildCustomNumInfo(list);
QueryMemberRequest queryMemberRequest = new QueryMemberRequest();
queryMemberRequest.setProjectId(request.getProjectId());
Map<String, String> userMap = userService.getProjectMemberList(queryMemberRequest)
.stream().collect(Collectors.toMap(User::getId, User::getName));
list.forEach(item -> {
item.setExecutorName(userMap.get(item.getExecutor()));
item.setMaintainerName(userMap.get(item.getMaintainer()));
});
}
return list;
return request;
}
public QueryTestPlanCaseRequest wrapQueryTestPlanCaseRequest(QueryTestPlanCaseRequest request) {