Skip to content

Commit f1655d7

Browse files
committed
🚧 ureport2 正在进行中
1 parent 45bcd49 commit f1655d7

File tree

5 files changed

+168
-41
lines changed

5 files changed

+168
-41
lines changed

demo-ureport2/README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
UReport2 是一款基于架构在 Spring 之上纯 Java 的高性能报表引擎,通过迭代单元格可以实现任意复杂的中国式报表。 在 UReport2 中,提供了全新的基于网页的报表设计器,可以在 Chrome、Firefox、Edge 等各种主流浏览器运行(IE 浏览器除外)。使用 UReport2,打开浏览器即可完成各种复杂报表的设计制作
2+
3+
[https://www.w3cschool.cn/ureport](https://www.w3cschool.cn/ureport)
4+
5+
## 单机使用
6+
7+
- 1. 引入 jar 依赖
8+
9+
```xml
10+
11+
<dependency>
12+
<groupId>com.pig4cloud.plugin</groupId>
13+
<artifactId>ureport-spring-boot-starter</artifactId>
14+
<version>0.0.1</version>
15+
</dependency>
16+
```
17+
18+
- application.properties 配置本地文件保存路径
19+
20+
```properties
21+
ureport.debug=false
22+
ureport.disableFileProvider=false
23+
ureport.fileStoreDir=/Users/lengleng/Downloads
24+
ureport.disableHttpSessionReportCache=true
25+
```
26+
- 访问 报表设计器
27+
28+
http://127.0.0.1:8080/ureport/designer
29+
30+
## 集群使用
31+
32+
如上文设计好的模板是保存在服务本机的,在集群环境中需要使用统一的文件系统存储。新增依赖
33+
34+
```xml
35+
36+
<dependency>
37+
<groupId>com.pig4cloud.plugin</groupId>
38+
<artifactId>oss-spring-boot-starter</artifactId>
39+
<version>0.0.3</version>
40+
</dependency>
41+
```
42+
43+
- 仅需配置云存储相关参数, 演示为minio
44+
45+
```
46+
oss.access-key=lengleng
47+
oss.secret-key=lengleng
48+
oss.bucket-name=lengleng
49+
oss.endpoint=http://minio.pig4cloud.com
50+
```
51+
52+
关于 [oss-spring-boot-starter ](https://github.com/pig-mesh/oss-spring-boot-starter)使用可参考,兼容所有 S3 协议的分布式文件存储系统
53+
关于 [ureport-spring-boot-starter ](https://github.com/pig-mesh/ureport-spring-boot-starter)使用可参考,UReport2 的 spring boot 封装

demo-ureport2/pom.xml

Lines changed: 65 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,72 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
33
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4-
<modelVersion>4.0.0</modelVersion>
4+
<modelVersion>4.0.0</modelVersion>
55

6-
<artifactId>demo-ureport2</artifactId>
6+
<artifactId>demo-ureport2</artifactId>
7+
<version>1.0.0-SNAPSHOT</version>
8+
<packaging>jar</packaging>
9+
10+
<name>demo-ureport2</name>
11+
<description>Demo project for Spring Boot</description>
12+
13+
<parent>
14+
<groupId>com.xkcoding</groupId>
15+
<artifactId>spring-boot-demo</artifactId>
716
<version>1.0.0-SNAPSHOT</version>
8-
<packaging>jar</packaging>
9-
10-
<name>demo-ureport2</name>
11-
<description>Demo project for Spring Boot</description>
12-
13-
<parent>
14-
<groupId>com.xkcoding</groupId>
15-
<artifactId>spring-boot-demo</artifactId>
16-
<version>1.0.0-SNAPSHOT</version>
17-
</parent>
18-
19-
<properties>
20-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
21-
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
22-
<java.version>1.8</java.version>
23-
</properties>
24-
25-
<dependencies>
26-
<dependency>
27-
<groupId>org.springframework.boot</groupId>
28-
<artifactId>spring-boot-starter</artifactId>
29-
</dependency>
30-
31-
<dependency>
32-
<groupId>org.springframework.boot</groupId>
33-
<artifactId>spring-boot-starter-test</artifactId>
34-
<scope>test</scope>
35-
</dependency>
36-
</dependencies>
37-
38-
<build>
39-
<finalName>demo-ureport2</finalName>
40-
<plugins>
41-
<plugin>
42-
<groupId>org.springframework.boot</groupId>
43-
<artifactId>spring-boot-maven-plugin</artifactId>
44-
</plugin>
45-
</plugins>
46-
</build>
17+
</parent>
18+
19+
<properties>
20+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
21+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
22+
<java.version>1.8</java.version>
23+
</properties>
24+
25+
<dependencies>
26+
<!--web 依赖-->
27+
<dependency>
28+
<groupId>org.springframework.boot</groupId>
29+
<artifactId>spring-boot-starter-web</artifactId>
30+
</dependency>
31+
32+
<dependency>
33+
<groupId>org.springframework.boot</groupId>
34+
<artifactId>spring-boot-starter-data-jpa</artifactId>
35+
</dependency>
36+
37+
<dependency>
38+
<groupId>mysql</groupId>
39+
<artifactId>mysql-connector-java</artifactId>
40+
</dependency>
41+
42+
<!--ureport 依赖-->
43+
<dependency>
44+
<groupId>com.pig4cloud.plugin</groupId>
45+
<artifactId>ureport-spring-boot-starter</artifactId>
46+
<version>0.0.1</version>
47+
</dependency>
48+
49+
<dependency>
50+
<groupId>org.springframework.boot</groupId>
51+
<artifactId>spring-boot-starter-test</artifactId>
52+
<scope>test</scope>
53+
</dependency>
54+
55+
<dependency>
56+
<groupId>org.projectlombok</groupId>
57+
<artifactId>lombok</artifactId>
58+
<optional>true</optional>
59+
</dependency>
60+
</dependencies>
61+
62+
<build>
63+
<finalName>demo-ureport2</finalName>
64+
<plugins>
65+
<plugin>
66+
<groupId>org.springframework.boot</groupId>
67+
<artifactId>spring-boot-maven-plugin</artifactId>
68+
</plugin>
69+
</plugins>
70+
</build>
4771

4872
</project>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.xkcoding.ureport2.config;
2+
3+
import com.bstek.ureport.definition.datasource.BuildinDatasource;
4+
import lombok.SneakyThrows;
5+
import org.springframework.beans.factory.annotation.Autowired;
6+
import org.springframework.stereotype.Component;
7+
8+
import javax.sql.DataSource;
9+
import java.sql.Connection;
10+
11+
/**
12+
* <p>
13+
* 内部数据源
14+
* </p>
15+
*
16+
* @author yangkai.shen
17+
* @date Created in 2020-10-26 22:32
18+
*/
19+
@Component
20+
public class InnerDatasource implements BuildinDatasource {
21+
@Autowired
22+
private DataSource datasource;
23+
24+
@Override
25+
public String name() {
26+
return "内部数据源";
27+
}
28+
29+
@SneakyThrows
30+
@Override
31+
public Connection getConnection() {
32+
return datasource.getConnection();
33+
}
34+
}

demo-ureport2/src/main/resources/application.properties

Whitespace-only changes.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
server:
2+
port: 8080
3+
servlet:
4+
context-path: /demo
5+
spring:
6+
datasource:
7+
url: jdbc:mysql://127.0.0.1:3306/spring-boot-demo?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&failOverReadOnly=false&serverTimezone=GMT%2B8
8+
username: root
9+
password: root
10+
driver-class-name: com.mysql.cj.jdbc.Driver
11+
ureport:
12+
debug: false
13+
disableFileProvider: false
14+
disableHttpSessionReportCache: true
15+
# 单机模式,路径需要提前创建
16+
fileStoreDir: '/Users/yangkai.shen/Desktop/ureport2'

0 commit comments

Comments
 (0)