fix(测试计划): 修复用例模块树count问题

--bug=1044045 --user=王旭 【测试计划】计划中关联的功能用例根模块没有统计其子模块的用例 https://www.tapd.cn/55049933/s/1550394
This commit is contained in:
WangXu10 2024-07-18 14:30:35 +08:00 committed by Craftsman
parent f6a6164147
commit 0b59e73899
3 changed files with 8 additions and 9 deletions

View File

@ -372,10 +372,8 @@ public class TestPlanApiCaseService extends TestPlanResourceService {
Map<String, List<FunctionalCaseModuleCountDTO>> projectCountMap = projectModuleCountDTOList.stream().collect(Collectors.groupingBy(FunctionalCaseModuleCountDTO::getProjectId));
//projectModuleCountDTOList转新的map key 是moduleId value是数量 stream实现
Map<String, Long> projectModuleCountMap = projectModuleCountDTOList.stream()
.collect(Collectors.groupingBy(
FunctionalCaseModuleCountDTO::getModuleId,
Collectors.summingLong(FunctionalCaseModuleCountDTO::getDataCount)));
.filter(item -> StringUtils.equals(item.getModuleId(), item.getProjectId() + "_" + ModuleConstants.DEFAULT_NODE_ID))
.collect(Collectors.groupingBy(FunctionalCaseModuleCountDTO::getModuleId, Collectors.summingLong(FunctionalCaseModuleCountDTO::getDataCount)));
projectCountMap.forEach((projectId, moduleCountDTOList) -> {
List<ModuleCountDTO> moduleCountDTOS = new ArrayList<>();
for (FunctionalCaseModuleCountDTO functionalCaseModuleCountDTO : moduleCountDTOList) {

View File

@ -113,6 +113,7 @@ public class TestPlanApiScenarioService extends TestPlanResourceService {
public List<TestPlanResourceExecResultDTO> selectDistinctExecResult(String projectId) {
return extTestPlanApiScenarioMapper.selectDistinctExecResult(projectId);
}
@Override
public void deleteBatchByTestPlanId(List<String> testPlanIdList) {
TestPlanApiScenarioExample example = new TestPlanApiScenarioExample();
@ -522,10 +523,8 @@ public class TestPlanApiScenarioService extends TestPlanResourceService {
List<FunctionalCaseModuleCountDTO> projectModuleCountDTOList = extTestPlanApiScenarioMapper.countModuleIdByRequest(request, false);
Map<String, List<FunctionalCaseModuleCountDTO>> projectCountMap = projectModuleCountDTOList.stream().collect(Collectors.groupingBy(FunctionalCaseModuleCountDTO::getProjectId));
Map<String, Long> projectModuleCountMap = projectModuleCountDTOList.stream()
.collect(Collectors.groupingBy(
FunctionalCaseModuleCountDTO::getModuleId,
Collectors.summingLong(FunctionalCaseModuleCountDTO::getDataCount)));
.filter(item -> StringUtils.equals(item.getModuleId(), item.getProjectId() + "_" + ModuleConstants.DEFAULT_NODE_ID))
.collect(Collectors.groupingBy(FunctionalCaseModuleCountDTO::getModuleId, Collectors.summingLong(FunctionalCaseModuleCountDTO::getDataCount)));
projectCountMap.forEach((projectId, moduleCountDTOList) -> {
List<ModuleCountDTO> moduleCountDTOS = new ArrayList<>();
for (FunctionalCaseModuleCountDTO functionalCaseModuleCountDTO : moduleCountDTOList) {

View File

@ -418,7 +418,9 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
request.setModuleIds(null);
List<FunctionalCaseModuleCountDTO> projectModuleCountDTOList = extTestPlanFunctionalCaseMapper.countModuleIdByRequest(request, false);
Map<String, List<FunctionalCaseModuleCountDTO>> projectCountMap = projectModuleCountDTOList.stream().collect(Collectors.groupingBy(FunctionalCaseModuleCountDTO::getProjectId));
Map<String, Long> projectModuleCountMap = projectModuleCountDTOList.stream().collect(Collectors.groupingBy(FunctionalCaseModuleCountDTO::getModuleId, Collectors.summingLong(FunctionalCaseModuleCountDTO::getDataCount)));
Map<String, Long> projectModuleCountMap = projectModuleCountDTOList.stream()
.filter(item -> StringUtils.equals(item.getModuleId(), item.getProjectId() + "_" + ModuleConstants.DEFAULT_NODE_ID))
.collect(Collectors.groupingBy(FunctionalCaseModuleCountDTO::getModuleId, Collectors.summingLong(FunctionalCaseModuleCountDTO::getDataCount)));
projectCountMap.forEach((projectId, moduleCountDTOList) -> {
List<ModuleCountDTO> moduleCountDTOS = new ArrayList<>();
for (FunctionalCaseModuleCountDTO functionalCaseModuleCountDTO : moduleCountDTOList) {