diff --git a/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.java b/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.java index a54980c99f..66b1cbf281 100644 --- a/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.java +++ b/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.java @@ -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 selectRefIdsForVersionChange(@Param("versionId") String versionId, @Param("projectId") String projectId); String selectNameById(String testId); diff --git a/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.xml b/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.xml index e88172554e..ff8efe9324 100644 --- a/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.xml +++ b/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.xml @@ -1168,6 +1168,14 @@ SELECT id FROM api_module WHERE project_id = #{projectId} AND protocol = #{protocol} ) + + + UPDATE api_definition + SET module_id = #{moduleId}, + module_path = #{modulePath} + WHERE ref_id = #{refId} + AND version_id != #{versionId} + SELECT DISTINCT ref_id FROM api_scenario diff --git a/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionImportUtilService.java b/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionImportUtilService.java index f9aac4a518..db1f66375a 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionImportUtilService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionImportUtilService.java @@ -532,6 +532,7 @@ public class ApiDefinitionImportUtilService { updateApiList.add(definitionWithBLOBs); } } + apiDefinitionWithBLOBs.setRefId(latestApi.getRefId()); apiDefinitionWithBLOBs.setVersionId("trash"); } else { addNewVersionApi(apiDefinitionWithBLOBs, latestApi, "update"); diff --git a/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionService.java b/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionService.java index 590113bc4e..79f42e5133 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionService.java @@ -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()) { diff --git a/api-test/backend/src/main/java/io/metersphere/service/plan/TestPlanApiCaseService.java b/api-test/backend/src/main/java/io/metersphere/service/plan/TestPlanApiCaseService.java index 4d726e1f00..f94b6e1bc9 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/plan/TestPlanApiCaseService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/plan/TestPlanApiCaseService.java @@ -829,6 +829,6 @@ public class TestPlanApiCaseService { ApiTestCaseExample example = new ApiTestCaseExample(); example.createCriteria().andIdIn(apiCaseIds); List apiTestCases = apiTestCaseMapper.selectByExample(example); - return apiTestCases.stream().map(ApiTestCase::getProjectId).collect(Collectors.toList()); + return apiTestCases.stream().map(ApiTestCase::getProjectId).distinct().collect(Collectors.toList()); } } diff --git a/api-test/backend/src/main/java/io/metersphere/service/plan/TestPlanScenarioCaseService.java b/api-test/backend/src/main/java/io/metersphere/service/plan/TestPlanScenarioCaseService.java index 673eac2f64..a211918032 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/plan/TestPlanScenarioCaseService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/plan/TestPlanScenarioCaseService.java @@ -1257,6 +1257,6 @@ public class TestPlanScenarioCaseService { ApiScenarioExample example = new ApiScenarioExample(); example.createCriteria().andIdIn(scenarioIds); List apiScenarios = apiScenarioMapper.selectByExample(example); - return apiScenarios.stream().map(ApiScenario::getProjectId).collect(Collectors.toList()); + return apiScenarios.stream().map(ApiScenario::getProjectId).distinct().collect(Collectors.toList()); } } diff --git a/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java b/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java index e0df117ce0..7bd3d1e3aa 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java @@ -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; diff --git a/framework/sdk-parent/frontend/src/i18n/lang/track/en-US.js b/framework/sdk-parent/frontend/src/i18n/lang/track/en-US.js index 8c68d11d02..50533c66af 100644 --- a/framework/sdk-parent/frontend/src/i18n/lang/track/en-US.js +++ b/framework/sdk-parent/frontend/src/i18n/lang/track/en-US.js @@ -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", diff --git a/framework/sdk-parent/frontend/src/i18n/lang/track/zh-CN.js b/framework/sdk-parent/frontend/src/i18n/lang/track/zh-CN.js index 0676d62a2d..b13ce93647 100644 --- a/framework/sdk-parent/frontend/src/i18n/lang/track/zh-CN.js +++ b/framework/sdk-parent/frontend/src/i18n/lang/track/zh-CN.js @@ -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: "同步完成", diff --git a/framework/sdk-parent/frontend/src/i18n/lang/track/zh-TW.js b/framework/sdk-parent/frontend/src/i18n/lang/track/zh-TW.js index eeb912e9d9..6691db0bcd 100644 --- a/framework/sdk-parent/frontend/src/i18n/lang/track/zh-TW.js +++ b/framework/sdk-parent/frontend/src/i18n/lang/track/zh-TW.js @@ -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: "同步完成", diff --git a/framework/sdk-parent/jmeter/src/main/java/org/apache/jmeter/util/JSR223TestElement.java b/framework/sdk-parent/jmeter/src/main/java/org/apache/jmeter/util/JSR223TestElement.java index 424bf0310f..d281d8f2c8 100644 --- a/framework/sdk-parent/jmeter/src/main/java/org/apache/jmeter/util/JSR223TestElement.java +++ b/framework/sdk-parent/jmeter/src/main/java/org/apache/jmeter/util/JSR223TestElement.java @@ -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()) { diff --git a/project-management/frontend/src/business/home/EditProject.vue b/project-management/frontend/src/business/home/EditProject.vue index 4ea939643b..2354f99b8e 100644 --- a/project-management/frontend/src/business/home/EditProject.vue +++ b/project-management/frontend/src/business/home/EditProject.vue @@ -31,7 +31,7 @@ - {{ $t('test_track.issue.use_third_party') }} + {{ $t('test_track.issue.use_third_party', [form.platform]) }} diff --git a/project-management/frontend/src/business/home/ProjectPlatformConfig.vue b/project-management/frontend/src/business/home/ProjectPlatformConfig.vue index 007820166e..688c0371c6 100644 --- a/project-management/frontend/src/business/home/ProjectPlatformConfig.vue +++ b/project-management/frontend/src/business/home/ProjectPlatformConfig.vue @@ -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); diff --git a/system-setting/frontend/src/business/workspace/project/EditProject.vue b/system-setting/frontend/src/business/workspace/project/EditProject.vue index fc265e19f2..4c4562053a 100644 --- a/system-setting/frontend/src/business/workspace/project/EditProject.vue +++ b/system-setting/frontend/src/business/workspace/project/EditProject.vue @@ -31,7 +31,7 @@ - {{ $t('test_track.issue.use_third_party') }} + {{ $t('test_track.issue.use_third_party', [form.platform]) }} diff --git a/system-setting/frontend/src/business/workspace/project/ProjectPlatformConfig.vue b/system-setting/frontend/src/business/workspace/project/ProjectPlatformConfig.vue index fd7294de04..300bd2fbe2 100644 --- a/system-setting/frontend/src/business/workspace/project/ProjectPlatformConfig.vue +++ b/system-setting/frontend/src/business/workspace/project/ProjectPlatformConfig.vue @@ -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); diff --git a/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtIssuesMapper.xml b/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtIssuesMapper.xml index f33857437f..5c40607781 100644 --- a/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtIssuesMapper.xml +++ b/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtIssuesMapper.xml @@ -112,7 +112,7 @@ group by issues.id diff --git a/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java b/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java index 3c6b80c4f6..9fffc9c340 100644 --- a/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java +++ b/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java @@ -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 getMaintainerMap(@Param("request") QueryTestCaseRequest request); List getForNodeEdit(@Param("ids") List ids); diff --git a/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml b/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml index 0b651f7bdc..5ec84f4676 100644 --- a/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml +++ b/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml @@ -1266,6 +1266,14 @@ WHERE ref_id = #{refId,jdbcType=VARCHAR} + + UPDATE test_case + SET node_id = #{moduleId}, + node_path = #{modulePath} + WHERE ref_id = #{refId} + AND version_id != #{versionId} + + update test_case diff --git a/test-track/backend/src/main/java/io/metersphere/service/IssuesService.java b/test-track/backend/src/main/java/io/metersphere/service/IssuesService.java index 34024fd15b..8e09496cd0 100644 --- a/test-track/backend/src/main/java/io/metersphere/service/IssuesService.java +++ b/test-track/backend/src/main/java/io/metersphere/service/IssuesService.java @@ -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> fieldMap = customFieldIssuesService.getMapByResourceIds(data.stream().map(IssuesDao::getId).collect(Collectors.toList())); try { - Map fieldMaps = new HashMap<>(); - if (isThirdTemplate) { - fieldMaps = customFields.stream().collect(Collectors.toMap(CustomFieldDao::getId, field -> (CustomField) field)); - } else { - List customfields = fieldMap.get(data.get(0).getId()); - if (CollectionUtils.isNotEmpty(customfields) && customfields.size() > 0) { - List ids = customfields.stream().map(CustomFieldDao::getId).collect(Collectors.toList()); - List issueFields = baseCustomFieldService.getFieldByIds(ids); - fieldMaps = issueFields.stream().collect(Collectors.toMap(CustomField::getId, field -> field)); - } - } - + Map fieldMaps = customFields.stream().collect(Collectors.toMap(CustomFieldDao::getId, field -> (CustomField) field)); for (Map.Entry> 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 userMap = baseUserService.getProjectMemberOption(request.getProjectId()).stream().collect(Collectors.toMap(User::getId, User::getName)); + // 获取第三方平台自定义字段 + List pluginCustomFields = getPluginCustomFields(request.getProjectId()); // 获取缺陷模板及自定义字段 IssueTemplateDao issueTemplate = getIssueTemplateByProjectId(request.getProjectId()); List 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 userMap = baseUserService.getProjectMemberOption(request.getProjectId()).stream().collect(Collectors.toMap(User::getId, User::getName)); + // 第三方平台的自定义字段 + List pluginCustomFields = getPluginCustomFields(request.getProjectId()); // 获取缺陷模板及自定义字段 IssueTemplateDao issueTemplate = getIssueTemplateByProjectId(request.getProjectId()); List customFields = Optional.ofNullable(issueTemplate.getCustomFields()).orElse(new ArrayList<>()); + customFields.addAll(pluginCustomFields); // 根据自定义字段获取表头内容 List> heads = new IssueExcelDataFactory().getIssueExcelDataLocal().getHead(issueTemplate.getIsThirdTemplate(), customFields, request); // 获取导出缺陷列表 diff --git a/test-track/backend/src/main/java/io/metersphere/service/PlatformPluginService.java b/test-track/backend/src/main/java/io/metersphere/service/PlatformPluginService.java index fd453e168b..a402ba0d54 100644 --- a/test-track/backend/src/main/java/io/metersphere/service/PlatformPluginService.java +++ b/test-track/backend/src/main/java/io/metersphere/service/PlatformPluginService.java @@ -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(); } diff --git a/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java b/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java index 83d7481c47..5ce24bfaae 100644 --- a/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java +++ b/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java @@ -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()); + } + /** * 处理其他信息的复制问题 *