迁移自定义扩展位置

pull/3102/head
JEECG 2024-10-31 15:58:14 +08:00
parent 9a890341e2
commit d68bc65b90
3 changed files with 63 additions and 2 deletions

View File

@ -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);
}
}

View File

@ -1,4 +1,4 @@
package com.jeecg.modules.jmreport.config; package com.jeecg.modules.jmreport.extend;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;

View File

@ -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.jeecg.modules.jmreport.api.JmReportTokenServiceI;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;