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.functional.service.CaseReviewService;
|
||||||
import io.metersphere.plan.domain.*;
|
import io.metersphere.plan.domain.*;
|
||||||
import io.metersphere.plan.dto.TestPlanAndGroupInfoDTO;
|
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.TestPlanBugPageResponse;
|
||||||
import io.metersphere.plan.dto.response.TestPlanStatisticsResponse;
|
import io.metersphere.plan.dto.response.TestPlanStatisticsResponse;
|
||||||
import io.metersphere.plan.mapper.*;
|
import io.metersphere.plan.mapper.*;
|
||||||
|
@ -804,7 +805,7 @@ public class DashboardService {
|
||||||
List<TestPlanApiScenario> planApiScenarios = extTestPlanApiScenarioMapper.selectByTestPlanIdAndNotDeleted(planId);
|
List<TestPlanApiScenario> planApiScenarios = extTestPlanApiScenarioMapper.selectByTestPlanIdAndNotDeleted(planId);
|
||||||
TestPlanStatisticsResponse statisticsResponse = buildStatisticsResponse(planId, planFunctionalCases, planApiCases, planApiScenarios);
|
TestPlanStatisticsResponse statisticsResponse = buildStatisticsResponse(planId, planFunctionalCases, planApiCases, planApiScenarios);
|
||||||
// 计划-缺陷的关联数据
|
// 计划-缺陷的关联数据
|
||||||
List<TestPlanBugPageResponse> planBugs = extTestPlanBugMapper.selectBugCountByPlanId(planId);
|
List<TestPlanBugPageResponse> planBugs = extTestPlanBugMapper.selectPlanRelationBug(planId);
|
||||||
//获取卡片数据
|
//获取卡片数据
|
||||||
buildCountMap(statisticsResponse, planBugs, overViewCountDTO);
|
buildCountMap(statisticsResponse, planBugs, overViewCountDTO);
|
||||||
Map<String, List<TestPlanFunctionalCase>> caseUserMap = planFunctionalCases.stream().collect(Collectors.groupingBy(t -> StringUtils.isEmpty(t.getExecuteUser()) ? NONE : t.getExecuteUser()));
|
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<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));
|
Map<String, List<TestPlanBugPageResponse>> bugUserMap = planBugs.stream().collect(Collectors.groupingBy(TestPlanBugPageResponse::getCreateUser));
|
||||||
int totalCount = planFunctionalCases.size() + planApiCases.size() + planApiScenarios.size() + planBugs.size();
|
int totalCount = planFunctionalCases.size() + planApiCases.size() + planApiScenarios.size() + planBugs.size();
|
||||||
List<User> users = getUsers(caseUserMap, apiCaseUserMap, apiScenarioUserMap, bugUserMap, totalCount);
|
List<User> users = getUsers(caseUserMap, apiCaseUserMap, apiScenarioUserMap, totalCount);
|
||||||
List<String> nameList =users.stream().map(User::getName).toList();
|
List<String> nameList = users.stream().map(User::getName).toList();
|
||||||
overViewCountDTO.setXAxis(nameList);
|
overViewCountDTO.setXAxis(nameList);
|
||||||
//获取柱状图数据
|
//获取柱状图数据
|
||||||
List<NameArrayDTO> nameArrayDTOList = getNameArrayDTOS(projectId, users, caseUserMap, apiCaseUserMap, apiScenarioUserMap, bugUserMap);
|
List<NameArrayDTO> nameArrayDTOList = getNameArrayDTOS(projectId, users, caseUserMap, apiCaseUserMap, apiScenarioUserMap, bugUserMap);
|
||||||
|
@ -836,29 +837,47 @@ public class DashboardService {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int finishCount = 0;
|
int finishCount = 0;
|
||||||
List<TestPlanFunctionalCase> testPlanFunctionalCases = caseUserMap.get(userId);
|
List<TestPlanFunctionalCase> testPlanFunctionalCases = caseUserMap.get(userId);
|
||||||
|
List<String> currentUserCaseIds = new ArrayList<>();
|
||||||
if (CollectionUtils.isNotEmpty(testPlanFunctionalCases)) {
|
if (CollectionUtils.isNotEmpty(testPlanFunctionalCases)) {
|
||||||
|
List<String> functionalCaseIds = testPlanFunctionalCases.stream().map(TestPlanFunctionalCase::getFunctionalCaseId).toList();
|
||||||
|
currentUserCaseIds.addAll(functionalCaseIds);
|
||||||
count += testPlanFunctionalCases.size();
|
count += testPlanFunctionalCases.size();
|
||||||
List<TestPlanFunctionalCase> list = testPlanFunctionalCases.stream().filter(t -> !StringUtils.equalsIgnoreCase(t.getLastExecResult(), ExecStatus.PENDING.name())).toList();
|
List<TestPlanFunctionalCase> list = testPlanFunctionalCases.stream().filter(t -> !StringUtils.equalsIgnoreCase(t.getLastExecResult(), ExecStatus.PENDING.name())).toList();
|
||||||
finishCount += list.size();
|
finishCount += list.size();
|
||||||
}
|
}
|
||||||
List<TestPlanApiCase> testPlanApiCases = apiCaseUserMap.get(userId);
|
List<TestPlanApiCase> testPlanApiCases = apiCaseUserMap.get(userId);
|
||||||
if (CollectionUtils.isNotEmpty(testPlanApiCases)) {
|
if (CollectionUtils.isNotEmpty(testPlanApiCases)) {
|
||||||
|
List<String> apiCaseIds = testPlanApiCases.stream().map(TestPlanApiCase::getApiCaseId).toList();
|
||||||
|
currentUserCaseIds.addAll(apiCaseIds);
|
||||||
count += testPlanApiCases.size();
|
count += testPlanApiCases.size();
|
||||||
List<TestPlanApiCase> list = testPlanApiCases.stream().filter(t -> !StringUtils.equalsIgnoreCase(t.getLastExecResult(), ExecStatus.PENDING.name())).toList();
|
List<TestPlanApiCase> list = testPlanApiCases.stream().filter(t -> !StringUtils.equalsIgnoreCase(t.getLastExecResult(), ExecStatus.PENDING.name())).toList();
|
||||||
finishCount += list.size();
|
finishCount += list.size();
|
||||||
}
|
}
|
||||||
List<TestPlanApiScenario> testPlanApiScenarios = apiScenarioUserMap.get(userId);
|
List<TestPlanApiScenario> testPlanApiScenarios = apiScenarioUserMap.get(userId);
|
||||||
if (CollectionUtils.isNotEmpty(testPlanApiScenarios)) {
|
if (CollectionUtils.isNotEmpty(testPlanApiScenarios)) {
|
||||||
|
List<String> apiScenarioIds = testPlanApiScenarios.stream().map(TestPlanApiScenario::getApiScenarioId).toList();
|
||||||
|
currentUserCaseIds.addAll(apiScenarioIds);
|
||||||
count += testPlanApiScenarios.size();
|
count += testPlanApiScenarios.size();
|
||||||
List<TestPlanApiScenario> list = testPlanApiScenarios.stream().filter(t -> !StringUtils.equalsIgnoreCase(t.getLastExecResult(), ExecStatus.PENDING.name())).toList();
|
List<TestPlanApiScenario> list = testPlanApiScenarios.stream().filter(t -> !StringUtils.equalsIgnoreCase(t.getLastExecResult(), ExecStatus.PENDING.name())).toList();
|
||||||
finishCount += list.size();
|
finishCount += list.size();
|
||||||
}
|
}
|
||||||
List<TestPlanBugPageResponse> testPlanBugPageResponses = bugUserMap.get(userId);
|
List<TestPlanBugPageResponse> testPlanBugPageResponses = bugUserMap.get(userId);
|
||||||
if (CollectionUtils.isNotEmpty(testPlanBugPageResponses)) {
|
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)) {
|
if (CollectionUtils.isNotEmpty(statusList)) {
|
||||||
List<TestPlanBugPageResponse> list = testPlanBugPageResponses.stream().filter(t -> statusList.contains(t.getStatus())).toList();
|
List<String> bugIds = testPlanBugPageResponses.stream().filter(t -> statusList.contains(t.getStatus())).map(TestPlanBugPageResponse::getId).toList();
|
||||||
closeBugCount.add(list.size());
|
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 {
|
} else {
|
||||||
closeBugCount.add(testPlanBugPageResponses.size());
|
closeBugCount.add(testPlanBugPageResponses.size());
|
||||||
}
|
}
|
||||||
|
@ -890,7 +909,7 @@ public class DashboardService {
|
||||||
return nameArrayDTOList;
|
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();
|
Set<String> caseUserIds = caseUserMap.keySet();
|
||||||
boolean addDefaultUser = caseUserIds.contains(NONE);
|
boolean addDefaultUser = caseUserIds.contains(NONE);
|
||||||
Set<String> userSet = new HashSet<>(caseUserIds);
|
Set<String> userSet = new HashSet<>(caseUserIds);
|
||||||
|
@ -904,10 +923,9 @@ public class DashboardService {
|
||||||
if (apiScenarioIds.contains(NONE)) {
|
if (apiScenarioIds.contains(NONE)) {
|
||||||
addDefaultUser = true;
|
addDefaultUser = true;
|
||||||
}
|
}
|
||||||
userSet.addAll(bugUserMap.keySet());
|
|
||||||
List<User> users = new ArrayList<>();
|
List<User> users = new ArrayList<>();
|
||||||
if (CollectionUtils.isEmpty(userSet)) {
|
if (CollectionUtils.isEmpty(userSet)) {
|
||||||
if (totalCount>0) {
|
if (totalCount > 0) {
|
||||||
addDefaultUser(users);
|
addDefaultUser(users);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -14,32 +14,38 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public interface ExtTestPlanBugMapper {
|
public interface ExtTestPlanBugMapper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询计划-关联缺陷列表
|
* 查询计划-关联缺陷列表
|
||||||
* @param request 请求参数
|
*
|
||||||
* @return 缺陷列表
|
* @param request 请求参数
|
||||||
*/
|
* @return 缺陷列表
|
||||||
@BaseConditionFilter
|
*/
|
||||||
List<TestPlanBugPageResponse> list(@Param("request") TestPlanBugPageRequest request);
|
@BaseConditionFilter
|
||||||
|
List<TestPlanBugPageResponse> list(@Param("request") TestPlanBugPageRequest request);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据缺陷ID集合获取计划下缺陷关联的用例集合
|
* 根据缺陷ID集合获取计划下缺陷关联的用例集合
|
||||||
* @param bugIds 缺陷ID集合
|
*
|
||||||
* @param planId 计划ID
|
* @param bugIds 缺陷ID集合
|
||||||
* @return 用例集合
|
* @param planId 计划ID
|
||||||
*/
|
* @return 用例集合
|
||||||
List<TestPlanBugCaseDTO> getBugRelatedCase(@Param("ids") List<String> bugIds, @Param("planId") String planId);
|
*/
|
||||||
|
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> countBugByIds(@Param("planIds") List<String> planIds);
|
||||||
|
|
||||||
List<TestPlanBugPageResponse> selectBugCountByPlanId(@Param("planId") String planId);
|
List<TestPlanBugPageResponse> selectBugCountByPlanId(@Param("planId") String planId);
|
||||||
|
|
||||||
|
List<TestPlanBugPageResponse> selectPlanRelationBug(@Param("planId") String planId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用例关系ID集合获取计划下用例关联的缺陷集合
|
* 根据用例关系ID集合获取计划下用例关联的缺陷集合
|
||||||
* @param caseIds 用例ID集合
|
*
|
||||||
* @return 缺陷集合
|
* @param caseIds 用例ID集合
|
||||||
*/
|
* @return 缺陷集合
|
||||||
List<TestPlanCaseBugDTO> getCaseRelatedBug(@Param("ids") List<String> caseIds);
|
*/
|
||||||
|
List<TestPlanCaseBugDTO> getCaseRelatedBug(@Param("ids") List<String> caseIds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,17 @@
|
||||||
group by brc.bug_id
|
group by brc.bug_id
|
||||||
</select>
|
</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 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
|
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>
|
</foreach>
|
||||||
</select>
|
</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 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
|
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
|
from bug_relation_case brc
|
||||||
|
|
|
@ -97,7 +97,7 @@
|
||||||
class="loginType"
|
class="loginType"
|
||||||
@click="switchLoginType('QR_CODE')"
|
@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>
|
||||||
<div v-if="userInfo.authenticate !== 'LDAP' && isShowLDAP" class="loginType" @click="switchLoginType('LDAP')">
|
<div v-if="userInfo.authenticate !== 'LDAP' && isShowLDAP" class="loginType" @click="switchLoginType('LDAP')">
|
||||||
<span class="type-text text-[10px]">LDAP</span>
|
<span class="type-text text-[10px]">LDAP</span>
|
||||||
|
@ -126,6 +126,7 @@
|
||||||
import { useStorage } from '@vueuse/core';
|
import { useStorage } from '@vueuse/core';
|
||||||
import { Message, SelectOptionData } from '@arco-design/web-vue';
|
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 TabQrCode from '@/views/login/components/tabQrCode.vue';
|
||||||
|
|
||||||
import { getProjectInfo } from '@/api/modules/project-management/basicInfo';
|
import { getProjectInfo } from '@/api/modules/project-management/basicInfo';
|
||||||
|
|
Loading…
Reference in New Issue