From f1655d72309eaf006013f1f7579d973a7d4b5e86 Mon Sep 17 00:00:00 2001 From: "Yangkai.Shen" <237497819@qq.com> Date: Mon, 26 Oct 2020 23:22:59 +0800 Subject: [PATCH] =?UTF-8?q?:construction:=20ureport2=20=E6=AD=A3=E5=9C=A8?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo-ureport2/README.md | 53 +++++++++ demo-ureport2/pom.xml | 106 +++++++++++------- .../ureport2/config/InnerDatasource.java | 34 ++++++ .../src/main/resources/application.properties | 0 .../src/main/resources/application.yml | 16 +++ 5 files changed, 168 insertions(+), 41 deletions(-) create mode 100644 demo-ureport2/README.md create mode 100644 demo-ureport2/src/main/java/com/xkcoding/ureport2/config/InnerDatasource.java delete mode 100644 demo-ureport2/src/main/resources/application.properties create mode 100644 demo-ureport2/src/main/resources/application.yml diff --git a/demo-ureport2/README.md b/demo-ureport2/README.md new file mode 100644 index 0000000..90a6619 --- /dev/null +++ b/demo-ureport2/README.md @@ -0,0 +1,53 @@ +UReport2 是一款基于架构在 Spring 之上纯 Java 的高性能报表引擎,通过迭代单元格可以实现任意复杂的中国式报表。 在 UReport2 中,提供了全新的基于网页的报表设计器,可以在 Chrome、Firefox、Edge 等各种主流浏览器运行(IE 浏览器除外)。使用 UReport2,打开浏览器即可完成各种复杂报表的设计制作 + +[https://www.w3cschool.cn/ureport](https://www.w3cschool.cn/ureport) + +## 单机使用 + +- 1. 引入 jar 依赖 + +```xml + + + com.pig4cloud.plugin + ureport-spring-boot-starter + 0.0.1 + +``` + +- application.properties 配置本地文件保存路径 + +```properties +ureport.debug=false +ureport.disableFileProvider=false +ureport.fileStoreDir=/Users/lengleng/Downloads +ureport.disableHttpSessionReportCache=true +``` +- 访问 报表设计器 + +http://127.0.0.1:8080/ureport/designer + +## 集群使用 + +如上文设计好的模板是保存在服务本机的,在集群环境中需要使用统一的文件系统存储。新增依赖 + +```xml + + + com.pig4cloud.plugin + oss-spring-boot-starter + 0.0.3 + +``` + +- 仅需配置云存储相关参数, 演示为minio + +``` +oss.access-key=lengleng +oss.secret-key=lengleng +oss.bucket-name=lengleng +oss.endpoint=http://minio.pig4cloud.com +``` + +关于 [oss-spring-boot-starter ](https://github.com/pig-mesh/oss-spring-boot-starter)使用可参考,兼容所有 S3 协议的分布式文件存储系统 +关于 [ureport-spring-boot-starter ](https://github.com/pig-mesh/ureport-spring-boot-starter)使用可参考,UReport2 的 spring boot 封装 diff --git a/demo-ureport2/pom.xml b/demo-ureport2/pom.xml index 2ed520c..8976d39 100644 --- a/demo-ureport2/pom.xml +++ b/demo-ureport2/pom.xml @@ -1,48 +1,72 @@ - 4.0.0 + 4.0.0 - demo-ureport2 + demo-ureport2 + 1.0.0-SNAPSHOT + jar + + demo-ureport2 + Demo project for Spring Boot + + + com.xkcoding + spring-boot-demo 1.0.0-SNAPSHOT - jar - - demo-ureport2 - Demo project for Spring Boot - - - com.xkcoding - spring-boot-demo - 1.0.0-SNAPSHOT - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - demo-ureport2 - - - org.springframework.boot - spring-boot-maven-plugin - - - + + + + UTF-8 + UTF-8 + 1.8 + + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + + mysql + mysql-connector-java + + + + + com.pig4cloud.plugin + ureport-spring-boot-starter + 0.0.1 + + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.projectlombok + lombok + true + + + + + demo-ureport2 + + + org.springframework.boot + spring-boot-maven-plugin + + + diff --git a/demo-ureport2/src/main/java/com/xkcoding/ureport2/config/InnerDatasource.java b/demo-ureport2/src/main/java/com/xkcoding/ureport2/config/InnerDatasource.java new file mode 100644 index 0000000..6ecf0fa --- /dev/null +++ b/demo-ureport2/src/main/java/com/xkcoding/ureport2/config/InnerDatasource.java @@ -0,0 +1,34 @@ +package com.xkcoding.ureport2.config; + +import com.bstek.ureport.definition.datasource.BuildinDatasource; +import lombok.SneakyThrows; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.sql.DataSource; +import java.sql.Connection; + +/** + *

+ * 内部数据源 + *

+ * + * @author yangkai.shen + * @date Created in 2020-10-26 22:32 + */ +@Component +public class InnerDatasource implements BuildinDatasource { + @Autowired + private DataSource datasource; + + @Override + public String name() { + return "内部数据源"; + } + + @SneakyThrows + @Override + public Connection getConnection() { + return datasource.getConnection(); + } +} diff --git a/demo-ureport2/src/main/resources/application.properties b/demo-ureport2/src/main/resources/application.properties deleted file mode 100644 index e69de29..0000000 diff --git a/demo-ureport2/src/main/resources/application.yml b/demo-ureport2/src/main/resources/application.yml new file mode 100644 index 0000000..811024f --- /dev/null +++ b/demo-ureport2/src/main/resources/application.yml @@ -0,0 +1,16 @@ +server: + port: 8080 + servlet: + context-path: /demo +spring: + datasource: + 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 + username: root + password: root + driver-class-name: com.mysql.cj.jdbc.Driver +ureport: + debug: false + disableFileProvider: false + disableHttpSessionReportCache: true + # 单机模式,路径需要提前创建 + fileStoreDir: '/Users/yangkai.shen/Desktop/ureport2' -- GitLab