feat(项目管理): 提供获取第三方平台配置信息接口

This commit is contained in:
WangXu10 2023-10-20 16:15:25 +08:00 committed by f2c-ci-robot[bot]
parent c513cb46ea
commit bcc408abce
4 changed files with 58 additions and 2 deletions

View File

@ -43,7 +43,7 @@ CREATE INDEX idx_update_time ON functional_case(update_time);
CREATE TABLE IF NOT EXISTS functional_case_blob( CREATE TABLE IF NOT EXISTS functional_case_blob(
`id` VARCHAR(50) NOT NULL COMMENT '功能用例ID' , `id` VARCHAR(50) NOT NULL COMMENT '功能用例ID' ,
`steps` LONGTEXT COMMENT '用例步骤JSON)step_model 为 Step 时启用' , `steps` LONGTEXT COMMENT '用例步骤JSON)step_model 为 Step 时启用' ,
`text_description` LONGTEXT COMMENT '步骤描述step_model 为 Text 时启用' , `text_description` LONGTEXT COMMENT '文本描述step_model 为 Text 时启用' ,
`expected_result` LONGTEXT COMMENT '预期结果step_model 为 Text 时启用' , `expected_result` LONGTEXT COMMENT '预期结果step_model 为 Text 时启用' ,
`prerequisite` LONGTEXT COMMENT '前置条件' , `prerequisite` LONGTEXT COMMENT '前置条件' ,
`description` LONGTEXT COMMENT '备注' , `description` LONGTEXT COMMENT '备注' ,

View File

@ -169,7 +169,7 @@ CREATE TABLE IF NOT EXISTS project_application
( (
`project_id` VARCHAR(50) NOT NULL COMMENT '项目ID', `project_id` VARCHAR(50) NOT NULL COMMENT '项目ID',
`type` VARCHAR(50) NOT NULL COMMENT '配置项', `type` VARCHAR(50) NOT NULL COMMENT '配置项',
`type_value` VARCHAR(255) COMMENT '配置值', `type_value` VARCHAR(512) COMMENT '配置值',
PRIMARY KEY (project_id, type) PRIMARY KEY (project_id, type)
) ENGINE = InnoDB ) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 DEFAULT CHARSET = utf8mb4

View File

@ -515,4 +515,39 @@ public class ProjectApplicationService {
long l = fakeErrorMapper.countByExample(example); long l = fakeErrorMapper.countByExample(example);
return (int) l; return (int) l;
} }
/**
* 获取缺陷项目配置信息
*
* @param projectId
* @return
*/
public String getProjectBugThirdPartConfig(String projectId) {
ProjectApplicationExample example = new ProjectApplicationExample();
example.createCriteria().andProjectIdEqualTo(projectId).andTypeLike(ProjectApplicationType.BUG.BUG_SYNC.name() + "_PLATFORM");
List<ProjectApplication> list = projectApplicationMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(list)) {
return list.get(0).getTypeValue();
}
return null;
}
/**
* 获取需求项目配置信息
*
* @param projectId
* @return
*/
public String getProjectDemandThirdPartConfig(String projectId) {
ProjectApplicationExample example = new ProjectApplicationExample();
example.createCriteria().andProjectIdEqualTo(projectId).andTypeLike(ProjectApplicationType.CASE_RELATED_CONFIG.CASE_RELATED.name() + "_PLATFORM");
List<ProjectApplication> list = projectApplicationMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(list)) {
return list.get(0).getTypeValue();
}
return null;
}
} }

View File

@ -4,6 +4,7 @@ import io.metersphere.project.controller.param.ProjectApplicationDefinition;
import io.metersphere.project.controller.param.ProjectApplicationRequestDefinition; import io.metersphere.project.controller.param.ProjectApplicationRequestDefinition;
import io.metersphere.project.domain.ProjectApplication; import io.metersphere.project.domain.ProjectApplication;
import io.metersphere.project.request.ProjectApplicationRequest; import io.metersphere.project.request.ProjectApplicationRequest;
import io.metersphere.project.service.ProjectApplicationService;
import io.metersphere.sdk.constants.ProjectApplicationType; import io.metersphere.sdk.constants.ProjectApplicationType;
import io.metersphere.sdk.util.JSON; import io.metersphere.sdk.util.JSON;
import io.metersphere.system.base.BaseTest; import io.metersphere.system.base.BaseTest;
@ -46,6 +47,9 @@ public class ProjectApplicationControllerTests extends BaseTest {
@Resource @Resource
private PluginService pluginService; private PluginService pluginService;
@Resource
private ProjectApplicationService projectApplicationService;
public static final String PROJECT_ID = "project_application_test_id"; public static final String PROJECT_ID = "project_application_test_id";
public static final String TIME_TYPE_VALUE = "3M"; public static final String TIME_TYPE_VALUE = "3M";
@ -674,4 +678,21 @@ public class ProjectApplicationControllerTests extends BaseTest {
private String address; private String address;
private String version; private String version;
} }
@Test
@Order(40)
public void testGetProjectBugThirdPartConfig() throws Exception {
projectApplicationService.getProjectBugThirdPartConfig(DEFAULT_PROJECT_ID);
projectApplicationService.getProjectBugThirdPartConfig("test_project_id");
}
@Test
@Order(40)
public void testGetProjectDemandThirdPartConfig() throws Exception {
projectApplicationService.getProjectDemandThirdPartConfig(DEFAULT_PROJECT_ID);
projectApplicationService.getProjectDemandThirdPartConfig("test+project_id");
}
} }