Merge branch 'main' of https://github.com/metersphere/metersphere
This commit is contained in:
commit
a9594c857a
|
@ -85,6 +85,8 @@ public interface ExtApiDefinitionMapper {
|
|||
|
||||
void addLatestVersion(String refId);
|
||||
|
||||
void updateVersionModule(@Param("refId") String refId, @Param("versionId") String versionId, @Param("moduleId") String moduleId, @Param("modulePath") String modulePath);
|
||||
|
||||
List<String> selectRefIdsForVersionChange(@Param("versionId") String versionId, @Param("projectId") String projectId);
|
||||
|
||||
String selectNameById(String testId);
|
||||
|
|
|
@ -1168,6 +1168,14 @@
|
|||
SELECT id FROM api_module WHERE project_id = #{projectId} AND protocol = #{protocol}
|
||||
)
|
||||
</update>
|
||||
|
||||
<update id="updateVersionModule">
|
||||
UPDATE api_definition
|
||||
SET module_id = #{moduleId},
|
||||
module_path = #{modulePath}
|
||||
WHERE ref_id = #{refId}
|
||||
AND version_id != #{versionId}
|
||||
</update>
|
||||
<select id="selectRefIdsForVersionChange" resultType="java.lang.String">
|
||||
SELECT DISTINCT ref_id
|
||||
FROM api_definition
|
||||
|
|
|
@ -90,6 +90,8 @@ public interface ExtApiScenarioMapper {
|
|||
|
||||
void addLatestVersion(String refId);
|
||||
|
||||
void updateVersionModule(@Param("refId") String refId, @Param("versionId") String versionId, @Param("moduleId") String moduleId, @Param("modulePath") String modulePath);
|
||||
|
||||
List<String> selectRefIdsForVersionChange(@Param("versionId") String versionId, @Param("projectId") String projectId);
|
||||
|
||||
List<ApiScenarioWithBLOBs> selectByStatusIsNotTrash();
|
||||
|
|
|
@ -856,6 +856,14 @@
|
|||
WHERE ref_id = #{refId,jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
||||
<update id="updateVersionModule">
|
||||
UPDATE api_scenario
|
||||
SET api_scenario_module_id = #{moduleId},
|
||||
module_path = #{modulePath}
|
||||
WHERE ref_id = #{refId}
|
||||
AND version_id != #{versionId}
|
||||
</update>
|
||||
|
||||
<select id="selectRefIdsForVersionChange" resultType="java.lang.String">
|
||||
SELECT DISTINCT ref_id
|
||||
FROM api_scenario
|
||||
|
|
|
@ -532,6 +532,7 @@ public class ApiDefinitionImportUtilService {
|
|||
updateApiList.add(definitionWithBLOBs);
|
||||
}
|
||||
}
|
||||
apiDefinitionWithBLOBs.setRefId(latestApi.getRefId());
|
||||
apiDefinitionWithBLOBs.setVersionId("trash");
|
||||
} else {
|
||||
addNewVersionApi(apiDefinitionWithBLOBs, latestApi, "update");
|
||||
|
|
|
@ -787,7 +787,8 @@ public class ApiDefinitionService {
|
|||
if (StringUtils.equalsIgnoreCase(request.getVersionId(), defaultVersion)) {
|
||||
checkAndSetLatestVersion(result.getRefId());
|
||||
}
|
||||
|
||||
//同步修改所有版本的模块路径
|
||||
updateOtherVersionModule(result);
|
||||
// 存储附件关系
|
||||
extFileAssociationService.saveApi(test.getId(), request.getRequest(), FileAssociationTypeEnums.API.name());
|
||||
//保存自定义字段
|
||||
|
@ -796,6 +797,10 @@ public class ApiDefinitionService {
|
|||
return result;
|
||||
}
|
||||
|
||||
private void updateOtherVersionModule(ApiDefinitionWithBLOBs result) {
|
||||
extApiDefinitionMapper.updateVersionModule(result.getRefId(), result.getVersionId(), result.getModuleId(), result.getModulePath());
|
||||
}
|
||||
|
||||
private void saveExtendInfo(SaveApiDefinitionRequest request, ApiDefinitionWithBLOBs test, ApiDefinitionWithBLOBs oldApi) {
|
||||
// 创建新版是否关联备注
|
||||
if (!request.isNewVersionRemark()) {
|
||||
|
|
|
@ -829,6 +829,6 @@ public class TestPlanApiCaseService {
|
|||
ApiTestCaseExample example = new ApiTestCaseExample();
|
||||
example.createCriteria().andIdIn(apiCaseIds);
|
||||
List<ApiTestCase> apiTestCases = apiTestCaseMapper.selectByExample(example);
|
||||
return apiTestCases.stream().map(ApiTestCase::getProjectId).collect(Collectors.toList());
|
||||
return apiTestCases.stream().map(ApiTestCase::getProjectId).distinct().collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1257,6 +1257,6 @@ public class TestPlanScenarioCaseService {
|
|||
ApiScenarioExample example = new ApiScenarioExample();
|
||||
example.createCriteria().andIdIn(scenarioIds);
|
||||
List<ApiScenario> apiScenarios = apiScenarioMapper.selectByExample(example);
|
||||
return apiScenarios.stream().map(ApiScenario::getProjectId).collect(Collectors.toList());
|
||||
return apiScenarios.stream().map(ApiScenario::getProjectId).distinct().collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -413,11 +413,17 @@ public class ApiScenarioService {
|
|||
if (StringUtils.equalsIgnoreCase(request.getVersionId(), defaultVersion)) {
|
||||
checkAndSetLatestVersion(beforeScenario.getRefId());
|
||||
}
|
||||
//同步修改所有版本的模块路径
|
||||
updateOtherVersionModule(beforeScenario.getRefId(), scenario);
|
||||
// 存储附件关系
|
||||
extFileAssociationService.saveScenario(scenario.getId(), request.getScenarioDefinition());
|
||||
return scenario;
|
||||
}
|
||||
|
||||
private void updateOtherVersionModule(String refId, ApiScenarioWithBLOBs scenario) {
|
||||
extApiScenarioMapper.updateVersionModule(refId, scenario.getVersionId(), scenario.getApiScenarioModuleId(), scenario.getModulePath());
|
||||
}
|
||||
|
||||
private void checkReferenceCase(ApiScenarioWithBLOBs scenario, ApiScenarioParamDTO apiScenarioParamDto) {
|
||||
if (scenario == null || StringUtils.isEmpty(scenario.getScenarioDefinition())) {
|
||||
return;
|
||||
|
|
|
@ -471,7 +471,7 @@ export default {
|
|||
zentao_bug_build: "Zentao Impact version",
|
||||
zentao_bug_assigned: "Zentao handler",
|
||||
third_party_integrated: "Third-party Platform",
|
||||
use_third_party: "Enable Jira Issue Template",
|
||||
use_third_party: "Enable {0} Issue Template",
|
||||
update_third_party_bugs: "Update the defects of third-party platforms",
|
||||
sync_bugs: "Synchronization Issue",
|
||||
sync_complete: "Synchronization complete",
|
||||
|
|
|
@ -474,7 +474,7 @@ export default {
|
|||
zentao_bug_build: "禅道 影响版本",
|
||||
zentao_bug_assigned: "禅道 处理人",
|
||||
third_party_integrated: "集成第三方平台",
|
||||
use_third_party: "使用 Jira 缺陷模板",
|
||||
use_third_party: "使用 {0} 缺陷模板",
|
||||
update_third_party_bugs: "更新第三方平台的缺陷",
|
||||
sync_bugs: "同步缺陷",
|
||||
sync_complete: "同步完成",
|
||||
|
|
|
@ -474,7 +474,7 @@ export default {
|
|||
zentao_bug_build: "禪道 影響版本",
|
||||
zentao_bug_assigned: "禪道 處理人",
|
||||
third_party_integrated: "集成第三方平臺",
|
||||
use_third_party: "使用 Jira 缺陷模闆",
|
||||
use_third_party: "使用 {0} 缺陷模闆",
|
||||
update_third_party_bugs: "更新第三方平臺的缺陷",
|
||||
sync_bugs: "同步缺陷",
|
||||
sync_complete: "同步完成",
|
||||
|
|
|
@ -185,7 +185,8 @@ public abstract class JSR223TestElement extends ScriptingTestElement
|
|||
File scriptFile = new File(getFilename());
|
||||
// Hack: bsh-2.0b5.jar BshScriptEngine implements Compilable but throws
|
||||
// "java.lang.Error: unimplemented"
|
||||
boolean supportsCompilable = false;
|
||||
boolean supportsCompilable = scriptEngine instanceof Compilable
|
||||
&& !"bsh.engine.BshScriptEngine".equals(scriptEngine.getClass().getName()); // NOSONAR // $NON-NLS-1$
|
||||
try {
|
||||
if (!StringUtils.isEmpty(getFilename())) {
|
||||
if (scriptFile.exists() && scriptFile.canRead()) {
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
<el-checkbox @change="thirdPartTemplateChange" v-if="thirdPartTemplateSupport"
|
||||
v-model="form.thirdPartTemplate" style="margin-left: 10px">
|
||||
{{ $t('test_track.issue.use_third_party') }}
|
||||
{{ $t('test_track.issue.use_third_party', [form.platform]) }}
|
||||
</el-checkbox>
|
||||
</el-form-item>
|
||||
|
||||
|
|
|
@ -90,7 +90,8 @@ export default {
|
|||
getPlatformProjectInfo(this.platformKey)
|
||||
.then(r => {
|
||||
if (r.data) {
|
||||
Object.assign(this.form, this.projectConfig);
|
||||
let form = {};
|
||||
Object.assign(form, this.projectConfig);
|
||||
this.handleProjectConfigCompatible();
|
||||
|
||||
r.data.formItems.forEach(item => {
|
||||
|
@ -98,18 +99,19 @@ export default {
|
|||
item.options = [];
|
||||
}
|
||||
// 设置默认值
|
||||
if (this.form[item.name]) {
|
||||
this.$set(item, 'defaultValue', this.form[item.name]);
|
||||
if (form[item.name]) {
|
||||
this.$set(item, 'defaultValue', form[item.name]);
|
||||
}
|
||||
// 获取级联选项值
|
||||
if (item.cascade && this.form[item.name]) {
|
||||
if (item.cascade && form[item.cascade]) {
|
||||
this.getCascadeOptions(item, () => {
|
||||
// 没有选项值会被组件自动清空,获取下拉框选项之后,重新设置默认值
|
||||
if (this.form[item.name]) {
|
||||
this.$set(item, 'defaultValue', this.form[item.name]);
|
||||
if (form[item.name]) {
|
||||
this.$set(item, 'defaultValue', form[item.name]);
|
||||
}
|
||||
});
|
||||
}
|
||||
this.form = form;
|
||||
});
|
||||
this.config = r.data;
|
||||
this.rules = getPlatformFormRules(this.config);
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
<el-checkbox @change="thirdPartTemplateChange" v-if="thirdPartTemplateSupport"
|
||||
v-model="form.thirdPartTemplate" style="margin-left: 10px">
|
||||
{{ $t('test_track.issue.use_third_party') }}
|
||||
{{ $t('test_track.issue.use_third_party', [form.platform]) }}
|
||||
</el-checkbox>
|
||||
</el-form-item>
|
||||
|
||||
|
|
|
@ -89,7 +89,8 @@ export default {
|
|||
getPlatformProjectInfo(this.platformKey)
|
||||
.then(r => {
|
||||
if (r.data) {
|
||||
Object.assign(this.form, this.projectConfig);
|
||||
let form = {};
|
||||
Object.assign(form, this.projectConfig);
|
||||
this.handleProjectConfigCompatible();
|
||||
|
||||
r.data.formItems.forEach(item => {
|
||||
|
@ -97,18 +98,19 @@ export default {
|
|||
item.options = [];
|
||||
}
|
||||
// 设置默认值
|
||||
if (this.form[item.name]) {
|
||||
this.$set(item, 'defaultValue', this.form[item.name]);
|
||||
if (form[item.name]) {
|
||||
this.$set(item, 'defaultValue', form[item.name]);
|
||||
}
|
||||
// 获取级联选项值
|
||||
if (item.cascade && this.form[item.name]) {
|
||||
if (item.cascade && form[item.cascade]) {
|
||||
this.getCascadeOptions(item, () => {
|
||||
// 没有选项值会被组件自动清空,获取下拉框选项之后,重新设置默认值
|
||||
if (this.form[item.name]) {
|
||||
this.$set(item, 'defaultValue', this.form[item.name]);
|
||||
if (form[item.name]) {
|
||||
this.$set(item, 'defaultValue', form[item.name]);
|
||||
}
|
||||
});
|
||||
}
|
||||
this.form = form;
|
||||
});
|
||||
this.config = r.data;
|
||||
this.rules = getPlatformFormRules(this.config);
|
||||
|
|
|
@ -112,7 +112,7 @@
|
|||
group by issues.id
|
||||
</select>
|
||||
<select id="getIssueForSync" resultType="io.metersphere.xpack.track.dto.IssuesDao">
|
||||
select id, platform, platform_id, create_time
|
||||
select id, platform, platform_id, create_time, update_time
|
||||
from issues
|
||||
where project_id = #{projectId} and platform = #{platform} and (platform_status != 'delete' or platform_status is null);
|
||||
</select>
|
||||
|
|
|
@ -150,6 +150,9 @@ public interface ExtTestCaseMapper {
|
|||
|
||||
int addLatestVersion(@Param("refId") String refId);
|
||||
|
||||
void updateVersionModule(@Param("refId") String refId, @Param("versionId") String versionId, @Param("moduleId") String moduleId, @Param("modulePath") String modulePath);
|
||||
|
||||
|
||||
List<TestCase> getMaintainerMap(@Param("request") QueryTestCaseRequest request);
|
||||
|
||||
List<TestCaseDTO> getForNodeEdit(@Param("ids") List<String> ids);
|
||||
|
|
|
@ -1266,6 +1266,14 @@
|
|||
WHERE ref_id = #{refId,jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
||||
<update id="updateVersionModule">
|
||||
UPDATE test_case
|
||||
SET node_id = #{moduleId},
|
||||
node_path = #{modulePath}
|
||||
WHERE ref_id = #{refId}
|
||||
AND version_id != #{versionId}
|
||||
</update>
|
||||
|
||||
<update id="bathUpdateByCondition">
|
||||
update test_case
|
||||
<set>
|
||||
|
|
|
@ -292,7 +292,9 @@ public class IssuesService {
|
|||
issues.setId(UUID.randomUUID().toString());
|
||||
}
|
||||
issues.setCreateTime(System.currentTimeMillis());
|
||||
issues.setUpdateTime(System.currentTimeMillis());
|
||||
if (issues.getUpdateTime() == null) {
|
||||
issues.setUpdateTime(System.currentTimeMillis());
|
||||
}
|
||||
issues.setNum(getNextNum(issues.getProjectId()));
|
||||
issues.setCreator(SessionUtils.getUserId());
|
||||
issuesMapper.insert(issues);
|
||||
|
@ -703,18 +705,7 @@ public class IssuesService {
|
|||
Map<String, List<CustomFieldDao>> fieldMap =
|
||||
customFieldIssuesService.getMapByResourceIds(data.stream().map(IssuesDao::getId).collect(Collectors.toList()));
|
||||
try {
|
||||
Map<String, CustomField> fieldMaps = new HashMap<>();
|
||||
if (isThirdTemplate) {
|
||||
fieldMaps = customFields.stream().collect(Collectors.toMap(CustomFieldDao::getId, field -> (CustomField) field));
|
||||
} else {
|
||||
List<CustomFieldDao> customfields = fieldMap.get(data.get(0).getId());
|
||||
if (CollectionUtils.isNotEmpty(customfields) && customfields.size() > 0) {
|
||||
List<String> ids = customfields.stream().map(CustomFieldDao::getId).collect(Collectors.toList());
|
||||
List<CustomField> issueFields = baseCustomFieldService.getFieldByIds(ids);
|
||||
fieldMaps = issueFields.stream().collect(Collectors.toMap(CustomField::getId, field -> field));
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, CustomField> fieldMaps = customFields.stream().collect(Collectors.toMap(CustomFieldDao::getId, field -> (CustomField) field));
|
||||
for (Map.Entry<String, List<CustomFieldDao>> entry : fieldMap.entrySet()) {
|
||||
for (CustomFieldDao fieldDao : entry.getValue()) {
|
||||
CustomField customField = fieldMaps.get(fieldDao.getId());
|
||||
|
@ -1531,9 +1522,12 @@ public class IssuesService {
|
|||
MSException.throwException(Translator.get("upload_fail"));
|
||||
}
|
||||
Map<String, String> userMap = baseUserService.getProjectMemberOption(request.getProjectId()).stream().collect(Collectors.toMap(User::getId, User::getName));
|
||||
// 获取第三方平台自定义字段
|
||||
List<CustomFieldDao> pluginCustomFields = getPluginCustomFields(request.getProjectId());
|
||||
// 获取缺陷模板及自定义字段
|
||||
IssueTemplateDao issueTemplate = getIssueTemplateByProjectId(request.getProjectId());
|
||||
List<CustomFieldDao> customFields = Optional.ofNullable(issueTemplate.getCustomFields()).orElse(new ArrayList<>());
|
||||
customFields.addAll(pluginCustomFields);
|
||||
// 获取本地EXCEL数据对象
|
||||
Class clazz = new IssueExcelDataFactory().getExcelDataByLocal();
|
||||
// IssueExcelListener读取file内容
|
||||
|
@ -1559,9 +1553,12 @@ public class IssuesService {
|
|||
public void issueExport(IssueExportRequest request, HttpServletResponse response) {
|
||||
EasyExcelExporter.resetCellMaxTextLength();
|
||||
Map<String, String> userMap = baseUserService.getProjectMemberOption(request.getProjectId()).stream().collect(Collectors.toMap(User::getId, User::getName));
|
||||
// 第三方平台的自定义字段
|
||||
List<CustomFieldDao> pluginCustomFields = getPluginCustomFields(request.getProjectId());
|
||||
// 获取缺陷模板及自定义字段
|
||||
IssueTemplateDao issueTemplate = getIssueTemplateByProjectId(request.getProjectId());
|
||||
List<CustomFieldDao> customFields = Optional.ofNullable(issueTemplate.getCustomFields()).orElse(new ArrayList<>());
|
||||
customFields.addAll(pluginCustomFields);
|
||||
// 根据自定义字段获取表头内容
|
||||
List<List<String>> heads = new IssueExcelDataFactory().getIssueExcelDataLocal().getHead(issueTemplate.getIsThirdTemplate(), customFields, request);
|
||||
// 获取导出缺陷列表
|
||||
|
|
|
@ -77,7 +77,7 @@ public class PlatformPluginService {
|
|||
}
|
||||
PluginMetaInfo pluginMetaInfo = pluginManager.getPluginMetaInfoByKey(platform);
|
||||
if (PlatformPluginService.isPluginPlatform(platform) && pluginMetaInfo == null) {
|
||||
MSException.throwException(Translator.get("platform_plugin_not_exit") + PlatformPluginService.PLUGIN_DOWNLOAD_URL);
|
||||
return false;
|
||||
}
|
||||
return pluginMetaInfo == null ? false : pluginMetaInfo.isThirdPartTemplateSupport();
|
||||
}
|
||||
|
|
|
@ -467,9 +467,15 @@ public class TestCaseService {
|
|||
if (StringUtils.equalsIgnoreCase(testCase.getVersionId(), defaultVersion)) {
|
||||
checkAndSetLatestVersion(testCase.getRefId());
|
||||
}
|
||||
//同步修改所有版本的模块路径
|
||||
updateOtherVersionModule(testCase);
|
||||
|
||||
}
|
||||
|
||||
private void updateOtherVersionModule(EditTestCaseRequest testCase) {
|
||||
extTestCaseMapper.updateVersionModule(testCase.getRefId(), testCase.getVersionId(), testCase.getNodeId(), testCase.getNodePath());
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理其他信息的复制问题
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue