refactor(工作台): 测试计划调整增加名称和状态
This commit is contained in:
parent
aee08fd888
commit
caf3b8c716
|
@ -15,7 +15,7 @@ import java.util.Map;
|
|||
public class OverViewCountDTO {
|
||||
|
||||
@Schema(description = "用例模块数量")
|
||||
private Map<String, Integer> caseCountMap;
|
||||
private Map<String, Object> caseCountMap;
|
||||
|
||||
@Schema(description = "横坐标数量")
|
||||
private List<String> xAxis;
|
||||
|
|
|
@ -185,7 +185,7 @@ public class DashboardService {
|
|||
@Nullable
|
||||
private static OverViewCountDTO getNoProjectData(DashboardFrontPageRequest request) {
|
||||
if (!request.isSelectAll() && CollectionUtils.isEmpty(request.getProjectIds())) {
|
||||
Map<String, Integer> map = new HashMap<>();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put(FUNCTIONAL, 0);
|
||||
map.put(CASE_REVIEW, 0);
|
||||
map.put(API, 0);
|
||||
|
@ -201,7 +201,7 @@ public class DashboardService {
|
|||
@NotNull
|
||||
private OverViewCountDTO getModuleCountMap(Map<String, Set<String>> permissionModuleProjectIdMap, List<Project> projects, Long toStartTime, Long toEndTime, String userId) {
|
||||
Map<String, String> projectNameMap = projects.stream().collect(Collectors.toMap(Project::getId, Project::getName));
|
||||
Map<String, Integer> map = new HashMap<>();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
Map<String, Integer> projectCaseCountMap;
|
||||
Map<String, Integer> projectReviewCountMap;
|
||||
Map<String, Integer> projectApiCountMap;
|
||||
|
@ -786,8 +786,13 @@ public class DashboardService {
|
|||
List<TestPlanBugPageResponse> testPlanBugPageResponses = bugUserMap.get(userId);
|
||||
if (CollectionUtils.isNotEmpty(testPlanBugPageResponses)) {
|
||||
createBugCount.add(testPlanBugPageResponses.size());
|
||||
List<TestPlanBugPageResponse> list = testPlanBugPageResponses.stream().filter(t -> statusList.contains(t.getStatus())).toList();
|
||||
closeBugCount.add(list.size());
|
||||
if (CollectionUtils.isNotEmpty(statusList)) {
|
||||
List<TestPlanBugPageResponse> list = testPlanBugPageResponses.stream().filter(t -> statusList.contains(t.getStatus())).toList();
|
||||
closeBugCount.add(list.size());
|
||||
} else {
|
||||
closeBugCount.add(testPlanBugPageResponses.size());
|
||||
}
|
||||
|
||||
}
|
||||
totalCaseCount.add(count);
|
||||
finishCaseCount.add(finishCount);
|
||||
|
@ -822,12 +827,11 @@ public class DashboardService {
|
|||
userExample.createCriteria().andIdIn(new ArrayList<>(userSet));
|
||||
userExample.createCriteria().andEnableEqualTo(true);
|
||||
userExample.createCriteria().andDeletedEqualTo(false);
|
||||
List<User> users = userMapper.selectByExample(userExample);
|
||||
return users;
|
||||
return userMapper.selectByExample(userExample);
|
||||
}
|
||||
|
||||
private static void buildCountMap(TestPlanStatisticsResponse planCount, List<TestPlanBugPageResponse> planBugs, OverViewCountDTO overViewCountDTO) {
|
||||
Map<String, Integer> caseCountMap = new HashMap<>();
|
||||
private void buildCountMap(TestPlanStatisticsResponse planCount, List<TestPlanBugPageResponse> planBugs, OverViewCountDTO overViewCountDTO) {
|
||||
Map<String, Object> caseCountMap = new HashMap<>();
|
||||
caseCountMap.put(FUNCTIONAL, (int) planCount.getFunctionalCaseCount());
|
||||
caseCountMap.put(API_CASE, (int) planCount.getApiCaseCount());
|
||||
caseCountMap.put(API_SCENARIO, (int) planCount.getApiScenarioCount());
|
||||
|
@ -838,6 +842,9 @@ public class DashboardService {
|
|||
int executeRateValue = executeRate == null ? 0 : executeRate.intValue();
|
||||
caseCountMap.put("executeRate", executeRateValue);
|
||||
caseCountMap.put(BUG_COUNT, planBugs.size());
|
||||
List<TestPlan> testPlans = extTestPlanMapper.selectBaseInfoByIds(List.of(planCount.getId()));
|
||||
caseCountMap.put("testPlanName", testPlans.getFirst().getName());
|
||||
caseCountMap.put("status", planCount.getStatus());
|
||||
overViewCountDTO.setCaseCountMap(caseCountMap);
|
||||
}
|
||||
|
||||
|
|
|
@ -130,13 +130,13 @@ INSERT INTO test_plan(id, num, project_id, group_id, module_id, name, status, ty
|
|||
UNIX_TIMESTAMP() * 1000,'admin',UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, null);
|
||||
|
||||
INSERT INTO test_plan_functional_case(id, test_plan_id, functional_case_id, create_time, create_user, execute_user, last_exec_time, last_exec_result, pos, test_plan_collection_id)
|
||||
VALUES ('test_plan_functional_case_dashboard_id', 'dashboard_group-plan', 'dashboard_TEST_FUNCTIONAL_CASE_ID_g', 1669174143999, 'admin', 'admin', 1669174143999, 'SUCCESS', 5000, '123');
|
||||
VALUES ('test_plan_functional_case_dashboard_id', 'dashboard_test-plan-id', 'dashboard_TEST_FUNCTIONAL_CASE_ID_g', 1669174143999, 'admin', 'admin', 1669174143999, 'SUCCESS', 5000, '123');
|
||||
|
||||
INSERT INTO test_plan_api_case(`id`, `test_plan_id`, `api_case_id`, `environment_id`, `last_exec_result`, `last_exec_report_id`, `execute_user`, `create_time`, `create_user`, `pos`, `test_plan_collection_id`) VALUES
|
||||
('dashboard_plan_api_case_1', 'dashboard_group-plan', 'dashboard_ac_4', '1', 'PASSED', NULL, 'admin', 1716370415311, 'admin', 1, '123');
|
||||
('dashboard_plan_api_case_1', 'dashboard_test-plan-id', 'dashboard_ac_4', '1', 'PASSED', NULL, 'admin', 1716370415311, 'admin', 1, '123');
|
||||
|
||||
INSERT INTO test_plan_api_scenario (id, test_plan_id, api_scenario_id, environment_id, execute_user, last_exec_result, last_exec_report_id, create_time, create_user, pos, test_plan_collection_id, grouped) VALUES
|
||||
('dashboard_plan_api_scenario_1', 'dashboard_group-plan', 'dashboard_scenario_four', '1', 'admin', 'PASSED', NULL, 1716370415311, 'admin', 1, '123', false);
|
||||
('dashboard_plan_api_scenario_1', 'dashboard_test-plan-id', 'dashboard_scenario_four', '1', 'admin', 'PASSED', NULL, 1716370415311, 'admin', 1, '123', false);
|
||||
|
||||
|
||||
INSERT INTO project_application (project_id, type, type_value) VALUES
|
||||
|
|
|
@ -92,7 +92,8 @@ public class TestPlanStatisticsResponse {
|
|||
}
|
||||
|
||||
public void calculateTestPlanIsPass() {
|
||||
this.isPass = this.passRate >= this.passThreshold;
|
||||
double passThresholdValue = this.passThreshold == null ? 0d : this.passThreshold;
|
||||
this.isPass = this.passRate >= passThresholdValue;
|
||||
}
|
||||
|
||||
public void calculatePassRate() {
|
||||
|
|
|
@ -832,7 +832,7 @@
|
|||
</select>
|
||||
|
||||
<select id="getPlanApiCaseByIds" resultType="io.metersphere.plan.domain.TestPlanApiCase">
|
||||
select tpac.test_plan_id testPlanId, tpac.api_case_id apiCaseId, tpac.last_exec_result lastExecResult
|
||||
select tpac.test_plan_id testPlanId, tpac.api_case_id apiCaseId, tpac.last_exec_result lastExecResult, tpac.execute_user executeUser
|
||||
from test_plan_api_case tpac join api_test_case atc on atc.id = tpac.api_case_id
|
||||
<where>
|
||||
atc.deleted = false
|
||||
|
|
|
@ -513,7 +513,7 @@
|
|||
</select>
|
||||
|
||||
<select id="getPlanApiScenarioByIds" resultType="io.metersphere.plan.domain.TestPlanApiScenario">
|
||||
select tpas.test_plan_id testPlanId, tpas.api_scenario_id apiScenarioId, tpas.last_exec_result lastExecResult
|
||||
select tpas.test_plan_id testPlanId, tpas.api_scenario_id apiScenarioId, tpas.last_exec_result lastExecResult, tpas.execute_user executeUser
|
||||
from test_plan_api_scenario tpas join api_scenario asce on asce.id = tpas.api_scenario_id
|
||||
<where>
|
||||
asce.deleted = false
|
||||
|
|
|
@ -606,8 +606,7 @@
|
|||
</select>
|
||||
|
||||
<select id="getPlanFunctionalCaseByIds" resultType="io.metersphere.plan.domain.TestPlanFunctionalCase">
|
||||
select tpfc.test_plan_id testPlanId, tpfc.functional_case_id functionalCaseId, tpfc.last_exec_result
|
||||
lastExecResult
|
||||
select tpfc.test_plan_id testPlanId, tpfc.functional_case_id functionalCaseId, tpfc.last_exec_result lastExecResult, tpfc.execute_user executeUser
|
||||
from test_plan_functional_case tpfc join functional_case fc on fc.id = tpfc.functional_case_id
|
||||
<where>
|
||||
fc.deleted = false
|
||||
|
|
Loading…
Reference in New Issue