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 fit2-zhao
parent 5ca13e1aa6
commit 2cb2be704d
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.JSON;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.i18n.Translator;
import io.metersphere.log.utils.ReflexObjectUtil;
import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails;
@ -126,19 +127,26 @@ public class PluginService {
public void addPlugin(MultipartFile file, String scenario) {
checkPluginExist(file);
if (StringUtils.equalsIgnoreCase(scenario, PluginScenario.platform.name())) {
PluginWithBLOBs plugin = platformPluginService.addPlatformPlugin(file);
platformPluginService.notifiedPlatformPluginAdd(plugin.getId());
} else {
List<PluginWithBLOBs> plugins = apiPluginService.addApiPlugin(file);
plugins.forEach(this::addPlugin);
// 存入MinIO
if (CollectionUtils.isNotEmpty(plugins)) {
String pluginId = plugins.get(0).getPluginId();
FileRequest request = getRequest(pluginId);
fileManagerService.upload(file, request);
try {
if (StringUtils.equalsIgnoreCase(scenario, PluginScenario.platform.name())) {
PluginWithBLOBs plugin = platformPluginService.addPlatformPlugin(file);
platformPluginService.notifiedPlatformPluginAdd(plugin.getId());
} else {
List<PluginWithBLOBs> plugins = apiPluginService.addApiPlugin(file);
plugins.forEach(this::addPlugin);
// 存入MinIO
if (CollectionUtils.isNotEmpty(plugins)) {
String pluginId = plugins.get(0).getPluginId();
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) {

View File

@ -2,4 +2,5 @@ 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:
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=读取权限文件失败!
platform_plugin_not_exit=平台对接功能已插件化,请下载对应版本的插件:
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=讀取權限文件失敗!
platform_plugin_not_exit=平臺對接功能已插件化,請下載對應版本的插件:
workspace_name_exceeds_length_limit=工作空間名稱超出長度限制
platform_plugin_exit=插件已存在!
platform_plugin_exit=插件已存在!
plugin_parse_error=插件解析失敗!