From 82ec04d945a5102673403602783e559923e4479a Mon Sep 17 00:00:00 2001
From: wxg0103 <727495428@qq.com>
Date: Tue, 8 Nov 2022 19:08:45 +0800
Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?=
=?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=BA=E6=99=AF=E8=BD=AC=E6=B5=8B=E8=AF=95?=
=?UTF-8?q?=E8=AE=A1=E5=88=92=E4=B8=8D=E6=98=BE=E7=A4=BA=E8=B4=A3=E4=BB=BB?=
=?UTF-8?q?=E4=BA=BA=E7=9A=84=E7=BC=BA=E9=99=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
--bug=1018863 --user=王孝刚 【接口测试】接口测试-接口自动化转测试计划中测试计划的进度显示不正确
https://www.tapd.cn/55049933/s/1292768
---
.../controller/remote/TestPlanController.java | 8 +++++-
.../service/remote/RemoteTestPlanService.java | 9 ++++++
api-test/frontend/src/api/test-plan.js | 6 +++-
.../scenario/testplan/TestPlanList.vue | 28 +++++++++++++++++--
.../base/mapper/ext/ExtTestPlanMapper.java | 13 +++++----
.../base/mapper/ext/ExtTestPlanMapper.xml | 11 ++++++++
.../controller/TestPlanController.java | 7 +++++
.../plan/service/TestPlanService.java | 13 +++++----
8 files changed, 79 insertions(+), 16 deletions(-)
diff --git a/api-test/backend/src/main/java/io/metersphere/controller/remote/TestPlanController.java b/api-test/backend/src/main/java/io/metersphere/controller/remote/TestPlanController.java
index 8b6f04f508..ce1a7e3073 100644
--- a/api-test/backend/src/main/java/io/metersphere/controller/remote/TestPlanController.java
+++ b/api-test/backend/src/main/java/io/metersphere/controller/remote/TestPlanController.java
@@ -1,8 +1,8 @@
package io.metersphere.controller.remote;
-import io.metersphere.service.remote.RemoteTestPlanService;
import io.metersphere.api.dto.QueryTestPlanRequest;
import io.metersphere.commons.exception.MSException;
+import io.metersphere.service.remote.RemoteTestPlanService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;
@@ -22,6 +22,11 @@ public class TestPlanController {
add("test/plan/scenario/case");
}};
+ @PostMapping("/list/all/{goPage}/{pageSize}")
+ public Object planListAll(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestPlanRequest request) {
+ return remoteTestPlanService.planListAll("/test/plan", goPage, pageSize, request);
+ }
+
@GetMapping("/**")
public List getStageOption(HttpServletRequest request) {
excludeApi(request.getRequestURI());
@@ -37,6 +42,7 @@ public class TestPlanController {
/**
* 解决不同模块路径冲突,导致循环调用
* todo 待优化
+ *
* @param url
*/
public void excludeApi(String url) {
diff --git a/api-test/backend/src/main/java/io/metersphere/service/remote/RemoteTestPlanService.java b/api-test/backend/src/main/java/io/metersphere/service/remote/RemoteTestPlanService.java
index 189451e0e4..73e366d639 100644
--- a/api-test/backend/src/main/java/io/metersphere/service/remote/RemoteTestPlanService.java
+++ b/api-test/backend/src/main/java/io/metersphere/service/remote/RemoteTestPlanService.java
@@ -39,4 +39,13 @@ public class RemoteTestPlanService {
return new ArrayList();
}
}
+
+ public Object planListAll(String url, int goPage, int pageSize, QueryTestPlanRequest request) {
+ try {
+ return microService.postForData(MicroServiceName.TEST_TRACK, url + String.format("/list/all/%s/%s", goPage, pageSize), request);
+ } catch (Exception e) {
+ LogUtil.info("测试计划服务调用失败", e);
+ return new ArrayList();
+ }
+ }
}
diff --git a/api-test/frontend/src/api/test-plan.js b/api-test/frontend/src/api/test-plan.js
index 3941a5028f..ab29fdf8ff 100644
--- a/api-test/frontend/src/api/test-plan.js
+++ b/api-test/frontend/src/api/test-plan.js
@@ -7,7 +7,11 @@ export function getPlanStageOption() {
}
export function planPage(page, pageSize, params) {
- return post('/test/plan/list/all/', params);
+ return post('/test/plan/list/all/'+ page + '/' + pageSize, params);
+}
+
+export function testPlanGetPrincipal(id) {
+ return get('/test/plan/' + `principal/${id}`);
}
export function getApiScenarioIdByPlanScenarioId(id) {
diff --git a/api-test/frontend/src/business/automation/scenario/testplan/TestPlanList.vue b/api-test/frontend/src/business/automation/scenario/testplan/TestPlanList.vue
index 2b6285e397..0644d2d551 100644
--- a/api-test/frontend/src/business/automation/scenario/testplan/TestPlanList.vue
+++ b/api-test/frontend/src/business/automation/scenario/testplan/TestPlanList.vue
@@ -34,7 +34,7 @@
show-overflow-tooltip>
@@ -109,6 +109,8 @@
+
{{ $t('test_track.plan.plan_delete_tip') }}
@@ -135,7 +137,7 @@ import {getCurrentProjectID} from "metersphere-frontend/src/utils/token";
import {_filter, _sort} from "metersphere-frontend/src/utils/tableUtils";
import EnvPopover from "@/business/automation/scenario/EnvPopover";
import {ENV_TYPE} from "metersphere-frontend/src/utils/constants";
-import {getPlanStageOption, planPage} from "@/api/test-plan";
+import {getPlanStageOption, planPage, testPlanGetPrincipal} from "@/api/test-plan";
import {getApiScenarioProjectIdByConditions, getScenarioByProjectId} from "@/api/scenario";
import {getOwnerProjects} from "@/api/project";
@@ -277,7 +279,27 @@ export default {
this.result = planPage(this.currentPage, this.pageSize, this.condition).then(response => {
let data = response.data;
this.total = data.itemCount;
- this.tableData = data;
+ data.listObject.forEach(item => {
+ testPlanGetPrincipal(item.id)
+ .then(res => {
+ let data = res.data;
+ let principal = "";
+ let principalIds = data.map(d => d.id);
+ if (data) {
+ data.forEach(d => {
+ if (principal !== "") {
+ principal = principal + "、" + d.name;
+ } else {
+ principal = principal + d.name;
+ }
+ })
+ }
+ this.$set(item, "principalName", principal);
+ // 编辑时初始化id
+ this.$set(item, "principals", principalIds);
+ });
+ });
+ this.tableData = data.listObject;
});
},
buildPagePath(path) {
diff --git a/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanMapper.java b/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanMapper.java
index f32fde8931..7eaee9338d 100644
--- a/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanMapper.java
+++ b/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanMapper.java
@@ -1,7 +1,6 @@
package io.metersphere.base.mapper.ext;
import io.metersphere.base.domain.TestPlan;
-
import io.metersphere.dto.ParamsDTO;
import io.metersphere.dto.TestPlanDTOWithMetric;
import io.metersphere.plan.dto.TestPlanDTO;
@@ -39,17 +38,19 @@ public interface ExtTestPlanMapper {
int updateActualEndTimeIsNullById(String testPlanID);
@MapKey("id")
- Map testPlanTestCaseCount(@Param("planIds")Set planIds);
+ Map testPlanTestCaseCount(@Param("planIds") Set planIds);
@MapKey("id")
- Map testPlanApiCaseCount(@Param("planIds")Set planIds);
+ Map testPlanApiCaseCount(@Param("planIds") Set planIds);
@MapKey("id")
- Map testPlanApiScenarioCount(@Param("planIds")Set planIds);
+ Map testPlanApiScenarioCount(@Param("planIds") Set planIds);
@MapKey("id")
- Map testPlanLoadCaseCount(@Param("planIds")Set planIds);
+ Map testPlanLoadCaseCount(@Param("planIds") Set planIds);
@MapKey("id")
- Map testPlanUiScenarioCount(@Param("planIds")Set planIds);
+ Map testPlanUiScenarioCount(@Param("planIds") Set planIds);
+
+ List planListAll(@Param("request") QueryTestPlanRequest params);
}
diff --git a/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanMapper.xml b/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanMapper.xml
index 10f474bf3c..be6eb8fe26 100644
--- a/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanMapper.xml
+++ b/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanMapper.xml
@@ -406,6 +406,17 @@
GROUP BY t.test_plan_id
+
update test_plan
set actual_end_time = null
diff --git a/test-track/backend/src/main/java/io/metersphere/controller/TestPlanController.java b/test-track/backend/src/main/java/io/metersphere/controller/TestPlanController.java
index 467e6c91c7..32484bcde1 100644
--- a/test-track/backend/src/main/java/io/metersphere/controller/TestPlanController.java
+++ b/test-track/backend/src/main/java/io/metersphere/controller/TestPlanController.java
@@ -88,6 +88,13 @@ public class TestPlanController {
return testPlanService.listTestAllPlan(request);
}
+ @PostMapping("/list/all/{goPage}/{pageSize}")
+ @RequiresPermissions("PROJECT_TRACK_PLAN:READ")
+ public Pager> planListAll(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestPlanRequest request) {
+ Page