From 2906309b90f43dde42c7395d6ff0e1ef0d1dab6b Mon Sep 17 00:00:00 2001 From: Anner Date: Mon, 21 Oct 2024 12:01:15 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-130954=20fix:=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=90=AF=E5=8A=A8=E5=B1=8F=E8=94=BD=E4=B8=8D=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adaptation/DesignServerSupportModule.java | 62 +++++++++++++++++++ .../adaptation/ReportAdaptationComponent.java | 5 +- 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 designer-realize/src/main/java/com/fanruan/boot/adaptation/DesignServerSupportModule.java diff --git a/designer-realize/src/main/java/com/fanruan/boot/adaptation/DesignServerSupportModule.java b/designer-realize/src/main/java/com/fanruan/boot/adaptation/DesignServerSupportModule.java new file mode 100644 index 0000000000..df486b1d72 --- /dev/null +++ b/designer-realize/src/main/java/com/fanruan/boot/adaptation/DesignServerSupportModule.java @@ -0,0 +1,62 @@ +package com.fanruan.boot.adaptation; + +import com.fanruan.portal.module.PortalModuleManager; +import com.fr.third.guava.collect.Sets; + +import java.util.Optional; +import java.util.Set; + +import static com.fanruan.portal.authority.PortalAuthorityItems.ENTERPRISE_GENERAL_ID; +import static com.fanruan.portal.authority.PortalAuthorityItems.ENTERPRISE_ID; +import static com.fanruan.portal.authority.PortalAuthorityItems.MAP_ID; +import static com.fanruan.portal.authority.PortalAuthorityItems.PORTAL_MANAGEMENT_ID; +import static com.fanruan.portal.authority.PortalAuthorityItems.SECURITY_ID; + +/** + * 内置服务器支持展示的模块,预期调用顺序在业务模块之后 + * + * @author Anner + * @since 11.0 + * Created on 2024/10/15 + */ +public class DesignServerSupportModule { + private final static Set SUPPORT_MODULE = Sets.newHashSet( + // 系统管理 + PORTAL_MANAGEMENT_ID, + // 企业设置 + ENTERPRISE_ID, + // 企业设置 - 通用设置 + ENTERPRISE_GENERAL_ID, + // 安全管理 + SECURITY_ID, + // 地图管理 + MAP_ID + ); + + /** + * 注册一下支持展示的模块 + * + * @param moduleName name + */ + public static void register(String moduleName) { + Optional.of(moduleName).ifPresent(SUPPORT_MODULE::add); + } + + /** + * 取消注册展示的模块 + * + * @param moduleName name + */ + public static void unregister(String moduleName) { + Optional.of(moduleName).ifPresent(SUPPORT_MODULE::remove); + } + + /** + * 启动入口,重建一下展示的module + */ + public static void rebuild() { + PortalModuleManager.allModules().keySet().stream() + .filter(m -> !SUPPORT_MODULE.contains(m)) + .forEach(PortalModuleManager::unregister); + } +} diff --git a/designer-realize/src/main/java/com/fanruan/boot/adaptation/ReportAdaptationComponent.java b/designer-realize/src/main/java/com/fanruan/boot/adaptation/ReportAdaptationComponent.java index d09e3db108..7a1a90af3d 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/adaptation/ReportAdaptationComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/adaptation/ReportAdaptationComponent.java @@ -1,6 +1,7 @@ package com.fanruan.boot.adaptation; import com.fanruan.carina.Carina; +import com.fanruan.carina.annotions.DependsOn; import com.fanruan.carina.annotions.FineComponent; import com.fanruan.carina.annotions.Start; import com.fanruan.plugins.resource.PluginResourceHelper; @@ -57,8 +58,8 @@ import java.util.TreeSet; * Created on 2024/6/24 */ @FineComponent(name = "fine_report_adaptation") +@DependsOn(dependencies = {"fine_report"}) public class ReportAdaptationComponent { - /** * 启动 */ @@ -74,6 +75,8 @@ public class ReportAdaptationComponent { // 插件controller注册 PluginControllerManager.getInstance().init(); + // 过滤掉内置服务器不支持的模块 + DesignServerSupportModule.rebuild(); } private void listenEmbedServletFilter(ServletContext servletContext) {