Skip to content

Commit

Permalink
refactor(测试计划): 去掉之前没用的代码
Browse files Browse the repository at this point in the history
  • Loading branch information
WangXu10 authored and fit2-zhao committed May 9, 2024
1 parent f4ec65d commit 762ffb0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import io.metersphere.plan.constants.TestPlanResourceConfig;
import io.metersphere.plan.domain.TestPlan;
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.TestPlanResponse;
import io.metersphere.plan.service.TestPlanLogService;
Expand Down Expand Up @@ -47,15 +46,6 @@ public Pager<List<TestPlanResponse>> page(@Validated @RequestBody TestPlanTableR
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")
@Operation(summary = "测试计划-模块统计")
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import io.metersphere.plan.domain.*;
import io.metersphere.plan.dto.TestPlanResourceAssociationParam;
import io.metersphere.plan.dto.request.*;
import io.metersphere.plan.dto.response.TestPlanCountResponse;
import io.metersphere.plan.dto.response.TestPlanDetailResponse;
import io.metersphere.plan.mapper.*;
import io.metersphere.sdk.constants.ApplicationNumScope;
Expand Down Expand Up @@ -270,27 +269,15 @@ private void cascadeDeleteTestPlanIds(List<String> testPlanIds) {
TestPlanFollowerExample testPlanFollowerExample = new TestPlanFollowerExample();
testPlanFollowerExample.createCriteria().andTestPlanIdIn(testPlanIds);
testPlanFollowerMapper.deleteByExample(testPlanFollowerExample);
/*
todo
删除计划定时任务 执行相关配置
*/

}


public TestPlanCountResponse getCount(String id) {
TestPlanCountResponse response = new TestPlanCountResponse();
response.setId(id);
TestPlanAllocationExample allocationExample = new TestPlanAllocationExample();
allocationExample.createCriteria().andTestPlanIdIn(testPlanIds);
testPlanAllocationMapper.deleteByExample(allocationExample);
/*
todo 统计:测试进度、通过率、用例数、Bug数量(这些比较慢的查询,是否需要另开接口查询)
todo
删除计划定时任务
*/

response.setFunctionalCaseCount(0);
response.setApiCaseCount(0);
response.setApiScenarioCount(0);
response.setPassRate("3.14%");
response.setTestProgress("15.92%");
return response;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import io.metersphere.plan.dto.request.*;
import io.metersphere.plan.dto.response.TestPlanAssociationResponse;
import io.metersphere.plan.dto.response.TestPlanResourceSortResponse;
import io.metersphere.plan.dto.response.TestPlanResponse;
import io.metersphere.plan.mapper.TestPlanMapper;
import io.metersphere.plan.service.TestPlanManagementService;
import io.metersphere.plan.service.TestPlanModuleService;
Expand Down Expand Up @@ -726,11 +725,6 @@ public void testPlanPageCountTest() throws Exception {
Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(result.getList())).size() <= testPlanTableRequest.getPageSize());
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时,不会因为选择了模块而更改了总量
testPlanTableRequest.setModuleIds(Arrays.asList(a1Node.getId(), a1a1Node.getId(), a1b1Node.getId()));
Expand Down

0 comments on commit 762ffb0

Please sign in to comment.