fix(系统设置): 修复上传插件的在列表没有展示的缺陷

--bug=1024721 --user=王孝刚
【系统设置】github#23006,上传jmeter的jar提示上传成功,在日志中查询到上传成功,但是在列表中没有展示出来
https://www.tapd.cn/55049933/s/1354181
This commit is contained in:
wxg0103 2023-03-22 10:06:48 +08:00 committed by wxg0103
parent e1cc70d070
commit 931782a9e2
4 changed files with 25 additions and 14 deletions

View File

@ -11,6 +11,7 @@ import io.metersphere.commons.utils.BeanUtils;
import io.metersphere.commons.utils.FileUtils; import io.metersphere.commons.utils.FileUtils;
import io.metersphere.commons.utils.JSON; import io.metersphere.commons.utils.JSON;
import io.metersphere.commons.utils.LogUtil; import io.metersphere.commons.utils.LogUtil;
import io.metersphere.i18n.Translator;
import io.metersphere.log.utils.ReflexObjectUtil; import io.metersphere.log.utils.ReflexObjectUtil;
import io.metersphere.log.vo.DetailColumn; import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails; import io.metersphere.log.vo.OperatingLogDetails;
@ -126,19 +127,26 @@ public class PluginService {
public void addPlugin(MultipartFile file, String scenario) { public void addPlugin(MultipartFile file, String scenario) {
checkPluginExist(file); checkPluginExist(file);
if (StringUtils.equalsIgnoreCase(scenario, PluginScenario.platform.name())) { try {
PluginWithBLOBs plugin = platformPluginService.addPlatformPlugin(file); if (StringUtils.equalsIgnoreCase(scenario, PluginScenario.platform.name())) {
platformPluginService.notifiedPlatformPluginAdd(plugin.getId()); PluginWithBLOBs plugin = platformPluginService.addPlatformPlugin(file);
} else { platformPluginService.notifiedPlatformPluginAdd(plugin.getId());
List<PluginWithBLOBs> plugins = apiPluginService.addApiPlugin(file); } else {
plugins.forEach(this::addPlugin); List<PluginWithBLOBs> plugins = apiPluginService.addApiPlugin(file);
// 存入MinIO plugins.forEach(this::addPlugin);
if (CollectionUtils.isNotEmpty(plugins)) { // 存入MinIO
String pluginId = plugins.get(0).getPluginId(); if (CollectionUtils.isNotEmpty(plugins)) {
FileRequest request = getRequest(pluginId); String pluginId = plugins.get(0).getPluginId();
fileManagerService.upload(file, request); FileRequest request = getRequest(pluginId);
fileManagerService.upload(file, request);
} else {
MSException.throwException(Translator.get("plugin_parse_error"));
}
} }
} catch (Exception ex) {
MSException.throwException(Translator.get("plugin_parse_error"));
} }
} }
private FileRequest getRequest(String pluginId) { private FileRequest getRequest(String pluginId) {

View File

@ -2,4 +2,5 @@ error_lang_invalid=Invalid language parameter, new
read_permission_file_fail=Failed to read permission file! 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: platform_plugin_not_exit=Platform docking function has been plug-in, please download the corresponding version of the plug-in:
workspace_name_exceeds_length_limit=Workspace name exceeds length limit workspace_name_exceeds_length_limit=Workspace name exceeds length limit
platform_plugin_exit=plugin is already exist! platform_plugin_exit=plugin is already exist!
plugin_parse_error=Plugin parse error

View File

@ -2,4 +2,5 @@ error_lang_invalid=语言参数错误, 新
read_permission_file_fail=读取权限文件失败! read_permission_file_fail=读取权限文件失败!
platform_plugin_not_exit=平台对接功能已插件化,请下载对应版本的插件: platform_plugin_not_exit=平台对接功能已插件化,请下载对应版本的插件:
workspace_name_exceeds_length_limit=工作空间名称超出长度限制 workspace_name_exceeds_length_limit=工作空间名称超出长度限制
platform_plugin_exit=插件已存在! platform_plugin_exit=插件已存在!
plugin_parse_error=插件解析失败

View File

@ -2,4 +2,5 @@ error_lang_invalid=語言參數錯誤,新
read_permission_file_fail=讀取權限文件失敗! read_permission_file_fail=讀取權限文件失敗!
platform_plugin_not_exit=平臺對接功能已插件化,請下載對應版本的插件: platform_plugin_not_exit=平臺對接功能已插件化,請下載對應版本的插件:
workspace_name_exceeds_length_limit=工作空間名稱超出長度限制 workspace_name_exceeds_length_limit=工作空間名稱超出長度限制
platform_plugin_exit=插件已存在! platform_plugin_exit=插件已存在!
plugin_parse_error=插件解析失敗!