fix(接口测试): 修复场景转测试计划不显示责任人的缺陷
--bug=1018863 --user=王孝刚 【接口测试】接口测试-接口自动化转测试计划中测试计划的进度显示不正确 https://www.tapd.cn/55049933/s/1292768
This commit is contained in:
parent
c27c6a8bce
commit
82ec04d945
|
@ -1,8 +1,8 @@
|
||||||
package io.metersphere.controller.remote;
|
package io.metersphere.controller.remote;
|
||||||
|
|
||||||
import io.metersphere.service.remote.RemoteTestPlanService;
|
|
||||||
import io.metersphere.api.dto.QueryTestPlanRequest;
|
import io.metersphere.api.dto.QueryTestPlanRequest;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
|
import io.metersphere.service.remote.RemoteTestPlanService;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@ -22,6 +22,11 @@ public class TestPlanController {
|
||||||
add("test/plan/scenario/case");
|
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("/**")
|
@GetMapping("/**")
|
||||||
public List getStageOption(HttpServletRequest request) {
|
public List getStageOption(HttpServletRequest request) {
|
||||||
excludeApi(request.getRequestURI());
|
excludeApi(request.getRequestURI());
|
||||||
|
@ -37,6 +42,7 @@ public class TestPlanController {
|
||||||
/**
|
/**
|
||||||
* 解决不同模块路径冲突,导致循环调用
|
* 解决不同模块路径冲突,导致循环调用
|
||||||
* todo 待优化
|
* todo 待优化
|
||||||
|
*
|
||||||
* @param url
|
* @param url
|
||||||
*/
|
*/
|
||||||
public void excludeApi(String url) {
|
public void excludeApi(String url) {
|
||||||
|
|
|
@ -39,4 +39,13 @@ public class RemoteTestPlanService {
|
||||||
return new ArrayList();
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,11 @@ export function getPlanStageOption() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function planPage(page, pageSize, params) {
|
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) {
|
export function getApiScenarioIdByPlanScenarioId(id) {
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
show-overflow-tooltip>
|
show-overflow-tooltip>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="userName"
|
prop="principalName"
|
||||||
:label="$t('test_track.plan.plan_principal')"
|
:label="$t('test_track.plan.plan_principal')"
|
||||||
show-overflow-tooltip>
|
show-overflow-tooltip>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -109,6 +109,8 @@
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
<ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
||||||
|
:total="total"/>
|
||||||
<ms-delete-confirm :title="$t('test_track.plan.plan_delete')" @delete="_handleDelete" ref="deleteConfirm"
|
<ms-delete-confirm :title="$t('test_track.plan.plan_delete')" @delete="_handleDelete" ref="deleteConfirm"
|
||||||
:with-tip="enableDeleteTip">
|
:with-tip="enableDeleteTip">
|
||||||
{{ $t('test_track.plan.plan_delete_tip') }}
|
{{ $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 {_filter, _sort} from "metersphere-frontend/src/utils/tableUtils";
|
||||||
import EnvPopover from "@/business/automation/scenario/EnvPopover";
|
import EnvPopover from "@/business/automation/scenario/EnvPopover";
|
||||||
import {ENV_TYPE} from "metersphere-frontend/src/utils/constants";
|
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 {getApiScenarioProjectIdByConditions, getScenarioByProjectId} from "@/api/scenario";
|
||||||
import {getOwnerProjects} from "@/api/project";
|
import {getOwnerProjects} from "@/api/project";
|
||||||
|
|
||||||
|
@ -277,7 +279,27 @@ export default {
|
||||||
this.result = planPage(this.currentPage, this.pageSize, this.condition).then(response => {
|
this.result = planPage(this.currentPage, this.pageSize, this.condition).then(response => {
|
||||||
let data = response.data;
|
let data = response.data;
|
||||||
this.total = data.itemCount;
|
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) {
|
buildPagePath(path) {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package io.metersphere.base.mapper.ext;
|
package io.metersphere.base.mapper.ext;
|
||||||
|
|
||||||
import io.metersphere.base.domain.TestPlan;
|
import io.metersphere.base.domain.TestPlan;
|
||||||
|
|
||||||
import io.metersphere.dto.ParamsDTO;
|
import io.metersphere.dto.ParamsDTO;
|
||||||
import io.metersphere.dto.TestPlanDTOWithMetric;
|
import io.metersphere.dto.TestPlanDTOWithMetric;
|
||||||
import io.metersphere.plan.dto.TestPlanDTO;
|
import io.metersphere.plan.dto.TestPlanDTO;
|
||||||
|
@ -39,17 +38,19 @@ public interface ExtTestPlanMapper {
|
||||||
int updateActualEndTimeIsNullById(String testPlanID);
|
int updateActualEndTimeIsNullById(String testPlanID);
|
||||||
|
|
||||||
@MapKey("id")
|
@MapKey("id")
|
||||||
Map<String, ParamsDTO> testPlanTestCaseCount(@Param("planIds")Set<String> planIds);
|
Map<String, ParamsDTO> testPlanTestCaseCount(@Param("planIds") Set<String> planIds);
|
||||||
|
|
||||||
@MapKey("id")
|
@MapKey("id")
|
||||||
Map<String, ParamsDTO> testPlanApiCaseCount(@Param("planIds")Set<String> planIds);
|
Map<String, ParamsDTO> testPlanApiCaseCount(@Param("planIds") Set<String> planIds);
|
||||||
|
|
||||||
@MapKey("id")
|
@MapKey("id")
|
||||||
Map<String, ParamsDTO> testPlanApiScenarioCount(@Param("planIds")Set<String> planIds);
|
Map<String, ParamsDTO> testPlanApiScenarioCount(@Param("planIds") Set<String> planIds);
|
||||||
|
|
||||||
@MapKey("id")
|
@MapKey("id")
|
||||||
Map<String, ParamsDTO> testPlanLoadCaseCount(@Param("planIds")Set<String> planIds);
|
Map<String, ParamsDTO> testPlanLoadCaseCount(@Param("planIds") Set<String> planIds);
|
||||||
|
|
||||||
@MapKey("id")
|
@MapKey("id")
|
||||||
Map<String, ParamsDTO> testPlanUiScenarioCount(@Param("planIds")Set<String> planIds);
|
Map<String, ParamsDTO> testPlanUiScenarioCount(@Param("planIds") Set<String> planIds);
|
||||||
|
|
||||||
|
List<TestPlanDTO> planListAll(@Param("request") QueryTestPlanRequest params);
|
||||||
}
|
}
|
||||||
|
|
|
@ -406,6 +406,17 @@
|
||||||
</where>
|
</where>
|
||||||
GROUP BY t.test_plan_id
|
GROUP BY t.test_plan_id
|
||||||
</select>
|
</select>
|
||||||
|
<select id="planListAll" resultType="io.metersphere.plan.dto.TestPlanDTO">
|
||||||
|
select DISTINCT test_plan.*, project.name as projectName,
|
||||||
|
(select name from user where user.id = test_plan.creator) as userName
|
||||||
|
from test_plan
|
||||||
|
JOIN project on project.id = test_plan.project_id
|
||||||
|
<where>
|
||||||
|
<if test="request.projectId != null">
|
||||||
|
AND test_plan.project_id = #{request.projectId}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
<update id="updateActualEndTimeIsNullById">
|
<update id="updateActualEndTimeIsNullById">
|
||||||
update test_plan
|
update test_plan
|
||||||
set actual_end_time = null
|
set actual_end_time = null
|
||||||
|
|
|
@ -88,6 +88,13 @@ public class TestPlanController {
|
||||||
return testPlanService.listTestAllPlan(request);
|
return testPlanService.listTestAllPlan(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/list/all/{goPage}/{pageSize}")
|
||||||
|
@RequiresPermissions("PROJECT_TRACK_PLAN:READ")
|
||||||
|
public Pager<List<TestPlanDTO>> planListAll(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestPlanRequest request) {
|
||||||
|
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||||
|
return PageUtils.setPageInfo(page, testPlanService.planListAll(request));
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/get/stage/option/{projectId}")
|
@GetMapping("/get/stage/option/{projectId}")
|
||||||
public List getStageOption(@PathVariable("projectId") String projectId) {
|
public List getStageOption(@PathVariable("projectId") String projectId) {
|
||||||
return testPlanService.getStageOption(projectId);
|
return testPlanService.getStageOption(projectId);
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
package io.metersphere.plan.service;
|
package io.metersphere.plan.service;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import io.metersphere.base.domain.*;
|
|
||||||
import io.metersphere.base.mapper.*;
|
import io.metersphere.base.mapper.*;
|
||||||
import io.metersphere.base.mapper.ext.ExtTestCaseMapper;
|
import io.metersphere.base.mapper.ext.ExtTestCaseMapper;
|
||||||
import io.metersphere.base.mapper.ext.ExtTestPlanMapper;
|
import io.metersphere.base.mapper.ext.ExtTestPlanMapper;
|
||||||
import io.metersphere.base.mapper.ext.ExtTestPlanReportMapper;
|
import io.metersphere.base.mapper.ext.ExtTestPlanReportMapper;
|
||||||
import io.metersphere.base.mapper.ext.ExtTestPlanTestCaseMapper;
|
import io.metersphere.base.mapper.ext.ExtTestPlanTestCaseMapper;
|
||||||
import io.metersphere.commons.constants.*;
|
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
import io.metersphere.commons.utils.*;
|
|
||||||
import io.metersphere.constants.RunModeConstants;
|
import io.metersphere.constants.RunModeConstants;
|
||||||
import io.metersphere.dto.*;
|
import io.metersphere.dto.*;
|
||||||
import io.metersphere.excel.constants.TestPlanTestCaseStatus;
|
import io.metersphere.excel.constants.TestPlanTestCaseStatus;
|
||||||
|
@ -41,7 +38,7 @@ import io.metersphere.plan.service.remote.ui.PlanTestPlanUiScenarioCaseService;
|
||||||
import io.metersphere.plan.service.remote.ui.PlanUiAutomationService;
|
import io.metersphere.plan.service.remote.ui.PlanUiAutomationService;
|
||||||
import io.metersphere.plan.utils.TestPlanRequestUtil;
|
import io.metersphere.plan.utils.TestPlanRequestUtil;
|
||||||
import io.metersphere.request.ScheduleRequest;
|
import io.metersphere.request.ScheduleRequest;
|
||||||
import io.metersphere.service.*;
|
import io.metersphere.service.IssuesService;
|
||||||
import io.metersphere.utils.DiscoveryUtil;
|
import io.metersphere.utils.DiscoveryUtil;
|
||||||
import io.metersphere.utils.LoggerUtil;
|
import io.metersphere.utils.LoggerUtil;
|
||||||
import io.metersphere.xpack.track.dto.IssuesDao;
|
import io.metersphere.xpack.track.dto.IssuesDao;
|
||||||
|
@ -52,7 +49,6 @@ import org.apache.ibatis.session.ExecutorType;
|
||||||
import org.apache.ibatis.session.SqlSession;
|
import org.apache.ibatis.session.SqlSession;
|
||||||
import org.apache.ibatis.session.SqlSessionFactory;
|
import org.apache.ibatis.session.SqlSessionFactory;
|
||||||
import org.mybatis.spring.SqlSessionUtils;
|
import org.mybatis.spring.SqlSessionUtils;
|
||||||
import org.quartz.*;
|
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.kafka.core.KafkaTemplate;
|
import org.springframework.kafka.core.KafkaTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -1772,6 +1768,13 @@ public class TestPlanService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<TestPlanDTO> planListAll(QueryTestPlanRequest request) {
|
||||||
|
if (StringUtils.isNotBlank(request.getProjectId())) {
|
||||||
|
request.setProjectId(request.getProjectId());
|
||||||
|
}
|
||||||
|
List<TestPlanDTO> testPlanDTOS = extTestPlanMapper.planListAll(request);
|
||||||
|
return testPlanDTOS;
|
||||||
|
}
|
||||||
|
|
||||||
private List<TestPlanExecutionQueue> getTestPlanExecutionQueues(TestPlanRunRequest request, Map<String, String> executeQueue) {
|
private List<TestPlanExecutionQueue> getTestPlanExecutionQueues(TestPlanRunRequest request, Map<String, String> executeQueue) {
|
||||||
List<TestPlanExecutionQueue> planExecutionQueues = new ArrayList<>();
|
List<TestPlanExecutionQueue> planExecutionQueues = new ArrayList<>();
|
||||||
|
|
Loading…
Reference in New Issue