refactor(项目管理): 菜单管理获取插件脚本修改

This commit is contained in:
WangXu10 2023-11-01 18:05:45 +08:00 committed by Craftsman
parent b6bb29e47d
commit 26ebc94b79
4 changed files with 21 additions and 5 deletions

View File

@ -6,6 +6,8 @@ public abstract class AbstractPlatformPlugin extends AbstractMsPlugin {
private static final String DEFAULT_INTEGRATION_SCRIPT_ID = "integration";
private static final String DEFAULT_PROJECT_SCRIPT_ID = "project";
private static final String DEFAULT_ACCOUNT_SCRIPT_ID = "account";
private static final String PROJECT_BUG_SCRIPT_ID = "project_bug";
private static final String PROJECT_DEMAND_SCRIPT_ID = "project_demand";
/**
* 返回插件的描述信息
@ -42,4 +44,12 @@ public abstract class AbstractPlatformPlugin extends AbstractMsPlugin {
public String getAccountScriptId() {
return DEFAULT_ACCOUNT_SCRIPT_ID;
}
public String getProjectBugScriptId() {
return PROJECT_BUG_SCRIPT_ID;
}
public String getProjectDemandScriptId() {
return PROJECT_DEMAND_SCRIPT_ID;
}
}

View File

@ -197,7 +197,7 @@ public class ProjectApplicationController {
@Operation(summary = "用例管理-选择平台获取平台信息")
@RequiresPermissions(PermissionConstants.PROJECT_APPLICATION_CASE_READ)
public Object getCasePlatformInfo(@PathVariable String pluginId) {
return projectApplicationService.getPluginScript(pluginId);
return projectApplicationService.getDemandPluginScript(pluginId);
}
@ -276,7 +276,7 @@ public class ProjectApplicationController {
@Operation(summary = "缺陷管理-选择平台获取平台信息")
@RequiresPermissions(PermissionConstants.PROJECT_APPLICATION_BUG_READ)
public Object getBugPlatformInfo(@PathVariable String pluginId) {
return projectApplicationService.getPluginScript(pluginId);
return projectApplicationService.getBugPluginScript(pluginId);
}

View File

@ -212,10 +212,16 @@ public class ProjectApplicationService {
return options;
}
public Object getPluginScript(String pluginId) {
public Object getBugPluginScript(String pluginId) {
this.checkResourceExist(pluginId);
AbstractPlatformPlugin platformPlugin = (AbstractPlatformPlugin) pluginLoadService.getMsPluginManager().getPlugin(pluginId).getPlugin();
return pluginLoadService.getPluginScriptContent(pluginId, platformPlugin.getProjectScriptId());
return pluginLoadService.getPluginScriptContent(pluginId, platformPlugin.getProjectBugScriptId());
}
public Object getDemandPluginScript(String pluginId) {
this.checkResourceExist(pluginId);
AbstractPlatformPlugin platformPlugin = (AbstractPlatformPlugin) pluginLoadService.getMsPluginManager().getPlugin(pluginId).getPlugin();
return pluginLoadService.getPluginScriptContent(pluginId, platformPlugin.getProjectDemandScriptId());
}
private Plugin checkResourceExist(String id) {
@ -378,7 +384,7 @@ public class ProjectApplicationService {
module,
content);
dto.setOriginalValue(JSON.toJSONBytes(list));
return dto;
return dto;
}