refactor(测试计划): 接口联调部分问题
This commit is contained in:
parent
2139a1de23
commit
782eaa88fd
|
@ -12,5 +12,5 @@ public class TestPlanCopyRequest extends TestPlanCreateRequest {
|
||||||
|
|
||||||
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotBlank(message = "{test_plan.id.not_blank}")
|
@NotBlank(message = "{test_plan.id.not_blank}")
|
||||||
private String testPlanId;
|
private String id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -438,10 +438,10 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectBaseByProjectIdAndTestPlanId" resultType="io.metersphere.functional.dto.FunctionalCaseModuleDTO">
|
<select id="selectBaseByProjectIdAndTestPlanId" resultType="io.metersphere.functional.dto.FunctionalCaseModuleDTO">
|
||||||
SELECT tpm.id, tpm.project_id, p.name as projectName
|
SELECT fcm.id, fcm.project_id, p.name as projectName
|
||||||
FROM test_plan_module tpm
|
FROM functional_case_module fcm
|
||||||
LEFT JOIN project p ON tpm.project_id = p.id
|
LEFT JOIN project p ON fcm.project_id = p.id
|
||||||
WHERE tpm.id IN
|
WHERE fcm.id IN
|
||||||
(SELECT fc.module_id FROM functional_case fc LEFT JOIN test_plan_functional_case tpfc ON tpfc.functional_case_id = fc.id WHERE tpfc.test_plan_id = #{testPlanId} AND fc.deleted = false)
|
(SELECT fc.module_id FROM functional_case fc LEFT JOIN test_plan_functional_case tpfc ON tpfc.functional_case_id = fc.id WHERE tpfc.test_plan_id = #{testPlanId} AND fc.deleted = false)
|
||||||
ORDER BY pos
|
ORDER BY pos
|
||||||
</select>
|
</select>
|
||||||
|
|
|
@ -7,6 +7,7 @@ import io.metersphere.functional.dto.FunctionalCaseCustomFieldDTO;
|
||||||
import io.metersphere.functional.dto.FunctionalCaseModuleCountDTO;
|
import io.metersphere.functional.dto.FunctionalCaseModuleCountDTO;
|
||||||
import io.metersphere.functional.dto.FunctionalCaseModuleDTO;
|
import io.metersphere.functional.dto.FunctionalCaseModuleDTO;
|
||||||
import io.metersphere.functional.dto.ProjectOptionDTO;
|
import io.metersphere.functional.dto.ProjectOptionDTO;
|
||||||
|
import io.metersphere.functional.service.FunctionalCaseModuleService;
|
||||||
import io.metersphere.functional.service.FunctionalCaseService;
|
import io.metersphere.functional.service.FunctionalCaseService;
|
||||||
import io.metersphere.plan.domain.TestPlan;
|
import io.metersphere.plan.domain.TestPlan;
|
||||||
import io.metersphere.plan.domain.TestPlanFunctionalCase;
|
import io.metersphere.plan.domain.TestPlanFunctionalCase;
|
||||||
|
@ -71,7 +72,8 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
||||||
private TestPlanModuleService testPlanModuleService;
|
private TestPlanModuleService testPlanModuleService;
|
||||||
@Resource
|
@Resource
|
||||||
private ExtTestPlanModuleMapper extTestPlanModuleMapper;
|
private ExtTestPlanModuleMapper extTestPlanModuleMapper;
|
||||||
|
@Resource
|
||||||
|
private FunctionalCaseModuleService functionalCaseModuleService;
|
||||||
private static final String CASE_MODULE_COUNT_ALL = "all";
|
private static final String CASE_MODULE_COUNT_ALL = "all";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -177,7 +179,7 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
||||||
projectRootMap.forEach((projectId, projectOptionDTOList) -> {
|
projectRootMap.forEach((projectId, projectOptionDTOList) -> {
|
||||||
BaseTreeNode projectNode = new BaseTreeNode(projectId, projectOptionDTOList.get(0).getProjectName(), Project.class.getName());
|
BaseTreeNode projectNode = new BaseTreeNode(projectId, projectOptionDTOList.get(0).getProjectName(), Project.class.getName());
|
||||||
returnList.add(projectNode);
|
returnList.add(projectNode);
|
||||||
BaseTreeNode defaultNode = testPlanModuleService.getDefaultModule(Translator.get("functional_case.module.default.name"));
|
BaseTreeNode defaultNode = functionalCaseModuleService.getDefaultModule(Translator.get("functional_case.module.default.name"));
|
||||||
projectNode.addChild(defaultNode);
|
projectNode.addChild(defaultNode);
|
||||||
});
|
});
|
||||||
return returnList;
|
return returnList;
|
||||||
|
@ -186,9 +188,9 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
||||||
BaseTreeNode projectNode = new BaseTreeNode(projectId, moduleList.get(0).getProjectName(), Project.class.getName());
|
BaseTreeNode projectNode = new BaseTreeNode(projectId, moduleList.get(0).getProjectName(), Project.class.getName());
|
||||||
returnList.add(projectNode);
|
returnList.add(projectNode);
|
||||||
List<String> projectModuleIds = moduleList.stream().map(FunctionalCaseModule::getId).toList();
|
List<String> projectModuleIds = moduleList.stream().map(FunctionalCaseModule::getId).toList();
|
||||||
List<BaseTreeNode> nodeByNodeIds = testPlanModuleService.getNodeByNodeIds(projectModuleIds);
|
List<BaseTreeNode> nodeByNodeIds = functionalCaseModuleService.getNodeByNodeIds(projectModuleIds);
|
||||||
boolean haveVirtualRootNode = CollectionUtils.isEmpty(projectRootMap.get(projectId));
|
boolean haveVirtualRootNode = CollectionUtils.isEmpty(projectRootMap.get(projectId));
|
||||||
List<BaseTreeNode> baseTreeNodes = testPlanModuleService.buildTreeAndCountResource(nodeByNodeIds, !haveVirtualRootNode, Translator.get("functional_case.module.default.name"));
|
List<BaseTreeNode> baseTreeNodes = functionalCaseModuleService.buildTreeAndCountResource(nodeByNodeIds, !haveVirtualRootNode, Translator.get("functional_case.module.default.name"));
|
||||||
for (BaseTreeNode baseTreeNode : baseTreeNodes) {
|
for (BaseTreeNode baseTreeNode : baseTreeNodes) {
|
||||||
projectNode.addChild(baseTreeNode);
|
projectNode.addChild(baseTreeNode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,7 @@ public class TestPlanLogService {
|
||||||
* @return 日志对象
|
* @return 日志对象
|
||||||
*/
|
*/
|
||||||
public LogDTO copyLog(TestPlanCopyRequest request) {
|
public LogDTO copyLog(TestPlanCopyRequest request) {
|
||||||
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(request.getTestPlanId());
|
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(request.getId());
|
||||||
testPlan.setName(request.getName());
|
testPlan.setName(request.getName());
|
||||||
LogDTO dto = new LogDTO(
|
LogDTO dto = new LogDTO(
|
||||||
request.getProjectId(),
|
request.getProjectId(),
|
||||||
|
|
|
@ -380,7 +380,7 @@ public class TestPlanService extends TestPlanBaseUtilsService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public TestPlan copy(TestPlanCopyRequest request, String userId) {
|
public TestPlan copy(TestPlanCopyRequest request, String userId) {
|
||||||
TestPlan testPlan = savePlanDTO(request, userId, request.getTestPlanId());
|
TestPlan testPlan = savePlanDTO(request, userId, request.getId());
|
||||||
return testPlan;
|
return testPlan;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1713,7 +1713,7 @@ public class TestPlanTests extends BaseTest {
|
||||||
public void testCopy() throws Exception {
|
public void testCopy() throws Exception {
|
||||||
//1.计划 无用例
|
//1.计划 无用例
|
||||||
TestPlanCopyRequest copyRequest = new TestPlanCopyRequest();
|
TestPlanCopyRequest copyRequest = new TestPlanCopyRequest();
|
||||||
copyRequest.setTestPlanId("wx_test_plan_id_1");
|
copyRequest.setId("wx_test_plan_id_1");
|
||||||
copyRequest.setProjectId("123");
|
copyRequest.setProjectId("123");
|
||||||
copyRequest.setName("测试计划复制");
|
copyRequest.setName("测试计划复制");
|
||||||
copyRequest.setType(TestPlanConstants.TEST_PLAN_TYPE_PLAN);
|
copyRequest.setType(TestPlanConstants.TEST_PLAN_TYPE_PLAN);
|
||||||
|
@ -1726,7 +1726,7 @@ public class TestPlanTests extends BaseTest {
|
||||||
|
|
||||||
//2.计划 有用例
|
//2.计划 有用例
|
||||||
TestPlanCopyRequest copyRequest1 = new TestPlanCopyRequest();
|
TestPlanCopyRequest copyRequest1 = new TestPlanCopyRequest();
|
||||||
copyRequest1.setTestPlanId("wx_test_plan_id_4");
|
copyRequest1.setId("wx_test_plan_id_4");
|
||||||
copyRequest1.setProjectId("123");
|
copyRequest1.setProjectId("123");
|
||||||
copyRequest1.setName("测试计划复制有用例");
|
copyRequest1.setName("测试计划复制有用例");
|
||||||
copyRequest1.setType(TestPlanConstants.TEST_PLAN_TYPE_PLAN);
|
copyRequest1.setType(TestPlanConstants.TEST_PLAN_TYPE_PLAN);
|
||||||
|
@ -1739,7 +1739,7 @@ public class TestPlanTests extends BaseTest {
|
||||||
|
|
||||||
//3.计划组 无计划
|
//3.计划组 无计划
|
||||||
TestPlanCopyRequest copyRequest2 = new TestPlanCopyRequest();
|
TestPlanCopyRequest copyRequest2 = new TestPlanCopyRequest();
|
||||||
copyRequest2.setTestPlanId("wx_test_plan_id_2");
|
copyRequest2.setId("wx_test_plan_id_2");
|
||||||
copyRequest2.setProjectId("123");
|
copyRequest2.setProjectId("123");
|
||||||
copyRequest2.setName("测试计划组复制无计划");
|
copyRequest2.setName("测试计划组复制无计划");
|
||||||
copyRequest2.setType(TestPlanConstants.TEST_PLAN_TYPE_GROUP);
|
copyRequest2.setType(TestPlanConstants.TEST_PLAN_TYPE_GROUP);
|
||||||
|
@ -1752,7 +1752,7 @@ public class TestPlanTests extends BaseTest {
|
||||||
|
|
||||||
//4.计划组 有计划
|
//4.计划组 有计划
|
||||||
TestPlanCopyRequest copyRequest3 = new TestPlanCopyRequest();
|
TestPlanCopyRequest copyRequest3 = new TestPlanCopyRequest();
|
||||||
copyRequest3.setTestPlanId("wx_test_plan_id_5");
|
copyRequest3.setId("wx_test_plan_id_5");
|
||||||
copyRequest3.setProjectId("123");
|
copyRequest3.setProjectId("123");
|
||||||
copyRequest3.setName("测试计划组复制有计划");
|
copyRequest3.setName("测试计划组复制有计划");
|
||||||
copyRequest3.setType(TestPlanConstants.TEST_PLAN_TYPE_GROUP);
|
copyRequest3.setType(TestPlanConstants.TEST_PLAN_TYPE_GROUP);
|
||||||
|
|
Loading…
Reference in New Issue