fix(接口测试): 修复场景转测试计划不显示责任人的缺陷
--bug=1018863 --user=王孝刚 【接口测试】接口测试-接口自动化转测试计划中测试计划的进度显示不正确 https://www.tapd.cn/55049933/s/1292768
This commit is contained in:
parent
722de82676
commit
a7e91ddb00
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="userName"
|
||||
prop="principalName"
|
||||
:label="$t('test_track.plan.plan_principal')"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
|
@ -109,6 +109,8 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
</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"
|
||||
:with-tip="enableDeleteTip">
|
||||
{{ $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) {
|
||||
|
|
|
@ -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;
|
||||
|
@ -52,4 +51,6 @@ public interface ExtTestPlanMapper {
|
|||
|
||||
@MapKey("id")
|
||||
Map<String, ParamsDTO> testPlanUiScenarioCount(@Param("planIds") Set<String> planIds);
|
||||
|
||||
List<TestPlanDTO> planListAll(@Param("request") QueryTestPlanRequest params);
|
||||
}
|
||||
|
|
|
@ -406,6 +406,17 @@
|
|||
</where>
|
||||
GROUP BY t.test_plan_id
|
||||
</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 test_plan
|
||||
set actual_end_time = null
|
||||
|
|
|
@ -88,6 +88,13 @@ public class TestPlanController {
|
|||
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}")
|
||||
public List getStageOption(@PathVariable("projectId") String projectId) {
|
||||
return testPlanService.getStageOption(projectId);
|
||||
|
|
|
@ -641,6 +641,14 @@ public class TestPlanService {
|
|||
return testPlanMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
public List<TestPlanDTO> planListAll(QueryTestPlanRequest request) {
|
||||
if (StringUtils.isNotBlank(request.getProjectId())) {
|
||||
request.setProjectId(request.getProjectId());
|
||||
}
|
||||
List<TestPlanDTO> testPlanDTOS = extTestPlanMapper.planListAll(request);
|
||||
return testPlanDTOS;
|
||||
}
|
||||
|
||||
public List<TestPlanCaseDTO> listTestCaseByPlanId(String planId) {
|
||||
QueryTestPlanCaseRequest request = new QueryTestPlanCaseRequest();
|
||||
request.setPlanId(planId);
|
||||
|
|
Loading…
Reference in New Issue