mirror of
https://github.com/jeecgboot/JimuReport.git
synced 2025-08-29 09:30:52 +00:00
Compare commits
5 Commits
d4bb731f40
...
6501f59096
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6501f59096 | ||
![]() |
c3c8dcd217 | ||
![]() |
e1891922a0 | ||
![]() |
9ee6935a15 | ||
![]() |
346db0ab56 |
17
README.md
17
README.md
@@ -1,10 +1,10 @@
|
||||
# JimuReport积木报表(免费报表工具)
|
||||
|
||||
v2.0.0 | 2025-06-09
|
||||
v2.1.0 | 2025-07-07
|
||||
|
||||
|
||||
[](https://qiaoqiaoyun.com/aboutUs)
|
||||
[](https://github.com/jeecgboot/JimuReport)
|
||||
[](https://github.com/jeecgboot/JimuReport)
|
||||
[](http://jimureport.com)
|
||||
[](https://github.com/jeecgboot/JimuReport)
|
||||
[](https://github.com/jeecgboot/JimuReport)
|
||||
@@ -51,12 +51,19 @@ v2.0.0 | 2025-06-09
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.jimureport</groupId>
|
||||
<artifactId>jimureport-spring-boot-starter</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<version>2.1.0</version>
|
||||
</dependency>
|
||||
<!-- mongo、redis和文件数据集支持包,按需引入 -->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.jimureport</groupId>
|
||||
<artifactId>jimureport-nosql-starter</artifactId>
|
||||
<version>1.9.5.2</version>
|
||||
<version>2.0.0</version>
|
||||
</dependency>
|
||||
<!-- 后台导出接口Echart图表支持包,按需引入 -->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.jimureport</groupId>
|
||||
<artifactId>jimureport-echarts-starter</artifactId>
|
||||
<version>2.1.0</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
@@ -71,7 +78,7 @@ v2.0.0 | 2025-06-09
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.jimureport</groupId>
|
||||
<artifactId>jimureport-nosql-starter</artifactId>
|
||||
<version>1.9.5.2</version>
|
||||
<version>2.0.0</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
|
@@ -10,6 +10,6 @@ WORKDIR /jimureport
|
||||
|
||||
EXPOSE 8085
|
||||
|
||||
ADD ./target/jimureport-example-2.0.jar ./
|
||||
ADD ./target/jimureport-example-2.1.jar ./
|
||||
|
||||
CMD java -DMYSQL-HOST=jimureport-mysql -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jimureport-example-2.0.jar
|
||||
CMD java -DMYSQL-HOST=jimureport-mysql -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jimureport-example-2.1.jar
|
3261
jimureport-example/db/jimureport.mysql5.7.create.batchInsert.sql
Normal file
3261
jimureport-example/db/jimureport.mysql5.7.create.batchInsert.sql
Normal file
File diff suppressed because one or more lines are too long
@@ -12,7 +12,7 @@
|
||||
<name>jimureport-example</name>
|
||||
<groupId>org.jeecg</groupId>
|
||||
<artifactId>jimureport-example</artifactId>
|
||||
<version>2.0</version>
|
||||
<version>2.1</version>
|
||||
|
||||
<url>http://www.jimureport.com</url>
|
||||
<description>积木报表集成示例</description>
|
||||
@@ -65,13 +65,19 @@
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.jimureport</groupId>
|
||||
<artifactId>jimureport-spring-boot-starter</artifactId>
|
||||
<version>2.0.0.1</version>
|
||||
<version>2.1.0</version>
|
||||
</dependency>
|
||||
<!-- 积木报表扩展包 csv excel json mogodb redis数据集支持 -->
|
||||
<!-- mongo、redis和文件数据集支持包,按需引入 -->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.jimureport</groupId>
|
||||
<artifactId>jimureport-nosql-starter</artifactId>
|
||||
<version>1.9.5.2</version>
|
||||
<version>2.0.0</version>
|
||||
</dependency>
|
||||
<!-- 后台导出接口Echart图表支持包,按需引入 -->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.jimureport</groupId>
|
||||
<artifactId>jimureport-echarts-starter</artifactId>
|
||||
<version>2.1.0</version>
|
||||
</dependency>
|
||||
<!-- 积木BI大屏 -->
|
||||
<dependency>
|
||||
|
@@ -11,14 +11,19 @@ import org.springframework.core.env.Environment;
|
||||
* 积木报表独立服务启动类
|
||||
*/
|
||||
@SpringBootApplication(scanBasePackages = {"org.jeecg", "com.jeecg"})
|
||||
@EnableAutoConfiguration(exclude = {MongoAutoConfiguration.class})
|
||||
@EnableAutoConfiguration(exclude={MongoAutoConfiguration.class})
|
||||
public class JimuReportApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
ConfigurableApplicationContext application = SpringApplication.run(JimuReportApplication.class, args);
|
||||
Environment env = application.getEnvironment();
|
||||
String port = env.getProperty("server.port");
|
||||
String path = env.containsProperty("server.servlet.context-path") ? env.getProperty("server.servlet.context-path") : "";
|
||||
String path = env.containsProperty("server.servlet.context-path")?env.getProperty("server.servlet.context-path"):"";
|
||||
String currentEncoding = System.getProperty("file.encoding", "UTF-8");
|
||||
if(!currentEncoding.equalsIgnoreCase("UTF-8")){
|
||||
// 默认编码不是UTF-8设置为UTF-8
|
||||
System.setProperty("file.encoding", "UTF-8");
|
||||
}
|
||||
System.out.println("\n----------------------------------------------------------\n\t" +
|
||||
"JimuReport 积木报表平台 is running! Access URL:\n\t" +
|
||||
"报表工作台: \t\thttp://localhost:" + port + path + "/jmreport/list\n\t" +
|
||||
|
@@ -21,9 +21,9 @@ public class ApiSecurityConfigFilter implements Filter {
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
|
||||
HttpServletRequest req = (HttpServletRequest) request;
|
||||
String loginFrom = req.getHeader("jm_login_from");
|
||||
if(OkConvertUtils.isNotEmpty(loginFrom)){
|
||||
if(null != loginFrom && !loginFrom.isEmpty()){
|
||||
String springSecurityContext = req.getHeader("jm_spring_security_context");
|
||||
if(OkConvertUtils.isNotEmpty(springSecurityContext)){
|
||||
if(null != springSecurityContext && !springSecurityContext.isEmpty()){
|
||||
SecurityContextImpl securityContext = JSONObject.parseObject(springSecurityContext, SecurityContextImpl.class);
|
||||
HttpSession session = req.getSession();
|
||||
session.setAttribute("loginFrom", loginFrom);
|
||||
|
@@ -1,13 +1,17 @@
|
||||
package com.jeecg.modules.jmreport.config;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
|
||||
import org.springframework.security.web.savedrequest.SavedRequest;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
/**
|
||||
* 自定义springsecurity登录成功处理
|
||||
@@ -15,6 +19,7 @@ import java.io.IOException;
|
||||
* @author chenrui
|
||||
* @date 2024/8/2 16:26
|
||||
*/
|
||||
@Slf4j
|
||||
public class CustomLoginSuccessHandler extends SavedRequestAwareAuthenticationSuccessHandler {
|
||||
|
||||
@Override
|
||||
@@ -22,6 +27,27 @@ public class CustomLoginSuccessHandler extends SavedRequestAwareAuthenticationSu
|
||||
Authentication authentication) throws IOException, ServletException {
|
||||
HttpSession session = request.getSession();
|
||||
session.setAttribute("loginFrom", "jimu_example");
|
||||
super.onAuthenticationSuccess(request, response, authentication);
|
||||
|
||||
SavedRequest savedRequest = (SavedRequest) session.getAttribute("SPRING_SECURITY_SAVED_REQUEST");
|
||||
String redirectUrl = savedRequest != null ? savedRequest.getRedirectUrl() : null;
|
||||
|
||||
if (redirectUrl != null) {
|
||||
try {
|
||||
URI uri = new URI(redirectUrl);
|
||||
String path = uri.getPath(); // 提取路径部分
|
||||
|
||||
if (path != null && path.startsWith("/jmreport")) {
|
||||
// 路径符合要求,执行默认跳转
|
||||
super.onAuthenticationSuccess(request, response, authentication);
|
||||
return;
|
||||
}
|
||||
} catch (URISyntaxException e) {
|
||||
// URL解析失败,打印日志后继续执行默认跳转
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
// 不符合 /jmreport 开头,或 redirectUrl 为 null 或异常
|
||||
response.sendRedirect("/");
|
||||
}
|
||||
}
|
@@ -60,6 +60,7 @@ public class SpringSecurityConfig {
|
||||
"/jmreport/show",
|
||||
"/jmreport/form/submit",
|
||||
"/jmreport/form/repeat/check/**",
|
||||
"/jmreport/exportReport",
|
||||
"/jmreport/addViewCount/**").permitAll()
|
||||
// 仪表盘分享页面
|
||||
.antMatchers("/jimubi/share/view/**",
|
||||
|
@@ -21,7 +21,7 @@ public class ViewPageCustomAccess {
|
||||
|
||||
public boolean check(HttpServletRequest request, Authentication authentication) {
|
||||
Object principal = authentication.getPrincipal();
|
||||
if (OkConvertUtils.isEmpty(principal) || "anonymousUser".equalsIgnoreCase(principal.toString())) {
|
||||
if (null == principal || principal.toString().isEmpty() || "anonymousUser".equalsIgnoreCase(principal.toString())) {
|
||||
// 未登录
|
||||
if (openViewPage) {
|
||||
// 配置文件设置了开放view页面
|
||||
@@ -30,7 +30,8 @@ public class ViewPageCustomAccess {
|
||||
HttpServletRequest httpRequest = (HttpServletRequest) request;
|
||||
String previousPage = httpRequest.getParameter("previousPage");
|
||||
String jmLink = httpRequest.getParameter("jmLink");
|
||||
if (OkConvertUtils.isNotEmpty(previousPage) && OkConvertUtils.isNotEmpty(jmLink) ) {
|
||||
if (null != previousPage && !previousPage.isEmpty()
|
||||
&& null != jmLink && !jmLink.isEmpty()) {
|
||||
// 参数中有previousPage和jmLink
|
||||
return true;
|
||||
}
|
||||
|
@@ -1,8 +1,12 @@
|
||||
package com.jeecg.modules.jmreport.extend;
|
||||
|
||||
import org.jeecg.modules.jmreport.api.JmReportTokenServiceI;
|
||||
import org.jeecg.modules.jmreport.common.constant.JmConst;
|
||||
import org.jeecg.modules.jmreport.common.util.JimuSpringContextUtils;
|
||||
import org.jeecg.modules.jmreport.common.util.OkConvertUtils;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
@@ -20,31 +24,11 @@ public class JimuReportTokenServiceImpl implements JmReportTokenServiceI {
|
||||
*/
|
||||
@Override
|
||||
public String getToken(HttpServletRequest request) {
|
||||
//System.out.println("---------call---------getToken-----------------------");
|
||||
//System.out.println("---------call---------getToken-----------------------");
|
||||
//return TokenUtils.getTokenByRequest(request);
|
||||
return "123456";
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义获取租户
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getTenantId() {
|
||||
// String headerTenantId = null;
|
||||
// HttpServletRequest request = JimuSpringContextUtils.getHttpServletRequest();
|
||||
// if (request != null) {
|
||||
// headerTenantId = request.getHeader(JmConst.HEADER_TENANT_ID);
|
||||
// if(OkConvertUtils.isEmpty(headerTenantId)){
|
||||
// headerTenantId = request.getParameter(JmConst.TENANT_ID);
|
||||
// }
|
||||
// }
|
||||
// return headerTenantId;
|
||||
return "1";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过Token获取登录人用户名
|
||||
* @param token
|
||||
@@ -58,7 +42,7 @@ public class JimuReportTokenServiceImpl implements JmReportTokenServiceI {
|
||||
|
||||
/**
|
||||
* 自定义用户拥有的角色
|
||||
*
|
||||
*
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
@@ -83,7 +67,7 @@ public class JimuReportTokenServiceImpl implements JmReportTokenServiceI {
|
||||
//drag:design:getTotalData 仪表盘对Online表单展示数据
|
||||
return new String[]{"drag:datasource:testConnection","onl:drag:clear:recovery","drag:analysis:sql","drag:design:getTotalData"};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Token校验
|
||||
* @param token
|
||||
@@ -107,4 +91,26 @@ public class JimuReportTokenServiceImpl implements JmReportTokenServiceI {
|
||||
header.add("token", "token value 2");
|
||||
return header;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义获取租户
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getTenantId() {
|
||||
String headerTenantId = null;
|
||||
HttpServletRequest request = JimuSpringContextUtils.getHttpServletRequest();
|
||||
if (request != null) {
|
||||
headerTenantId = request.getHeader(JmConst.HEADER_TENANT_KEY);
|
||||
if(OkConvertUtils.isEmpty(headerTenantId)){
|
||||
headerTenantId = request.getHeader(JmConst.HEADER_TENANT_ID);
|
||||
}
|
||||
if(OkConvertUtils.isEmpty(headerTenantId)){
|
||||
headerTenantId = request.getParameter(JmConst.TENANT_ID);
|
||||
}
|
||||
}
|
||||
//return headerTenantId;
|
||||
return null;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user