refactor(工作台): 测试计划概览执行人提交缺陷显示修改
This commit is contained in:
parent
d28a7ae623
commit
881284b192
|
@ -33,6 +33,7 @@ import io.metersphere.functional.request.CaseReviewPageRequest;
|
|||
import io.metersphere.functional.service.CaseReviewService;
|
||||
import io.metersphere.plan.domain.*;
|
||||
import io.metersphere.plan.dto.TestPlanAndGroupInfoDTO;
|
||||
import io.metersphere.plan.dto.TestPlanBugCaseDTO;
|
||||
import io.metersphere.plan.dto.response.TestPlanBugPageResponse;
|
||||
import io.metersphere.plan.dto.response.TestPlanStatisticsResponse;
|
||||
import io.metersphere.plan.mapper.*;
|
||||
|
@ -804,7 +805,7 @@ public class DashboardService {
|
|||
List<TestPlanApiScenario> planApiScenarios = extTestPlanApiScenarioMapper.selectByTestPlanIdAndNotDeleted(planId);
|
||||
TestPlanStatisticsResponse statisticsResponse = buildStatisticsResponse(planId, planFunctionalCases, planApiCases, planApiScenarios);
|
||||
// 计划-缺陷的关联数据
|
||||
List<TestPlanBugPageResponse> planBugs = extTestPlanBugMapper.selectBugCountByPlanId(planId);
|
||||
List<TestPlanBugPageResponse> planBugs = extTestPlanBugMapper.selectPlanRelationBug(planId);
|
||||
//获取卡片数据
|
||||
buildCountMap(statisticsResponse, planBugs, overViewCountDTO);
|
||||
Map<String, List<TestPlanFunctionalCase>> caseUserMap = planFunctionalCases.stream().collect(Collectors.groupingBy(t -> StringUtils.isEmpty(t.getExecuteUser()) ? NONE : t.getExecuteUser()));
|
||||
|
@ -812,8 +813,8 @@ public class DashboardService {
|
|||
Map<String, List<TestPlanApiScenario>> apiScenarioUserMap = planApiScenarios.stream().collect(Collectors.groupingBy(t -> StringUtils.isEmpty(t.getExecuteUser()) ? NONE : t.getExecuteUser()));
|
||||
Map<String, List<TestPlanBugPageResponse>> bugUserMap = planBugs.stream().collect(Collectors.groupingBy(TestPlanBugPageResponse::getCreateUser));
|
||||
int totalCount = planFunctionalCases.size() + planApiCases.size() + planApiScenarios.size() + planBugs.size();
|
||||
List<User> users = getUsers(caseUserMap, apiCaseUserMap, apiScenarioUserMap, bugUserMap, totalCount);
|
||||
List<String> nameList =users.stream().map(User::getName).toList();
|
||||
List<User> users = getUsers(caseUserMap, apiCaseUserMap, apiScenarioUserMap, totalCount);
|
||||
List<String> nameList = users.stream().map(User::getName).toList();
|
||||
overViewCountDTO.setXAxis(nameList);
|
||||
//获取柱状图数据
|
||||
List<NameArrayDTO> nameArrayDTOList = getNameArrayDTOS(projectId, users, caseUserMap, apiCaseUserMap, apiScenarioUserMap, bugUserMap);
|
||||
|
@ -836,29 +837,47 @@ public class DashboardService {
|
|||
int count = 0;
|
||||
int finishCount = 0;
|
||||
List<TestPlanFunctionalCase> testPlanFunctionalCases = caseUserMap.get(userId);
|
||||
List<String> currentUserCaseIds = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(testPlanFunctionalCases)) {
|
||||
List<String> functionalCaseIds = testPlanFunctionalCases.stream().map(TestPlanFunctionalCase::getFunctionalCaseId).toList();
|
||||
currentUserCaseIds.addAll(functionalCaseIds);
|
||||
count += testPlanFunctionalCases.size();
|
||||
List<TestPlanFunctionalCase> list = testPlanFunctionalCases.stream().filter(t -> !StringUtils.equalsIgnoreCase(t.getLastExecResult(), ExecStatus.PENDING.name())).toList();
|
||||
finishCount += list.size();
|
||||
}
|
||||
List<TestPlanApiCase> testPlanApiCases = apiCaseUserMap.get(userId);
|
||||
if (CollectionUtils.isNotEmpty(testPlanApiCases)) {
|
||||
List<String> apiCaseIds = testPlanApiCases.stream().map(TestPlanApiCase::getApiCaseId).toList();
|
||||
currentUserCaseIds.addAll(apiCaseIds);
|
||||
count += testPlanApiCases.size();
|
||||
List<TestPlanApiCase> list = testPlanApiCases.stream().filter(t -> !StringUtils.equalsIgnoreCase(t.getLastExecResult(), ExecStatus.PENDING.name())).toList();
|
||||
finishCount += list.size();
|
||||
}
|
||||
List<TestPlanApiScenario> testPlanApiScenarios = apiScenarioUserMap.get(userId);
|
||||
if (CollectionUtils.isNotEmpty(testPlanApiScenarios)) {
|
||||
List<String> apiScenarioIds = testPlanApiScenarios.stream().map(TestPlanApiScenario::getApiScenarioId).toList();
|
||||
currentUserCaseIds.addAll(apiScenarioIds);
|
||||
count += testPlanApiScenarios.size();
|
||||
List<TestPlanApiScenario> list = testPlanApiScenarios.stream().filter(t -> !StringUtils.equalsIgnoreCase(t.getLastExecResult(), ExecStatus.PENDING.name())).toList();
|
||||
finishCount += list.size();
|
||||
}
|
||||
List<TestPlanBugPageResponse> testPlanBugPageResponses = bugUserMap.get(userId);
|
||||
if (CollectionUtils.isNotEmpty(testPlanBugPageResponses)) {
|
||||
createBugCount.add(testPlanBugPageResponses.size());
|
||||
List<String> createBugIds = testPlanBugPageResponses.stream().map(TestPlanBugPageResponse::getId).toList();
|
||||
if (CollectionUtils.isNotEmpty(currentUserCaseIds)) {
|
||||
List<TestPlanBugCaseDTO> bugRelatedCases = extTestPlanBugMapper.getBugRelatedCaseByCaseIds(createBugIds, currentUserCaseIds, testPlanBugPageResponses.getFirst().getTestPlanId());
|
||||
createBugCount.add(bugRelatedCases.size());
|
||||
} else {
|
||||
createBugCount.add(0);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(statusList)) {
|
||||
List<TestPlanBugPageResponse> list = testPlanBugPageResponses.stream().filter(t -> statusList.contains(t.getStatus())).toList();
|
||||
closeBugCount.add(list.size());
|
||||
List<String> bugIds = testPlanBugPageResponses.stream().filter(t -> statusList.contains(t.getStatus())).map(TestPlanBugPageResponse::getId).toList();
|
||||
if (CollectionUtils.isNotEmpty(bugIds) && CollectionUtils.isNotEmpty(currentUserCaseIds)) {
|
||||
List<TestPlanBugCaseDTO> bugRelatedCases = extTestPlanBugMapper.getBugRelatedCaseByCaseIds(bugIds, currentUserCaseIds, testPlanBugPageResponses.getFirst().getTestPlanId());
|
||||
closeBugCount.add(bugRelatedCases.size());
|
||||
} else {
|
||||
closeBugCount.add(0);
|
||||
}
|
||||
} else {
|
||||
closeBugCount.add(testPlanBugPageResponses.size());
|
||||
}
|
||||
|
@ -890,7 +909,7 @@ public class DashboardService {
|
|||
return nameArrayDTOList;
|
||||
}
|
||||
|
||||
private List<User> getUsers(Map<String, List<TestPlanFunctionalCase>> caseUserMap, Map<String, List<TestPlanApiCase>> apiCaseUserMap, Map<String, List<TestPlanApiScenario>> apiScenarioUserMap, Map<String, List<TestPlanBugPageResponse>> bugUserMap, int totalCount) {
|
||||
private List<User> getUsers(Map<String, List<TestPlanFunctionalCase>> caseUserMap, Map<String, List<TestPlanApiCase>> apiCaseUserMap, Map<String, List<TestPlanApiScenario>> apiScenarioUserMap, int totalCount) {
|
||||
Set<String> caseUserIds = caseUserMap.keySet();
|
||||
boolean addDefaultUser = caseUserIds.contains(NONE);
|
||||
Set<String> userSet = new HashSet<>(caseUserIds);
|
||||
|
@ -904,10 +923,9 @@ public class DashboardService {
|
|||
if (apiScenarioIds.contains(NONE)) {
|
||||
addDefaultUser = true;
|
||||
}
|
||||
userSet.addAll(bugUserMap.keySet());
|
||||
List<User> users = new ArrayList<>();
|
||||
if (CollectionUtils.isEmpty(userSet)) {
|
||||
if (totalCount>0) {
|
||||
if (totalCount > 0) {
|
||||
addDefaultUser(users);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -16,6 +16,7 @@ public interface ExtTestPlanBugMapper {
|
|||
|
||||
/**
|
||||
* 查询计划-关联缺陷列表
|
||||
*
|
||||
* @param request 请求参数
|
||||
* @return 缺陷列表
|
||||
*/
|
||||
|
@ -24,20 +25,25 @@ public interface ExtTestPlanBugMapper {
|
|||
|
||||
/**
|
||||
* 根据缺陷ID集合获取计划下缺陷关联的用例集合
|
||||
*
|
||||
* @param bugIds 缺陷ID集合
|
||||
* @param planId 计划ID
|
||||
* @return 用例集合
|
||||
*/
|
||||
List<TestPlanBugCaseDTO> getBugRelatedCase(@Param("ids") List<String> bugIds, @Param("planId") String planId);
|
||||
|
||||
List<TestPlanBugCaseDTO> getBugRelatedCaseByCaseIds(@Param("ids") List<String> bugIds, @Param("caseIds") List<String> caseIds, @Param("planId") String planId);
|
||||
|
||||
|
||||
List<TestPlanBugPageResponse> countBugByIds(@Param("planIds") List<String> planIds);
|
||||
|
||||
List<TestPlanBugPageResponse> selectBugCountByPlanId(@Param("planId") String planId);
|
||||
|
||||
List<TestPlanBugPageResponse> selectPlanRelationBug(@Param("planId") String planId);
|
||||
|
||||
/**
|
||||
* 根据用例关系ID集合获取计划下用例关联的缺陷集合
|
||||
*
|
||||
* @param caseIds 用例ID集合
|
||||
* @return 缺陷集合
|
||||
*/
|
||||
|
|
|
@ -50,6 +50,17 @@
|
|||
group by brc.bug_id
|
||||
</select>
|
||||
|
||||
<select id="selectPlanRelationBug" resultType="io.metersphere.plan.dto.response.TestPlanBugPageResponse">
|
||||
select b.id as id, b.num as num, b.title as title, bc.description content, b.handle_user handleUser, b.status as status, brc.create_user createUser, brc.create_time createTime,brc.test_plan_id testPlanId
|
||||
from bug_relation_case brc join bug b on brc.bug_id = b.id
|
||||
left join bug_content bc on b.id = bc.bug_id
|
||||
<where>
|
||||
b.deleted = false
|
||||
and brc.test_plan_id = #{planId}
|
||||
</where>
|
||||
group by brc.bug_id
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getBugRelatedCase" resultType="io.metersphere.plan.dto.TestPlanBugCaseDTO">
|
||||
select brc.case_id as id, fc.num as num, 'FUNCTIONAL' as type, brc.bug_id as bugId, fc.name as name, fc.project_id as projectId
|
||||
|
@ -80,6 +91,21 @@
|
|||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getBugRelatedCaseByCaseIds" resultType="io.metersphere.plan.dto.TestPlanBugCaseDTO">
|
||||
select brc.case_id as id, brc.bug_id as bugId
|
||||
from bug_relation_case brc
|
||||
where brc.test_plan_id = #{planId}
|
||||
and brc.bug_id in
|
||||
<foreach collection="ids" item="id" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
and brc.case_id in
|
||||
<foreach collection="caseIds" item="caseId" separator="," open="(" close=")">
|
||||
#{caseId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getCaseRelatedBug" resultType="io.metersphere.plan.dto.TestPlanCaseBugDTO">
|
||||
select brc.id as id, b.num as num, b.title as title, b.status as status, brc.test_plan_case_id as planCaseRefId
|
||||
from bug_relation_case brc
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
class="loginType"
|
||||
@click="switchLoginType('QR_CODE')"
|
||||
>
|
||||
<svg-icon name="scan_code" width="18px" height="18px" class="text-[rgb(var(--primary-6))]"></svg-icon>
|
||||
<MsIcon type="icon-icon_scan_outlined" class="text-[rgb(var(--primary-5))]" />
|
||||
</div>
|
||||
<div v-if="userInfo.authenticate !== 'LDAP' && isShowLDAP" class="loginType" @click="switchLoginType('LDAP')">
|
||||
<span class="type-text text-[10px]">LDAP</span>
|
||||
|
@ -126,6 +126,7 @@
|
|||
import { useStorage } from '@vueuse/core';
|
||||
import { Message, SelectOptionData } from '@arco-design/web-vue';
|
||||
|
||||
import MsIcon from '@/components/pure/ms-icon-font/index.vue';
|
||||
import TabQrCode from '@/views/login/components/tabQrCode.vue';
|
||||
|
||||
import { getProjectInfo } from '@/api/modules/project-management/basicInfo';
|
||||
|
|
Loading…
Reference in New Issue