From 100bec5f3d89060221b55b789aaeabb6a0244e35 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Mon, 21 Nov 2022 17:27:10 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):?= =?UTF-8?q?=20=E7=BC=BA=E5=B0=91=E5=B9=B3=E5=8F=B0=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1019967 --user=陈建星 【测试跟踪】缺陷管理-删除jira缺陷失败 https://www.tapd.cn/55049933/s/1299905 --- .../service/PlatformPluginService.java | 29 +++++++++++++------ .../resources/i18n/messages_en_US.properties | 1 + .../resources/i18n/messages_zh_CN.properties | 1 + .../resources/i18n/messages_zh_TW.properties | 1 + .../service/PlatformPluginService.java | 10 ++++++- .../resources/i18n/commons_en_US.properties | 4 ++- .../resources/i18n/commons_zh_CN.properties | 4 ++- .../resources/i18n/commons_zh_TW.properties | 4 ++- 8 files changed, 41 insertions(+), 13 deletions(-) diff --git a/system-setting/backend/src/main/java/io/metersphere/service/PlatformPluginService.java b/system-setting/backend/src/main/java/io/metersphere/service/PlatformPluginService.java index 5b2fa35180..7e379625a9 100644 --- a/system-setting/backend/src/main/java/io/metersphere/service/PlatformPluginService.java +++ b/system-setting/backend/src/main/java/io/metersphere/service/PlatformPluginService.java @@ -1,5 +1,7 @@ package io.metersphere.service; +import io.metersphere.commons.exception.MSException; +import io.metersphere.i18n.Translator; import io.metersphere.platform.api.Platform; import io.metersphere.platform.api.PluginMetaInfo; import io.metersphere.base.domain.PluginWithBLOBs; @@ -7,7 +9,6 @@ import io.metersphere.base.domain.ServiceIntegration; import io.metersphere.base.mapper.PluginMapper; import io.metersphere.commons.constants.KafkaTopicConstants; import io.metersphere.commons.constants.PluginScenario; -import io.metersphere.commons.utils.BeanUtils; import io.metersphere.commons.utils.JSON; import io.metersphere.commons.utils.LogUtil; import io.metersphere.commons.utils.SessionUtils; @@ -46,6 +47,8 @@ public class PlatformPluginService { @Resource private KafkaTemplate kafkaTemplate; + private static final String PLUGIN_DOWNLOAD_URL = "https://github.com/metersphere/metersphere-platform-plugin"; + private PlatformPluginManager pluginManager; public synchronized PlatformPluginManager getPluginManager() { @@ -133,14 +136,7 @@ public class PlatformPluginService { } public List getProjectOption(PlatformProjectOptionRequest request) { - IntegrationRequest integrationRequest = new IntegrationRequest(); - BeanUtils.copyBean(integrationRequest, request); - ServiceIntegration serviceIntegration = baseIntegrationService.get(integrationRequest); - - PlatformRequest platformRequest = new PlatformRequest(); - platformRequest.setIntegrationConfig(serviceIntegration.getConfiguration()); - - Platform platform = getPluginManager().getPlatformByKey(request.getPlatform(), platformRequest); + Platform platform = getPlatform(request.getPlatform(), request.getWorkspaceId()); GetOptionRequest getOptionRequest = new GetOptionRequest(); getOptionRequest.setOptionMethod(request.getOptionMethod()); getOptionRequest.setProjectConfig(request.getProjectConfig()); @@ -152,6 +148,21 @@ public class PlatformPluginService { } + public Platform getPlatform(String platformKey, String workspaceId) { + IntegrationRequest integrationRequest = new IntegrationRequest(); + integrationRequest.setPlatform(platformKey); + integrationRequest.setWorkspaceId(StringUtils.isBlank(workspaceId) ? SessionUtils.getCurrentWorkspaceId() : workspaceId); + ServiceIntegration serviceIntegration = baseIntegrationService.get(integrationRequest); + + PlatformRequest pluginRequest = new PlatformRequest(); + pluginRequest.setIntegrationConfig(serviceIntegration.getConfiguration()); + Platform platform = getPluginManager().getPlatformByKey(platformKey, pluginRequest); + if (platform == null) { + MSException.throwException(Translator.get("platform_plugin_not_exit") + PLUGIN_DOWNLOAD_URL); + } + return platform; + } + public Map getFrontendMetaDataConfig(PluginWithBLOBs plugin, String configName) { Map metaData = JSON.parseMap(plugin.getFormScript()); Map config = (Map) metaData.get(configName); diff --git a/system-setting/backend/src/main/resources/i18n/messages_en_US.properties b/system-setting/backend/src/main/resources/i18n/messages_en_US.properties index a0cd1b7b37..c510f978cb 100644 --- a/system-setting/backend/src/main/resources/i18n/messages_en_US.properties +++ b/system-setting/backend/src/main/resources/i18n/messages_en_US.properties @@ -1,2 +1,3 @@ error_lang_invalid=Invalid language parameter, new read_permission_file_fail=Failed to read permission file! +platform_plugin_not_exit=Platform docking function has been plug-in, please download the corresponding version of the plug-in: diff --git a/system-setting/backend/src/main/resources/i18n/messages_zh_CN.properties b/system-setting/backend/src/main/resources/i18n/messages_zh_CN.properties index c14b8a013a..13d5fb8b57 100644 --- a/system-setting/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/system-setting/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -1,2 +1,3 @@ error_lang_invalid=语言参数错误, 新 read_permission_file_fail=读取权限文件失败! +platform_plugin_not_exit=平台对接功能已插件化,请下载对应版本的插件: diff --git a/system-setting/backend/src/main/resources/i18n/messages_zh_TW.properties b/system-setting/backend/src/main/resources/i18n/messages_zh_TW.properties index ed4217d8e2..d9c061a608 100644 --- a/system-setting/backend/src/main/resources/i18n/messages_zh_TW.properties +++ b/system-setting/backend/src/main/resources/i18n/messages_zh_TW.properties @@ -1,2 +1,3 @@ error_lang_invalid=語言參數錯誤,新 read_permission_file_fail=讀取權限文件失敗! +platform_plugin_not_exit=平臺對接功能已插件化,請下載對應版本的插件: 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 b1967b43d4..9fd8032a0f 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 @@ -1,7 +1,9 @@ package io.metersphere.service; import io.metersphere.commons.constants.IssuesManagePlatform; +import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.JSON; +import io.metersphere.i18n.Translator; import io.metersphere.platform.api.Platform; import io.metersphere.platform.api.PluginMetaInfo; import io.metersphere.base.domain.PluginWithBLOBs; @@ -33,6 +35,8 @@ public class PlatformPluginService { @Resource private BaseIntegrationService baseIntegrationService; + private static final String PLUGIN_DOWNLOAD_URL = "https://github.com/metersphere/metersphere-platform-plugin"; + private PlatformPluginManager pluginManager; public synchronized PlatformPluginManager getPluginManager() { @@ -82,7 +86,11 @@ public class PlatformPluginService { PlatformRequest pluginRequest = new PlatformRequest(); pluginRequest.setIntegrationConfig(serviceIntegration.getConfiguration()); - return getPluginManager().getPlatformByKey(platformKey, pluginRequest); + Platform platform = getPluginManager().getPlatformByKey(platformKey, pluginRequest); + if (platform == null) { + MSException.throwException(Translator.get("platform_plugin_not_exit") + PLUGIN_DOWNLOAD_URL); + } + return platform; } public Platform getPlatform(String platformKey) { diff --git a/test-track/backend/src/main/resources/i18n/commons_en_US.properties b/test-track/backend/src/main/resources/i18n/commons_en_US.properties index 487fc4eb29..9c01e2fdf0 100644 --- a/test-track/backend/src/main/resources/i18n/commons_en_US.properties +++ b/test-track/backend/src/main/resources/i18n/commons_en_US.properties @@ -221,4 +221,6 @@ test_case_status_saved=Saved execute_not_pass=Not pass execute_pass=Pass jira_auth_error=Account name or password (Token) is wrong -jira_auth_url_error=The test connection failed, please check whether the Jira address is correct \ No newline at end of file +jira_auth_url_error=The test connection failed, please check whether the Jira address is correct + +platform_plugin_not_exit=Platform docking function has been plug-in, please download the corresponding version of the plug-in: diff --git a/test-track/backend/src/main/resources/i18n/commons_zh_CN.properties b/test-track/backend/src/main/resources/i18n/commons_zh_CN.properties index 39fdf40536..7180bf2d88 100644 --- a/test-track/backend/src/main/resources/i18n/commons_zh_CN.properties +++ b/test-track/backend/src/main/resources/i18n/commons_zh_CN.properties @@ -193,4 +193,6 @@ test_case_status_finished=已完成 execute_not_pass=未通过 execute_pass=通过 jira_auth_error=账号名或密码(Token)错误 -jira_auth_url_error=测试连接失败,请检查Jira地址是否正确 \ No newline at end of file +jira_auth_url_error=测试连接失败,请检查Jira地址是否正确 + +platform_plugin_not_exit=平台对接功能已插件化,请下载对应版本的插件: diff --git a/test-track/backend/src/main/resources/i18n/commons_zh_TW.properties b/test-track/backend/src/main/resources/i18n/commons_zh_TW.properties index b0ba487cae..cf3f689a8a 100644 --- a/test-track/backend/src/main/resources/i18n/commons_zh_TW.properties +++ b/test-track/backend/src/main/resources/i18n/commons_zh_TW.properties @@ -194,4 +194,6 @@ test_case_status_finished=已完成 execute_not_pass=未通過 execute_pass=通過 jira_auth_error=賬號名或密碼(Token)錯誤 -jira_auth_url_error=測試連接失敗,請檢查Jira地址是否正確 \ No newline at end of file +jira_auth_url_error=測試連接失敗,請檢查Jira地址是否正確 + +platform_plugin_not_exit=平臺對接功能已插件化,請下載對應版本的插件: