refactor(测试计划): 去掉之前没用的代码

This commit is contained in:
WangXu10 2024-05-09 13:53:48 +08:00 committed by Craftsman
parent f4ec65d928
commit 762ffb08da
4 changed files with 5 additions and 56 deletions

View File

@ -3,7 +3,6 @@ package io.metersphere.plan.controller;
import io.metersphere.plan.constants.TestPlanResourceConfig; import io.metersphere.plan.constants.TestPlanResourceConfig;
import io.metersphere.plan.domain.TestPlan; import io.metersphere.plan.domain.TestPlan;
import io.metersphere.plan.dto.request.*; import io.metersphere.plan.dto.request.*;
import io.metersphere.plan.dto.response.TestPlanCountResponse;
import io.metersphere.plan.dto.response.TestPlanDetailResponse; import io.metersphere.plan.dto.response.TestPlanDetailResponse;
import io.metersphere.plan.dto.response.TestPlanResponse; import io.metersphere.plan.dto.response.TestPlanResponse;
import io.metersphere.plan.service.TestPlanLogService; import io.metersphere.plan.service.TestPlanLogService;
@ -47,15 +46,6 @@ public class TestPlanController {
return testPlanManagementService.page(request); return testPlanManagementService.page(request);
} }
@GetMapping("/getCount/{id}")
@Operation(summary = "测试计划-获取统计数据")
@RequiresPermissions(PermissionConstants.TEST_PLAN_READ)
@CheckOwner(resourceId = "#id", resourceType = "test_plan")
public TestPlanCountResponse getCount(@PathVariable String id) {
testPlanManagementService.checkModuleIsOpen(id, TestPlanResourceConfig.CHECK_TYPE_TEST_PLAN, Collections.singletonList(TestPlanResourceConfig.CONFIG_TEST_PLAN));
return testPlanService.getCount(id);
}
@PostMapping("/module/count") @PostMapping("/module/count")
@Operation(summary = "测试计划-模块统计") @Operation(summary = "测试计划-模块统计")

View File

@ -1,22 +0,0 @@
package io.metersphere.plan.dto.response;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class TestPlanCountResponse {
@Schema(description = "测试计划ID")
private String id;
@Schema(description = "通过率")
private String passRate;
@Schema(description = "功能用例数")
private long functionalCaseCount = -1;
@Schema(description = "接口用例数")
private long apiCaseCount = -1;
@Schema(description = "接口场景数")
private long apiScenarioCount = -1;
@Schema(description = "Bug数量")
private long bugCount = -1;
@Schema(description = "测试进度")
private String testProgress;
}

View File

@ -3,7 +3,6 @@ package io.metersphere.plan.service;
import io.metersphere.plan.domain.*; import io.metersphere.plan.domain.*;
import io.metersphere.plan.dto.TestPlanResourceAssociationParam; import io.metersphere.plan.dto.TestPlanResourceAssociationParam;
import io.metersphere.plan.dto.request.*; import io.metersphere.plan.dto.request.*;
import io.metersphere.plan.dto.response.TestPlanCountResponse;
import io.metersphere.plan.dto.response.TestPlanDetailResponse; import io.metersphere.plan.dto.response.TestPlanDetailResponse;
import io.metersphere.plan.mapper.*; import io.metersphere.plan.mapper.*;
import io.metersphere.sdk.constants.ApplicationNumScope; import io.metersphere.sdk.constants.ApplicationNumScope;
@ -270,30 +269,18 @@ public class TestPlanService {
TestPlanFollowerExample testPlanFollowerExample = new TestPlanFollowerExample(); TestPlanFollowerExample testPlanFollowerExample = new TestPlanFollowerExample();
testPlanFollowerExample.createCriteria().andTestPlanIdIn(testPlanIds); testPlanFollowerExample.createCriteria().andTestPlanIdIn(testPlanIds);
testPlanFollowerMapper.deleteByExample(testPlanFollowerExample); testPlanFollowerMapper.deleteByExample(testPlanFollowerExample);
TestPlanAllocationExample allocationExample = new TestPlanAllocationExample();
allocationExample.createCriteria().andTestPlanIdIn(testPlanIds);
testPlanAllocationMapper.deleteByExample(allocationExample);
/* /*
todo todo
删除计划定时任务 执行相关配置 删除计划定时任务
*/ */
} }
public TestPlanCountResponse getCount(String id) {
TestPlanCountResponse response = new TestPlanCountResponse();
response.setId(id);
/*
todo 统计测试进度通过率用例数Bug数量这些比较慢的查询是否需要另开接口查询)
*/
response.setFunctionalCaseCount(0);
response.setApiCaseCount(0);
response.setApiScenarioCount(0);
response.setPassRate("3.14%");
response.setTestProgress("15.92%");
return response;
}
/** /**
* 更新测试计划 * 更新测试计划
* *

View File

@ -8,7 +8,6 @@ import io.metersphere.plan.domain.*;
import io.metersphere.plan.dto.request.*; import io.metersphere.plan.dto.request.*;
import io.metersphere.plan.dto.response.TestPlanAssociationResponse; import io.metersphere.plan.dto.response.TestPlanAssociationResponse;
import io.metersphere.plan.dto.response.TestPlanResourceSortResponse; import io.metersphere.plan.dto.response.TestPlanResourceSortResponse;
import io.metersphere.plan.dto.response.TestPlanResponse;
import io.metersphere.plan.mapper.TestPlanMapper; import io.metersphere.plan.mapper.TestPlanMapper;
import io.metersphere.plan.service.TestPlanManagementService; import io.metersphere.plan.service.TestPlanManagementService;
import io.metersphere.plan.service.TestPlanModuleService; import io.metersphere.plan.service.TestPlanModuleService;
@ -726,11 +725,6 @@ public class TestPlanTests extends BaseTest {
Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(result.getList())).size() <= testPlanTableRequest.getPageSize()); Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(result.getList())).size() <= testPlanTableRequest.getPageSize());
Assertions.assertEquals(result.getTotal(), 1010); Assertions.assertEquals(result.getTotal(), 1010);
//查询详情
List<TestPlanResponse> testPlanResponseList = JSON.parseArray(JSON.toJSONString(result.getList()), TestPlanResponse.class);
for (TestPlanResponse response : testPlanResponseList) {
this.requestGetWithOk(String.format(URL_GET_TEST_PLAN_COUNT, response.getId()));
}
//指定模块ID查询 (查询count时不会因为选择了模块而更改了总量 //指定模块ID查询 (查询count时不会因为选择了模块而更改了总量
testPlanTableRequest.setModuleIds(Arrays.asList(a1Node.getId(), a1a1Node.getId(), a1b1Node.getId())); testPlanTableRequest.setModuleIds(Arrays.asList(a1Node.getId(), a1a1Node.getId(), a1b1Node.getId()));