refactor(工作台): 测试计划统计去掉时间限制

This commit is contained in:
guoyuqi 2024-11-18 18:15:23 +08:00 committed by Craftsman
parent b13a5ba519
commit 481336a518
5 changed files with 8 additions and 19 deletions

View File

@ -74,7 +74,7 @@ public class TestPlanController {
testPlanCoverageDTO.setErrorCode(109001); testPlanCoverageDTO.setErrorCode(109001);
return testPlanCoverageDTO; return testPlanCoverageDTO;
} }
return testPlanService.rageByProjectIdAndTimestamp(request.getProjectId(), request.getStartTime(), request.getEndTime()); return testPlanService.rageByProjectIdAndTimestamp(request.getProjectId());
} }
@GetMapping("/group-list/{projectId}") @GetMapping("/group-list/{projectId}")

View File

@ -94,5 +94,5 @@ public interface ExtTestPlanMapper {
*/ */
List<SelectOption> getPlanBugList(@Param("projectId") String projectId, @Param("type") String type, @Param("platforms") List<String> platform, @Param("statusList") List<String> statusList); List<SelectOption> getPlanBugList(@Param("projectId") String projectId, @Param("type") String type, @Param("platforms") List<String> platform, @Param("statusList") List<String> statusList);
List<TestPlan> selectIdAndStatusByProjectIdAndCreateTimeRangeAndType(@Param("projectId") String projectId, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("type") String testPlanTypePlan); List<TestPlan> selectIdAndStatusByProjectIdAndCreateTimeRangeAndType(@Param("projectId") String projectId, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("type") String testPlanTypePlan);
} }

View File

@ -872,7 +872,9 @@
SELECT id, status SELECT id, status
FROM test_plan FROM test_plan
WHERE project_id = #{projectId} WHERE project_id = #{projectId}
AND create_time BETWEEN #{startTime} AND #{endTime} <if test="startTime != null and endTime != null">
AND create_time BETWEEN #{startTime} AND #{endTime}
</if>
AND type = #{type} AND type = #{type}
</select> </select>
<select id="getPlanBugList" resultType="io.metersphere.plugin.platform.dto.SelectOption"> <select id="getPlanBugList" resultType="io.metersphere.plugin.platform.dto.SelectOption">

View File

@ -1005,11 +1005,11 @@ public class TestPlanService extends TestPlanBaseUtilsService {
} }
} }
public TestPlanCoverageDTO rageByProjectIdAndTimestamp(@NotBlank String projectId, long startTime, long endTime) { public TestPlanCoverageDTO rageByProjectIdAndTimestamp(@NotBlank String projectId) {
TestPlanCoverageDTO returnDTO = new TestPlanCoverageDTO(); TestPlanCoverageDTO returnDTO = new TestPlanCoverageDTO();
TestPlanExample testPlanExample = new TestPlanExample(); TestPlanExample testPlanExample = new TestPlanExample();
testPlanExample.createCriteria().andProjectIdEqualTo(projectId).andCreateTimeBetween(startTime, endTime).andTypeEqualTo(TestPlanConstants.TEST_PLAN_TYPE_PLAN); testPlanExample.createCriteria().andProjectIdEqualTo(projectId).andTypeEqualTo(TestPlanConstants.TEST_PLAN_TYPE_PLAN);
List<TestPlan> testPlanList = extTestPlanMapper.selectIdAndStatusByProjectIdAndCreateTimeRangeAndType(projectId, startTime, endTime, TestPlanConstants.TEST_PLAN_TYPE_PLAN); List<TestPlan> testPlanList = extTestPlanMapper.selectIdAndStatusByProjectIdAndCreateTimeRangeAndType(projectId, null, null, TestPlanConstants.TEST_PLAN_TYPE_PLAN);
List<String> notArchivedList = new ArrayList<>(); List<String> notArchivedList = new ArrayList<>();
testPlanList.forEach(item -> { testPlanList.forEach(item -> {
@ -1025,11 +1025,6 @@ public class TestPlanService extends TestPlanBaseUtilsService {
// 批量处理 // 批量处理
SubListUtils.dealForSubList(notArchivedList, SubListUtils.DEFAULT_BATCH_SIZE, dealList -> { SubListUtils.dealForSubList(notArchivedList, SubListUtils.DEFAULT_BATCH_SIZE, dealList -> {
TestPlanConfigExample testPlanConfigExample = new TestPlanConfigExample();
testPlanConfigExample.createCriteria().andTestPlanIdIn(dealList);
List<TestPlanConfig> testPlanConfigList = testPlanConfigMapper.selectByExample(testPlanConfigExample);
Map<String, TestPlanConfig> testPlanConfigMap = testPlanConfigList.stream().collect(Collectors.toMap(TestPlanConfig::getTestPlanId, v -> v));
List<TestPlanResourceExecResultDTO> execResults = new ArrayList<>(); List<TestPlanResourceExecResultDTO> execResults = new ArrayList<>();
beansOfType.forEach((k, v) -> execResults.addAll(v.selectDistinctLastExecResultByTestPlanIds(dealList))); beansOfType.forEach((k, v) -> execResults.addAll(v.selectDistinctLastExecResultByTestPlanIds(dealList)));

View File

@ -1,7 +1,5 @@
package io.metersphere.plan.controller; package io.metersphere.plan.controller;
import io.metersphere.api.domain.ApiScenario;
import io.metersphere.api.domain.ApiTestCase;
import io.metersphere.functional.domain.FunctionalCase; import io.metersphere.functional.domain.FunctionalCase;
import io.metersphere.functional.mapper.FunctionalCaseMapper; import io.metersphere.functional.mapper.FunctionalCaseMapper;
import io.metersphere.plan.constants.TestPlanResourceConfig; import io.metersphere.plan.constants.TestPlanResourceConfig;
@ -102,12 +100,6 @@ public class TestPlanTests extends BaseTest {
private static final List<CheckLogModel> LOG_CHECK_LIST = new ArrayList<>(); private static final List<CheckLogModel> LOG_CHECK_LIST = new ArrayList<>();
private static final List<FunctionalCase> FUNCTIONAL_CASES = new ArrayList<>();
private static final List<ApiTestCase> API_TEST_CASES = new ArrayList<>();
private static final List<ApiScenario> API_SCENARIOS = new ArrayList<>();
//测试计划模块的url //测试计划模块的url
private static final String URL_GET_MODULE_TREE = "/test-plan/module/tree/%s"; private static final String URL_GET_MODULE_TREE = "/test-plan/module/tree/%s";
private static final String URL_GET_MODULE_DELETE = "/test-plan/module/delete/%s"; private static final String URL_GET_MODULE_DELETE = "/test-plan/module/delete/%s";