diff --git a/jimureport-example/src/main/java/com/jeecg/modules/jmreport/config/JimuReportSysSwitchFilter.java b/jimureport-example/src/main/java/com/jeecg/modules/jmreport/config/JimuReportSysSwitchFilter.java new file mode 100644 index 0000000..56d6da9 --- /dev/null +++ b/jimureport-example/src/main/java/com/jeecg/modules/jmreport/config/JimuReportSysSwitchFilter.java @@ -0,0 +1,61 @@ +package com.jeecg.modules.jmreport.config; + +import org.springframework.stereotype.Component; + +import javax.servlet.*; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import java.io.IOException; + +/** + * 积木报表子系统切换处理类 + * @author chenrui + * @date 2024/10/31 11:33 + */ +@Component("jimuReportSwitchSysHandler") +public class JimuReportSysSwitchFilter implements Filter { + + // 包含积木报表 + boolean includeJimuReport = false; + // 包含积木仪表盘 + boolean includeJimuDrag = false; + + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + Filter.super.init(filterConfig); + // 判断是否包含积木报表 + try { + Class.forName("org.jeecg.modules.jmreport.config.JmReportBaseConfig"); + includeJimuReport = true; + } catch (ClassNotFoundException ignored) { + } + // 判断是否包含积木仪表盘 + try { + Class.forName("org.jeecg.modules.drag.service.IOnlDragCompService"); + includeJimuDrag = true; + } catch (ClassNotFoundException ignored) { + } + } + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { + if (request instanceof HttpServletRequest) { + HttpServletRequest httpRequest = (HttpServletRequest) request; + HttpSession session = httpRequest.getSession(); + if(includeJimuReport) { + session.setAttribute("switchJimuReport", "true"); + }else{ + session.setAttribute("switchJimuReport", "false"); + } + if(includeJimuDrag) { + session.setAttribute("switchJimuDrag", "true"); + }else { + session.setAttribute("switchJimuDrag", "false"); + } + } + chain.doFilter(request, response); + } + + +} diff --git a/jimureport-example/src/main/java/com/jeecg/modules/jmreport/config/JimuDragExternalServiceImpl.java b/jimureport-example/src/main/java/com/jeecg/modules/jmreport/extend/JimuDragExternalServiceImpl.java similarity index 97% rename from jimureport-example/src/main/java/com/jeecg/modules/jmreport/config/JimuDragExternalServiceImpl.java rename to jimureport-example/src/main/java/com/jeecg/modules/jmreport/extend/JimuDragExternalServiceImpl.java index 41b3349..3af6c9b 100644 --- a/jimureport-example/src/main/java/com/jeecg/modules/jmreport/config/JimuDragExternalServiceImpl.java +++ b/jimureport-example/src/main/java/com/jeecg/modules/jmreport/extend/JimuDragExternalServiceImpl.java @@ -1,4 +1,4 @@ -package com.jeecg.modules.jmreport.config; +package com.jeecg.modules.jmreport.extend; import com.alibaba.fastjson.JSONObject; import lombok.extern.slf4j.Slf4j; diff --git a/jimureport-example/src/main/java/com/jeecg/modules/jmreport/config/JimuReportTokenServiceImpl.java b/jimureport-example/src/main/java/com/jeecg/modules/jmreport/extend/JimuReportTokenServiceImpl.java similarity index 98% rename from jimureport-example/src/main/java/com/jeecg/modules/jmreport/config/JimuReportTokenServiceImpl.java rename to jimureport-example/src/main/java/com/jeecg/modules/jmreport/extend/JimuReportTokenServiceImpl.java index 667dcb0..0892d1f 100644 --- a/jimureport-example/src/main/java/com/jeecg/modules/jmreport/config/JimuReportTokenServiceImpl.java +++ b/jimureport-example/src/main/java/com/jeecg/modules/jmreport/extend/JimuReportTokenServiceImpl.java @@ -1,4 +1,4 @@ -package com.jeecg.modules.jmreport.config; +package com.jeecg.modules.jmreport.extend; import org.jeecg.modules.jmreport.api.JmReportTokenServiceI; import org.springframework.http.HttpHeaders;