Compare commits

1 Commits
main ... master

Author SHA1 Message Date
wangmingwei
1f23450530 初始代码 2026-04-21 17:23:02 +08:00
56 changed files with 4237 additions and 0 deletions

76
.gitignore vendored Normal file
View File

@@ -0,0 +1,76 @@
# For Java
*.lck
target/
*.json
log/
logback-test.xml
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
# Image snapshot diff
__diff_output__/
/jest-stare
*.iml
.idea/
.ipr
.iws
*~
~*
*.diff
*.patch
*.bak
.DS_Store
Thumbs.db
.project
.*proj
.svn/
*.swp
*.swo
*.log
*.log.*
*.json.gzip
node_modules/
.buildpath
.settings
dist
npm-debug.log
nohup.out
_site
_data
report.html
/lib
/es
elasticsearch-*
config/base.yaml
/.vscode/
/coverage
/.history
*.tmp
!**/nacos/target
**/nacos/data/*
**/nacos/logs/*
**/seata/bin/*

22
Dockerfile Normal file
View File

@@ -0,0 +1,22 @@
# 基础镜像
FROM bellsoft/liberica-openjre-rocky:21
# FROM bellsoft/liberica-openjre-rocky:17
# FROM bellsoft/liberica-openjre-rocky:11
# FROM bellsoft/liberica-openjre-rocky:8
LABEL maintainer=yunzhupaas-team
# 设置时区
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# 指定运行时的工作目录
WORKDIR /data/yunzhupaassoft/univerApi
# 将构建产物jar包拷贝到运行时目录中
COPY yunzhupaas-datareport-univer-admin/target/*.jar ./yunzhupaas-univer-admin.jar
# 指定容器内运行端口
EXPOSE 32000
# 指定容器启动时要运行的命令
ENTRYPOINT ["/bin/sh","-c","java -javaagent:./yunzhupaas-univer-admin.jar -Dfile.encoding=utf8 -Djava.security.egd=file:/dev/./urandom --add-opens java.base/java.lang=ALL-UNNAMED -XX:+DisableAttachMechanism -jar yunzhupaas-univer-admin.jar"]

0
README
View File

383
README.md Normal file
View File

@@ -0,0 +1,383 @@
> 特别说明源码、JDK、数据库、Redis等安装或存放路径禁止包含中文、空格、特殊字符等
## 一 环境要求
### 1.1 开发环境
| 类目 | 版本说明或建议 |
| --- |------------------|
| 硬件 | 开发电脑建议使用I3及以上CPU16G及以上内存 |
| 操作系统 | Windows 10/11MacOS |
| JDK | 默认使用JDK 21如需要切换JDK 8/11/17版本请参考文档调整代码推荐使用 `OpenJDK`,如 `Liberica JDK``Eclipse Temurin``Alibaba Dragonwell``BiSheng` 等发行版; |
| Maven | 依赖管理工具,推荐使用 `3.6.3` 及以上版本 |
| Redis | 数据缓存,推荐使用 `5.0` 及以上版本 |
| 数据库 | 兼容 `MySQL 5.7.x/8.x``SQLServer 2012+``Oracle 11g``PostgreSQL 12+``达梦数据库(DM8)``人大金仓数据库(KingbaseES_V8R6)` |
| IDE | 代码集成开发环境,推荐使用 `IDEA2024` 及以上版本,兼容 `Eclipse``Spring Tool Suite` 等IDE工具 |
| 文件存储 | 默认使用本地存储,兼容 `MinIO` 及多个云对象存储,如 `阿里云 OSS``华为云 OBS``七牛云 Kodo``腾讯云 COS` 等; |
### 1.2 运行环境
> 适用于测试或生产环境
| 类目 | 版本说明或建议 |
| --- |-----------------------------------------------|
| 服务器配置 | 建议至少在 `4C/16G/50G` 的机器配置下运行;|
| 操作系统 | 建议使用 `Windows Server 2019` 及以上版本或主流 `Linux` 发行版本,推荐使用 `Linux` 环境;兼容 `统信UOS``OpenEuler``麒麟服务器版` 等信创环境; |
| JRE | 默认使用JRE 21如需要切换JRE 8/11/17版本请参考文档调整代码推荐使用 `OpenJDK`,如 `Liberica JDK``Eclipse Temurin``Alibaba Dragonwell``BiSheng` 等发行版; |
| Redis | 数据缓存,推荐使用 `5.0` 及以上版本 |
| 数据库 | 兼容 `MySQL 5.7.x/8.x``SQLServer 2012+``Oracle 11g``PostgreSQL 12+``达梦数据库(DM8)``人大金仓数据库(KingbaseES_V8R6)` |
| 文件存储 | 默认使用本地存储,兼容 `MinIO` 及多个云对象存储,如 `阿里云 OSS``华为云 OBS``七牛云 Kodo``腾讯云 COS` 等; |
## 二 关联项目
| 项目 | 分支 | 说明 |
|--------------------|---------------|------------|
| yunzhupaas-common | v5.2.x-stable | 项目基础依赖源码 |
| yunzhupaas-java-datareport-univer-core | v5.2.x-stable | Univer报表核心依赖源码 |
## 三 Maven私服配置
> 建议使用 Apache Maven 3.6.3 及以上版本<br>以解决依赖无法从公共Maven仓库下载的问题<br>通过官方私服下载依赖完成后由于IDEA的缓存可能会出现部分报红重启IDEA即可
打开Maven安装目录中的 `conf/settings.xml` 文件,<br/>
`<servers></servers>` 中添加如下内容
```xml
<server>
<id>maven-releases</id>
<username>admin</username>
<password>admin123</password>
</server>
```
`<mirrors></mirrors>` 中添加
```xml
<mirror>
<id>maven-releases</id>
<mirrorOf>*</mirrorOf>
<name>maven-releases</name>
<url>https://repository.yunzhupaas.com/repository/maven-public/</url>
</mirror>
```
## 四 开发环境
### 4.1 导入数据库脚本
> 以 MySQL数据库为例<br>字符集:`utf8mb4` <br/>排序规则:`utf8mb4_general_ci`
在MySQL创建 `yunzhupaas_init` 数据库,并将 `yunzhupaas-database/MySQL/yunzhupaas_db_init.sql` 导入;
### 4.2 导入依赖
详见 `yunzhupaas-java-datareport-univer-core` 项目中的 `README.md` 文档说明
### 4.3 项目配置
打开编辑 `yunzhupaas-datareport-univer-admin/src/main/resources/application.yml`
#### 4.3.1 指定环境配置
环境说明:
- `application-dev.yml` 开发环境(默认)
- `application-preview.yml` 预生产环境
- `application-test.yml` 测试环境
- `application-prod.yml` 生产环境
> 以开发环境为例,根据实际需求修改
```yaml
# application.yml第 6 行,可选值dev(开发环境-默认)、test(测试环境)、preview(预生产环境)、prod(生产环境)
active: dev
```
#### 4.3.2 配置域名
打开编辑 `yunzhupaas-datareport-univer-admin/src/main/resources/application.yml` ,修改以下配置
```yaml
ApiDomain: http://127.0.0.1:30000 #主项目后端域名(文档预览中使用)
FrontDomain: http://127.0.0.1:3100 #前端域名(文档预览中使用)
AppDomain: http://127.0.0.1:8080 #app/h5端域名配置(文档预览中使用)
```
#### 4.3.3 调整运行端口
> 根据实际需求调整
打开编辑 `yunzhupaas-datareport-univer-admin/src/main/resources/application-dev.yml`,第 5 行
```yaml
port: 32000 # 默认运行端口
```
#### 4.3.4 数据源配置
配置参数说明:
- `db-type`:数据库类型(可选值:`MySQL``SQLServer``Oracle``PostgreSQL``DM``KingbaseES`
- `host`:数据库主机地址
- `port`:数据库端口
- `dbname`:平台初始库
- `username`:数据库用户名
- `password`:数据库密码
- `db-schema`:数据库模式
- `prepare-url`自定义JDBC连接配置
打开编辑 `yunzhupaas-datareport-univer-admin/src/main/resources/application-dev.yml`,修改以下配置
##### 4.3.4.1 MySQL数据库
```yaml
datasource:
db-type: MySQL
host: 127.0.0.1
port: 3306
db-name: yunzhupaas_init
username: dbuser
password: dbpasswd
db-schema:
prepare-url:
```
##### 4.3.4.2 SQLServer数据库
```yaml
datasource:
db-type: SQLServer
host: 127.0.0.1
port: 1433
db-name: yunzhupaas_init
username: dbuser
password: dbpasswd
db-schema:
prepare-url:
```
##### 4.3.4.3 Oracle数据库
```yaml
datasource:
db-type: Oracle
host: 127.0.0.1
port: 1521
db-name:
username: YUNZHUPAAS_INIT
password: dbpasswd
db-schema:
prepare-url: jdbc:oracle:thin:@127.0.0.1:1521:ORCL
```
##### 4.3.4.4 PostgreSQL数据库配置
```yaml
datasource:
db-type: PostgreSQL
host: 127.0.0.1
port: 5432
db-name: yunzhupaas_init
username: postgres
password: dbpasswd
db-schema: public
prepare-url:
```
##### 4.3.4.5 达梦DM8数据库
```yaml
datasource:
db-type: DM
host: 127.0.0.1
port: 5236
db-name: YUNZHUPAAS_INIT
username: DBUSER
password: dbpasswd
db-schema:
prepare-url:
tablespace: MAIN
```
##### 4.3.4.6 人大金仓KingbaseES_V8R6数据库
```yaml
datasource:
db-type: KingbaseES
host: 127.0.0.1
port: 54321
db-name: yunzhupaas_init
username: system
password: dbpasswd
db-schema: public
prepare-url:
```
#### 4.3.5 Redis配置
打开编辑 `yunzhupaas-datareport-univer-admin/src/main/resources/application-dev.yml`,修改以下配置
> 支持单机模式和集群模式,配置默认为单机模式
**若使用Redis单机模式**
> 第 71-82 行
```yaml
redis:
database: 1 #缓存库编号
host: 127.0.0.1
port: 6379
password: 123456 # 密码为空时,请将本行注释
timeout: 3000 #超时时间(单位:秒)
lettuce: #Lettuce为Redis的Java驱动包
pool:
max-active: 8 # 连接池最大连接数
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
min-idle: 0 # 连接池中的最小空闲连接
max-idle: 8 # 连接池中的最大空闲连接
```
**若使用Redis集群模式**
> 第 85-101 行
```yaml
redis:
cluster:
nodes:
- 192.168.0.225:6380
- 192.168.0.225:6381
- 192.168.0.225:6382
- 192.168.0.225:6383
- 192.168.0.225:6384
- 192.168.0.225:6385
password: 123456 # 密码为空时,请将本行注释
timeout: 3000 # 超时时间(单位:秒)
lettuce: #Lettuce为Redis的Java驱动包
pool:
max-active: 8 # 连接池最大连接数
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
min-idle: 0 # 连接池中的最小空闲连接
max-idle: 8 # 连接池中的最大空闲连接
```
#### 4.3.6 静态资源配置
打开编辑 `yunzhupaas-datareport-univer-admin/src/main/resources/application-dev.yml` ,修改以下配置(第 121-166 行)
> 默认使用本地存储,兼容 `MinIO` 及多个云对象存储,如阿里云 OSS、华为云 OBS、七牛云 Kodo、腾讯云 COS等
```yaml
# ===================== 文件存储配置 =====================
file-storage: #文件存储配置,不使用的情况下可以不写
default-platform: local-plus-1 #默认使用的存储平台
thumbnail-suffix: ".min.jpg" #缩略图后缀,例如【.min.jpg】【.png】
local-plus: # 本地存储升级版
- platform: local-plus-1 # 存储平台标识
enable-storage: true #启用存储
enable-access: true #启用访问(线上请使用 Nginx 配置,效率更高)
domain: "" # 访问域名例如“http://127.0.0.1:8030/”,注意后面要和 path-patterns 保持一致,“/”结尾,本地存储建议使用相对路径,方便后期更换域名
base-path: D:/project/yunzhupaas-resources/ # 基础路径
path-patterns: /** # 访问路径
storage-path: # 存储路径
aliyun-oss: # 阿里云 OSS ,不使用的情况下可以不写
- platform: aliyun-oss-1 # 存储平台标识
enable-storage: false # 启用存储
access-key: ??
secret-key: ??
end-point: ??
bucket-name: ??
domain: ?? # 访问域名,注意“/”结尾例如https://abc.oss-cn-shanghai.aliyuncs.com/
base-path: hy/ # 基础路径
qiniu-kodo: # 七牛云 kodo ,不使用的情况下可以不写
- platform: qiniu-kodo-1 # 存储平台标识
enable-storage: false # 启用存储
access-key: ??
secret-key: ??
bucket-name: ??
domain: ?? # 访问域名,注意“/”结尾例如http://abc.hn-bkt.clouddn.com/
base-path: base/ # 基础路径
tencent-cos: # 腾讯云 COS
- platform: tencent-cos-1 # 存储平台标识
enable-storage: false # 启用存储
secret-id: ??
secret-key: ??
region: ?? #存仓库所在地域
bucket-name: ??
domain: ?? # 访问域名,注意“/”结尾例如https://abc.cos.ap-nanjing.myqcloud.com/
base-path: hy/ # 基础路径
minio: # MinIO由于 MinIO SDK 支持 AWS S3其它兼容 AWS S3 协议的存储平台也都可配置在这里
- platform: minio-1 # 存储平台标识
enable-storage: true # 启用存储
access-key: Q9jJs2b6Tv
secret-key: Thj2WkpLu9DhmJyJ
end-point: http://192.168.0.207:9000/
bucket-name: yunzhupaassoftoss
domain: # 访问域名,注意“/”结尾例如http://minio.abc.com/abc/
base-path: # 基础路径
```
### 4.4 执行调试或运行
#### 4.4.1 `yunzhupaas-java-datareport-univer-core` 项目未使用加密
- 在IDEA中, 展开右侧 `Maven``Profiles` 去除勾选 `encrypted` 选项, 再点击 Maven `刷新` 图标刷新Maven
- 找到 `yunzhupaas-datareport-univer-admin/src/main/java/yunzhupaas/ReportUniverApplication.java`,右击运行即可。
若使用JDK9及以上版本在IDEA中打开 `Edit Configurations` VM启动参数添加如下参数
```bash
--add-opens java.base/java.lang=ALL-UNNAMED
```
#### 4.4.2 `yunzhupaas-java-datareport-univer-core` 项目使用加密
- 在IDEA中展开右侧 `Maven` 中 `Profiles` 勾选 `encrypted` 选项, 再点击Maven `刷新` 图标刷新Maven
- 在IDEA中双击右侧 `Maven` 中 `yunzhupaas-datareport-univer` > `clean` 将会自动安装加密打包插件, 并创建创建 `yunzhupaas-datareport-univer-entity/target/copylib` 复制依赖包用于下一步运行
**参数说明**
```bash
# 打开项目中`yunzhupaas-datareport-univer-entity/target/copylib` 目录, 复制Jar包 `yunzhupaas-datareport-univer-model-版本号.jar` 的文件名
-javaagent:项目存放路径/yunzhupaas-datareport-univer-entity/target/copylib/yunzhupaas-datareport-univer-model-当前版本号.jar(上面复制的文件名)="decryptProjectPathPrefix=yunzhupaas-datareport-univer-common___yunzhupaas-datareport-univer-model"
```
- 在IDEA中打开 `Edit Configurations` VM启动参数添加如下参数
若使用 JDK8 运行需要替换下方命令示例中的Jar包路径
``` bash
-XX:+DisableAttachMechanism
-javaagent:D:/Projects/IdeaProjects/yunzhupaas-java-datareport-univer/yunzhupaas-datareport-univer-entity/target/copylib/yunzhupaas-datareport-univer-model-5.1.0-RELEASE.jar="decryptProjectPathPrefix=yunzhupaas-datareport-univer-common___yunzhupaas-datareport-univer-model"
```
若使用JDK 9及以上版本需要替换下方命令示例中的Jar包路径
``` bash
--add-opens java.base/java.lang=ALL-UNNAMED
-XX:+DisableAttachMechanism
-javaagent:D:/Projects/IdeaProjects/yunzhupaas-java-datareport-univer/yunzhupaas-datareport-univer-entity/target/copylib/yunzhupaas-datareport-univer-model-5.1.0-RELEASE.jar="decryptProjectPathPrefix=yunzhupaas-datareport-univer-common___yunzhupaas-datareport-univer-model"
```
## 五 项目发布
### 5.1 `yunzhupaas-java-datareport-univer-core` 项目未使用加密
- 在IDEA中, 展开右侧 `Maven` 中 `Profiles` 去除勾选 `encrypted` 选项, 再点击Maven `刷新` 图标刷新Maven
- 在IDEA中双击右侧Maven中 `yunzhupaas-datareport-univer` > `Lifecycle` > `clean` 清理项目
- 在IDEA中双击右侧Maven中 `yunzhupaas-datareport-univer` > `Lifecycle` > `package` 打包项目
- 打开 `yunzhupaas-datareport-univer/yunzhupaas-datareport-univer-entity/target`,将 `yunzhupaas-datareport-univer-admin-5.1.0-RELEASE.jar` 上传至服务器
### 5.2 `yunzhupaas-java-datareport-univer-core` 项目使用加密
- 在IDEA中, 展开右侧 `Maven` 中 `Profiles` 勾选 `encrypted` 选项, 再点击Maven `刷新` 图标刷新Maven
- 在IDEA中双击右侧 `Maven` > `yunzhupaas-java-datareport-univer` > `clean` 将会自动安装加密打包插件
- 在IDEA中双击右侧 `Maven` > `yunzhupaas-java-datareport-univer` > `Lifecycle` > `package` 打包项目
- 打开 `yunzhupaas-datareport-univer/yunzhupaas-datareport-univer-admin/target`,将 `yunzhupaas-datareport-univer-admin-5.1.0-RELEASE.jar` 上传至服务器
- 启动命令
**若使用 JDK/JRE 8 运行**
```bash
java -javaagent:./yunzhupaas-datareport-univer-admin-5.1.0-RELEASE.jar -XX:+DisableAttachMechanism -jar yunzhupaas-datareport-univer-admin-5.1.0-RELEASE.jar
```
**若使用 JDK/JRE 9及以上版本运行**
```bash
java -javaagent:./yunzhupaas-datareport-univer-admin-5.1.0-RELEASE.jar --add-opens java.base/java.lang=ALL-UNNAMED -XX:+DisableAttachMechanism -jar yunzhupaas-datareport-univer-admin-5.1.0-RELEASE.jar
```

35
allatori/allatori.xml Normal file
View File

@@ -0,0 +1,35 @@
<config>
<input>
<jar in="${project.build.finalName}.jar" out="${project.build.finalName}.jar"/>
</input>
<keep-names>
<class access="protected+">
<field access="protected+"/>
<method access="protected+"/>
</class>
</keep-names>
<ignore-classes>
<!-- 注意spring的框架相关的文件需要排除避免启动报错 -->
<class template="class com.yunzhupaas.properties.ReportProperties"/>
</ignore-classes>
<!-- 混淆设置 -->
<!--随机类名保持小写-->
<property name="classes-naming" value="abc"/>
<!-- 接口形参名保持不变 -->
<property name="local-variables-naming" value="keep-parameters"/>
<!-- 字符串加密 -->
<property name="string-encryption" value="maximum"/>
<property name="string-encryption-type" value="strong"/>
<property name="string-encryption-version" value="v4"/>
<!-- 行数混淆 -->
<property name="line-numbers" value="obfuscate"/>
<!-- 成员重新排序 -->
<property name="member-reorder" value="enable"/>
<!-- 数据jar压缩等级 -->
<property name="output-jar-compression-level" value="9"/>
<property name="log-file" value="log.xml"/>
</config>

View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.idea-aedi</groupId>
<artifactId>class-winter-core</artifactId>
<version>enhance-2.9.4</version>
<dependencies>
<dependency>
<groupId>com.idea-aedi</groupId>
<artifactId>class-winter-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.8.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.6.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<version>2.2.1</version>
</dependency>
</dependencies>
</project>

49
pom.xml Normal file
View File

@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.yunzhupaas</groupId>
<artifactId>yunzhupaas-datareport-univer-core</artifactId>
<version>5.2.0-RELEASE</version>
</parent>
<artifactId>yunzhupaas-datareport-univer</artifactId>
<version>5.2.0-RELEASE</version>
<packaging>pom</packaging>
<modules>
<module>yunzhupaas-datareport-univer-entity</module>
<module>yunzhupaas-datareport-univer-biz</module>
<module>yunzhupaas-datareport-univer-controller</module>
<module>yunzhupaas-datareport-univer-admin</module>
</modules>
<profiles>
<profile>
<id>boot3</id>
<activation>
<jdk>[17,)</jdk>
</activation>
<properties>
<com.yunzhupaas.datareport.core.jdk.version></com.yunzhupaas.datareport.core.jdk.version>
</properties>
</profile>
<profile>
<id>boot2</id>
<activation>
<jdk>(,17)</jdk>
</activation>
<properties>
<com.yunzhupaas.datareport.core.jdk.version></com.yunzhupaas.datareport.core.jdk.version>
<!--若使用JDK8且无yunzhupaas-datareport-univer-core项目源码 注释上方版本定义, 删除下方注释, 切换JDK8版本依赖-->
<!-- <com.yunzhupaas.datareport.core.jdk.version>-jdk8</com.yunzhupaas.datareport.core.jdk.version>-->
</properties>
</profile>
</profiles>
</project>

View File

@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.yunzhupaas</groupId>
<artifactId>yunzhupaas-datareport-univer</artifactId>
<version>5.2.0-RELEASE</version>
</parent>
<artifactId>yunzhupaas-datareport-univer-admin</artifactId>
<dependencies>
<dependency>
<groupId>com.yunzhupaas</groupId>
<artifactId>yunzhupaas-common-security</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.yunzhupaas</groupId>
<artifactId>yunzhupaas-datareport-univer-controller</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<profiles>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.yunzhupaas.ReportUniverApplication</mainClass>
<layout>ZIP</layout>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,17 @@
package com.yunzhupaas;
import cn.xuyanwu.spring.file.storage.EnableFileStorage;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@EnableFileStorage
public class ReportUniverApplication {
public static void main(String[] args) {
SpringApplication springApplication = new SpringApplication(ReportUniverApplication.class);
springApplication.run(args);
System.out.println("鎶ヨ〃鍚姩瀹屾垚");
}
}

View File

@@ -0,0 +1,78 @@
package com.yunzhupaas.aop;
import cn.dev33.satoken.context.SaHolder;
import com.yunzhupaas.base.UserInfo;
import com.yunzhupaas.config.ConfigValueUtil;
import com.yunzhupaas.database.util.NotTenantPluginHolder;
import com.yunzhupaas.database.util.TenantDataSourceUtil;
import com.yunzhupaas.util.StringUtil;
import com.yunzhupaas.util.TenantHolder;
import com.yunzhupaas.util.UserProvider;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
/**
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024/3/15 17:12
*/
@Slf4j
@Aspect
@Component
@Order(1)
public class DataSourceBindAspect {
@Autowired
private ConfigValueUtil configValueUtil;
@Pointcut("(execution(* com.yunzhupaas.*.controller.*.*(..)) || execution(* com.yunzhupaas.controller.*.*(..))))")
public void bindDataSource() {
}
/**
* NoDataSourceBind 不需要绑定数据库的注解
*
* @param pjp
* @return
* @throws Throwable
*/
@Around("bindDataSource() && !@annotation(com.yunzhupaas.util.NoDataSourceBind)")
public Object doAroundService(ProceedingJoinPoint pjp) throws Throwable {
if (configValueUtil.isMultiTenancy()) {
if (StringUtil.isEmpty(TenantHolder.getDatasourceId())) {
UserInfo userInfo = UserProvider.getUser();
String url = null;
try {
url = SaHolder.getRequest().getRequestPath();
} catch (Exception ee) {
}
log.error("租户" + userInfo.getTenantId() + "数据库不存在, URL: {}, TOKEN: {}", url, userInfo.getToken());
return null;
}
return pjp.proceed();
}
Object obj = pjp.proceed();
return obj;
}
@Around("bindDataSource() && @annotation(com.yunzhupaas.util.NoDataSourceBind)")
public Object doAroundService2(ProceedingJoinPoint pjp) throws Throwable {
try {
NotTenantPluginHolder.setNotSwitchAlwaysFlag();
// Filter中提前设置租户信息, 不需要切库的方法进行清除切库
TenantDataSourceUtil.clearLocalTenantInfo();
return pjp.proceed();
} finally {
NotTenantPluginHolder.clearNotSwitchAlwaysFlag();
}
}
}

View File

@@ -0,0 +1,120 @@
package com.yunzhupaas.config;
import cn.dev33.satoken.context.SaHolder;
import cn.dev33.satoken.exception.NotLoginException;
import cn.dev33.satoken.filter.SaServletFilter;
import cn.dev33.satoken.router.SaHttpMethod;
import cn.dev33.satoken.router.SaRouter;
import cn.dev33.satoken.stp.StpUtil;
import cn.dev33.satoken.util.SaResult;
import com.yunzhupaas.base.ActionResultCode;
import com.yunzhupaas.constant.MsgCode;
import com.yunzhupaas.consts.AuthConsts;
import com.yunzhupaas.properties.GatewayWhite;
import com.yunzhupaas.util.IpUtil;
import com.yunzhupaas.util.StringUtil;
import com.yunzhupaas.util.UserProvider;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpHeaders;
import jakarta.servlet.http.HttpServletRequest;
/**
* 网关验证token
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024-03-24
*/
@Slf4j
@Configuration
public class AuthFilter {
private static final String ALL = "*";
private static final String MAX_AGE = "18000L";
// 注册 Sa-Token全局过滤器
@Bean
public SaServletFilter getSaReactorFilter(GatewayWhite gatewayWhite) {
return new SaServletFilter()
// 拦截地址
.addInclude("/**")
.setExcludeList(gatewayWhite.excludeUrl)
// 鉴权方法:每次访问进入
.setAuth(obj -> {
if (log.isInfoEnabled()) {
log.info("请求路径: {}", SaHolder.getRequest().getRequestPath());
}
// 拦截路径
SaRouter.match(gatewayWhite.blockUrl).match(o -> {
// 禁止访问URL 排除白名单
String ip = getIpAddr();
for (String o1 : gatewayWhite.whiteIp) {
if (ip.startsWith(o1)) {
return false;
}
}
log.info("非白名单IP访问限制接口{}, {}", SaHolder.getRequest().getRequestPath(), ip);
return true;
}).back(MsgCode.AD101.get());
// 测试不验证 鉴权服务重启测试模式不清除Token就够了
// SaRouter.match((r)->"true".equals(configValueUtil.getTestVersion())).stop();
// 白名单不拦截
SaRouter.match(gatewayWhite.whiteUrl).stop();
// 内部请求不拦截
SaRouter.match(t -> {
String innerToken = SaHolder.getRequest().getHeader(AuthConsts.INNER_TOKEN_KEY);
return UserProvider.isValidInnerToken(innerToken);
}).stop();
// 登录校验 -- 拦截所有路由
SaRouter.match("/**", r -> {
// 兼容Net、Java大小写不一致问题
String token = StpUtil.getTokenValueNotCut();
if (!StringUtil.isEmpty(token)) {
String[] tokenArr = token.split(" ");
if (StpUtil.getLoginIdByToken(tokenArr[tokenArr.length - 1]) != null) {
return;
}
}
throw NotLoginException.newInstance(StpUtil.getLoginType(), NotLoginException.INVALID_TOKEN,
NotLoginException.INVALID_TOKEN_MESSAGE, token);
}).stop();
}).setError(e -> {
SaHolder.getResponse().addHeader("Content-Type", "application/json; charset=utf-8");
if (e instanceof NotLoginException) {
return SaResult.error(ActionResultCode.SessionOverdue.getMessage())
.setCode(ActionResultCode.SessionOverdue.getCode());
}
log.error(e.getMessage(), e);
return SaResult.error(MsgCode.AD102.get()).setCode(ActionResultCode.Exception.getCode());
})
// 前置函数:在每次认证函数之前执行
.setBeforeAuth(obj -> {
HttpServletRequest request = (HttpServletRequest) SaHolder.getRequest().getSource();
// ---------- 设置跨域响应头 ----------
SaHolder.getResponse()
// 允许指定域访问跨域资源
.setHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, request.getHeader(HttpHeaders.ORIGIN))
// 允许的header参数
.setHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS, ALL)
// 允许所有请求方式
.setHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, ALL)
.setHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true")
.setHeader(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, ALL)
// 有效时间
.setHeader(HttpHeaders.ACCESS_CONTROL_MAX_AGE, MAX_AGE);
// 如果是预检请求,则立即返回到前端
SaRouter.match(SaHttpMethod.OPTIONS)
.back();
});
}
public static String getIpAddr() {
return IpUtil.getIpAddr();
}
}

View File

@@ -0,0 +1,39 @@
package com.yunzhupaas.config;
import com.yunzhupaas.consts.ApiConst;
import com.yunzhupaas.properties.GatewayWhite;
import com.yunzhupaas.properties.GatewayWhiteProperties;
import com.yunzhupaas.properties.ReportProperties;
import com.yunzhupaas.config.YunzhupaasOauthConfig;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration(proxyBeanMethods = false)
public class ReportAutoConfiguration {
@Bean
@ConfigurationProperties(prefix = GatewayWhite.PREFIX)
public GatewayWhite getGateWhite() {
return new GatewayWhiteProperties();
}
@Bean
@ConfigurationProperties(prefix = ReportProperties.PREFIX)
public ReportProperties getReportProperties() {
return new ReportProperties();
}
@Bean
public ApiConst initReportApiConst(YunzhupaasOauthConfig yunzhupaasOauthConfig) {
ApiConst.ME = yunzhupaasOauthConfig.getYunzhupaasDomain() + "/api/oauth/me";
ApiConst.DATASET_LIST = yunzhupaasOauthConfig.getYunzhupaasDomain() + "/api/system/DataSet/getList";
ApiConst.DATASET_SAVE = yunzhupaasOauthConfig.getYunzhupaasDomain() + "/api/system/DataSet/save";
ApiConst.DATASET_DATA = yunzhupaasOauthConfig.getYunzhupaasDomain() + "/api/system/DataSet/Data";
ApiConst.SAVE_MENU = yunzhupaasOauthConfig.getYunzhupaasDomain() + "/api/system/Menu/saveReportMenu";
ApiConst.GET_MENU = yunzhupaasOauthConfig.getYunzhupaasDomain() + "/api/system/Menu/getReportMenu";
ApiConst.PARAMETER_DATA = yunzhupaasOauthConfig.getYunzhupaasDomain() + "/api/system/DataSet/parameterData";
return new ApiConst();
}
}

View File

@@ -0,0 +1,8 @@
package com.yunzhupaas.properties;
/**
* 鏍规嵁闇€姹傞噸鍐欑綉鍏砋RL
*/
public class GatewayWhiteProperties extends GatewayWhite {
}

View File

@@ -0,0 +1,166 @@
# 应用服务器
server:
tomcat:
uri-encoding: UTF-8 #tomcat编码
port: 32000 #tomcat端口
spring:
devtools: #spring开发者工具模块
restart:
enabled: true #热部署开关
freemarker:
cache: false #spring内置freemarker缓存
thymeleaf:
cache: false #spring内置thymeleaf缓存
# ===================== 数据源配置 =====================
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure #排除自动配置手动配置druid
datasource:
db-type: MySQL #数据库类型(可选值 MySQL、SQLServer、Oracle、DM、KingbaseES、PostgreSQL请严格按可选值填写)
host: mysql.szlecheng.cn
port: 13306
username: jnpfsoft
password: ZtRmzjij4CiaXpSE
db-name: jnpfsoft
db-schema: #金仓达梦选填
prepare-url: #自定义url
# ===================== 动态多数据源 =====================
dynamic:
primary: master #设置默认的数据源或者数据源组,默认值即为master
strict: true #严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源
druid:
# 空闲时执行连接测试
test-while-idle: true
# 连接测试最小间隔
time-between-eviction-runs-millis: 60000
# 获取连接等待3秒 根据网络情况设定
max-wait: 3000
# 初始化4个连接
initial-size: 4
# 最大20个连接
max-active: 20
# 最少保持4个空闲连接
min-idle: 4
# 空闲连接保活, 超过配置的空闲时间会进行连接检查完成保活操作(数据库自身会断开达到空闲时间的连接, 程序使用断开的连接会报错)
keep-alive: true
# 解除注释后Druid连接池打印SQL语句 忽略日志等级配置
#filters: slf4j
slf4j:
statementLogEnabled: true
resultSetLogEnabled: false
connectionLogEnabled: false
dataSourceLogEnabled: false
statementCreateAfterLogEnabled: false
statementCloseAfterLogEnabled: false
statementExecuteAfterLogEnabled: false
#打印SQL替换参数
statementExecutableSqlLogEnable: true
statementPrepareAfterLogEnabled: false
statementPrepareCallAfterLogEnabled: false
statementParameterSetLogEnabled: false
# datasource:
# master:
# url: jdbc:mysql://${spring.datasource.host}:${spring.datasource.port}/${spring.datasource.dbname}?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true&serverTimezone=UTC
# username: ${spring.datasource.username}
# password: ${spring.datasource.password}
# driver-class-name: com.mysql.cj.jdbc.Driver
# ===================== Redis配置 =====================
# redis单机模式
redis:
database: 1 #缓存库编号
host: 127.0.0.1
port: 6379
password: redis_JtjYRD # 密码为空时,请将本行注释
timeout: 3000 #超时时间(单位:秒)
lettuce: #Lettuce为Redis的Java驱动包
pool:
max-active: 8 # 连接池最大连接数
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
min-idle: 0 # 连接池中的最小空闲连接
max-idle: 8 # 连接池中的最大空闲连接
# redis集群模式
# redis:
# cluster:
# nodes:
# - 192.168.0.225:6380
# - 192.168.0.225:6381
# - 192.168.0.225:6382
# - 192.168.0.225:6383
# - 192.168.0.225:6384
# - 192.168.0.225:6385
# password: 123456 # 密码为空时,请将本行注释
# timeout: 3000 # 超时时间(单位:秒)
# lettuce: #Lettuce为Redis的Java驱动包
# pool:
# max-active: 8 # 连接池最大连接数
# max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
# min-idle: 0 # 连接池中的最小空闲连接
# max-idle: 8 # 连接池中的最大空闲连接
# SpringDoc接口文档 访问地址http://127.0.0.1:30000/doc.html
springdoc:
default-flat-param-object: true
api-docs:
enabled: true
#SpringDoc增强
#knife4j:
# basic: #接口文档访问鉴权
# enable: true
# username: yunzhupaas
# password: 123456
config:
# ===================== 是否开启测试环境 =====================
TestVersion: false
# ===================== ApacheShardingSphere 配置开关 =====================
sharding-sphere-enabled: false
# ===================== 文件存储配置 =====================
file-storage: #文件存储配置,不使用的情况下可以不写
default-platform: local-plus-1 #默认使用的存储平台
thumbnail-suffix: ".min.jpg" #缩略图后缀,例如【.min.jpg】【.png】
local-plus: # 本地存储升级版
- platform: local-plus-1 # 存储平台标识
enable-storage: true #启用存储
enable-access: true #启用访问(线上请使用 Nginx 配置,效率更高)
domain: "" # 访问域名例如“http://127.0.0.1:8030/”,注意后面要和 path-patterns 保持一致,“/”结尾,本地存储建议使用相对路径,方便后期更换域名
base-path: /data/wwwroot/yunzhupaas-resources/ # 基础路径
path-patterns: /** # 访问路径
storage-path: # 存储路径
aliyun-oss: # 阿里云 OSS ,不使用的情况下可以不写
- platform: aliyun-oss-1 # 存储平台标识
enable-storage: false # 启用存储
access-key: ??
secret-key: ??
end-point: ??
bucket-name: ??
domain: ?? # 访问域名,注意“/”结尾例如https://abc.oss-cn-shanghai.aliyuncs.com/
base-path: hy/ # 基础路径
qiniu-kodo: # 七牛云 kodo ,不使用的情况下可以不写
- platform: qiniu-kodo-1 # 存储平台标识
enable-storage: false # 启用存储
access-key: ??
secret-key: ??
bucket-name: ??
domain: ?? # 访问域名,注意“/”结尾例如http://abc.hn-bkt.clouddn.com/
base-path: base/ # 基础路径
tencent-cos: # 腾讯云 COS
- platform: tencent-cos-1 # 存储平台标识
enable-storage: false # 启用存储
secret-id: ??
secret-key: ??
region: ?? #存仓库所在地域
bucket-name: ??
domain: ?? # 访问域名,注意“/”结尾例如https://abc.cos.ap-nanjing.myqcloud.com/
base-path: hy/ # 基础路径
minio: # MinIO由于 MinIO SDK 支持 AWS S3其它兼容 AWS S3 协议的存储平台也都可配置在这里
- platform: minio-1 # 存储平台标识
enable-storage: true # 启用存储
access-key: Q9jJs2b6Tv
secret-key: Thj2WkpLu9DhmJyJ
end-point: http://192.168.0.207:9000/
bucket-name: yunzhupaassoftoss
domain: # 访问域名,注意“/”结尾例如http://minio.abc.com/abc/
base-path: # 基础路径

View File

@@ -0,0 +1,166 @@
# 应用服务器
server:
tomcat:
uri-encoding: UTF-8 #tomcat编码
port: 32000 #tomcat端口
spring:
devtools: #spring开发者工具模块
restart:
enabled: true #热部署开关
freemarker:
cache: false #spring内置freemarker缓存
thymeleaf:
cache: false #spring内置thymeleaf缓存
# ===================== 数据源配置 =====================
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure #排除自动配置手动配置druid
datasource:
db-type: MySQL #数据库类型(可选值 MySQL、SQLServer、Oracle、DM、KingbaseES、PostgreSQL请严格按可选值填写)
host: 127.0.0.1
port: 3306
username: root
password: 123456
db-name: yunzhupaas_init
db-schema: #金仓达梦选填
prepare-url: #自定义url
# ===================== 动态多数据源 =====================
dynamic:
primary: master #设置默认的数据源或者数据源组,默认值即为master
strict: true #严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源
druid:
# 空闲时执行连接测试
test-while-idle: true
# 连接测试最小间隔
time-between-eviction-runs-millis: 60000
# 获取连接等待3秒 根据网络情况设定
max-wait: 3000
# 初始化4个连接
initial-size: 4
# 最大20个连接
max-active: 20
# 最少保持4个空闲连接
min-idle: 4
# 空闲连接保活, 超过配置的空闲时间会进行连接检查完成保活操作(数据库自身会断开达到空闲时间的连接, 程序使用断开的连接会报错)
keep-alive: true
# 解除注释后Druid连接池打印SQL语句 忽略日志等级配置
#filters: slf4j
slf4j:
statementLogEnabled: true
resultSetLogEnabled: false
connectionLogEnabled: false
dataSourceLogEnabled: false
statementCreateAfterLogEnabled: false
statementCloseAfterLogEnabled: false
statementExecuteAfterLogEnabled: false
#打印SQL替换参数
statementExecutableSqlLogEnable: true
statementPrepareAfterLogEnabled: false
statementPrepareCallAfterLogEnabled: false
statementParameterSetLogEnabled: false
# datasource:
# master:
# url: jdbc:mysql://${spring.datasource.host}:${spring.datasource.port}/${spring.datasource.dbname}?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true&serverTimezone=UTC
# username: ${spring.datasource.username}
# password: ${spring.datasource.password}
# driver-class-name: com.mysql.cj.jdbc.Driver
# ===================== Redis配置 =====================
# redis单机模式
redis:
database: 1 #缓存库编号
host: 127.0.0.1
port: 6379
password: 123456 # 密码为空时,请将本行注释
timeout: 3000 #超时时间(单位:秒)
lettuce: #Lettuce为Redis的Java驱动包
pool:
max-active: 8 # 连接池最大连接数
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
min-idle: 0 # 连接池中的最小空闲连接
max-idle: 8 # 连接池中的最大空闲连接
# redis集群模式
# redis:
# cluster:
# nodes:
# - 192.168.0.225:6380
# - 192.168.0.225:6381
# - 192.168.0.225:6382
# - 192.168.0.225:6383
# - 192.168.0.225:6384
# - 192.168.0.225:6385
# password: 123456 # 密码为空时,请将本行注释
# timeout: 3000 # 超时时间(单位:秒)
# lettuce: #Lettuce为Redis的Java驱动包
# pool:
# max-active: 8 # 连接池最大连接数
# max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
# min-idle: 0 # 连接池中的最小空闲连接
# max-idle: 8 # 连接池中的最大空闲连接
# SpringDoc接口文档 访问地址http://127.0.0.1:30000/doc.html
springdoc:
default-flat-param-object: true
api-docs:
enabled: true
#SpringDoc增强
#knife4j:
# basic: #接口文档访问鉴权
# enable: true
# username: yunzhupaas
# password: 123456
config:
# ===================== 是否开启测试环境 =====================
TestVersion: false
# ===================== ApacheShardingSphere 配置开关 =====================
sharding-sphere-enabled: false
# ===================== 文件存储配置 =====================
file-storage: #文件存储配置,不使用的情况下可以不写
default-platform: local-plus-1 #默认使用的存储平台
thumbnail-suffix: ".min.jpg" #缩略图后缀,例如【.min.jpg】【.png】
local-plus: # 本地存储升级版
- platform: local-plus-1 # 存储平台标识
enable-storage: true #启用存储
enable-access: true #启用访问(线上请使用 Nginx 配置,效率更高)
domain: "" # 访问域名例如“http://127.0.0.1:8030/”,注意后面要和 path-patterns 保持一致,“/”结尾,本地存储建议使用相对路径,方便后期更换域名
base-path: /data/wwwroot/yunzhupaas-resources/ # 基础路径
path-patterns: /** # 访问路径
storage-path: # 存储路径
aliyun-oss: # 阿里云 OSS ,不使用的情况下可以不写
- platform: aliyun-oss-1 # 存储平台标识
enable-storage: false # 启用存储
access-key: ??
secret-key: ??
end-point: ??
bucket-name: ??
domain: ?? # 访问域名,注意“/”结尾例如https://abc.oss-cn-shanghai.aliyuncs.com/
base-path: hy/ # 基础路径
qiniu-kodo: # 七牛云 kodo ,不使用的情况下可以不写
- platform: qiniu-kodo-1 # 存储平台标识
enable-storage: false # 启用存储
access-key: ??
secret-key: ??
bucket-name: ??
domain: ?? # 访问域名,注意“/”结尾例如http://abc.hn-bkt.clouddn.com/
base-path: base/ # 基础路径
tencent-cos: # 腾讯云 COS
- platform: tencent-cos-1 # 存储平台标识
enable-storage: false # 启用存储
secret-id: ??
secret-key: ??
region: ?? #存仓库所在地域
bucket-name: ??
domain: ?? # 访问域名,注意“/”结尾例如https://abc.cos.ap-nanjing.myqcloud.com/
base-path: hy/ # 基础路径
minio: # MinIO由于 MinIO SDK 支持 AWS S3其它兼容 AWS S3 协议的存储平台也都可配置在这里
- platform: minio-1 # 存储平台标识
enable-storage: true # 启用存储
access-key: Q9jJs2b6Tv
secret-key: Thj2WkpLu9DhmJyJ
end-point: http://192.168.0.207:9000/
bucket-name: yunzhupaassoftoss
domain: # 访问域名,注意“/”结尾例如http://minio.abc.com/abc/
base-path: # 基础路径

View File

@@ -0,0 +1,166 @@
# 应用服务器
server:
tomcat:
uri-encoding: UTF-8 #tomcat编码
port: 32000 #tomcat端口
spring:
devtools: #spring开发者工具模块
restart:
enabled: true #热部署开关
freemarker:
cache: false #spring内置freemarker缓存
thymeleaf:
cache: false #spring内置thymeleaf缓存
# ===================== 数据源配置 =====================
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure #排除自动配置手动配置druid
datasource:
db-type: MySQL #数据库类型(可选值 MySQL、SQLServer、Oracle、DM、KingbaseES、PostgreSQL请严格按可选值填写)
host: 127.0.0.1
port: 3306
username: root
password: 123456
db-name: yunzhupaas_init
db-schema: #金仓达梦选填
prepare-url: #自定义url
# ===================== 动态多数据源 =====================
dynamic:
primary: master #设置默认的数据源或者数据源组,默认值即为master
strict: true #严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源
druid:
# 空闲时执行连接测试
test-while-idle: true
# 连接测试最小间隔
time-between-eviction-runs-millis: 60000
# 获取连接等待3秒 根据网络情况设定
max-wait: 3000
# 初始化4个连接
initial-size: 4
# 最大20个连接
max-active: 20
# 最少保持4个空闲连接
min-idle: 4
# 空闲连接保活, 超过配置的空闲时间会进行连接检查完成保活操作(数据库自身会断开达到空闲时间的连接, 程序使用断开的连接会报错)
keep-alive: true
# 解除注释后Druid连接池打印SQL语句 忽略日志等级配置
#filters: slf4j
slf4j:
statementLogEnabled: true
resultSetLogEnabled: false
connectionLogEnabled: false
dataSourceLogEnabled: false
statementCreateAfterLogEnabled: false
statementCloseAfterLogEnabled: false
statementExecuteAfterLogEnabled: false
#打印SQL替换参数
statementExecutableSqlLogEnable: true
statementPrepareAfterLogEnabled: false
statementPrepareCallAfterLogEnabled: false
statementParameterSetLogEnabled: false
# datasource:
# master:
# url: jdbc:mysql://${spring.datasource.host}:${spring.datasource.port}/${spring.datasource.dbname}?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true&serverTimezone=UTC
# username: ${spring.datasource.username}
# password: ${spring.datasource.password}
# driver-class-name: com.mysql.cj.jdbc.Driver
# ===================== Redis配置 =====================
# redis单机模式
redis:
database: 1 #缓存库编号
host: 127.0.0.1
port: 6379
password: 123456 # 密码为空时,请将本行注释
timeout: 3000 #超时时间(单位:秒)
lettuce: #Lettuce为Redis的Java驱动包
pool:
max-active: 8 # 连接池最大连接数
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
min-idle: 0 # 连接池中的最小空闲连接
max-idle: 8 # 连接池中的最大空闲连接
# redis集群模式
# redis:
# cluster:
# nodes:
# - 192.168.0.225:6380
# - 192.168.0.225:6381
# - 192.168.0.225:6382
# - 192.168.0.225:6383
# - 192.168.0.225:6384
# - 192.168.0.225:6385
# password: 123456 # 密码为空时,请将本行注释
# timeout: 3000 # 超时时间(单位:秒)
# lettuce: #Lettuce为Redis的Java驱动包
# pool:
# max-active: 8 # 连接池最大连接数
# max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
# min-idle: 0 # 连接池中的最小空闲连接
# max-idle: 8 # 连接池中的最大空闲连接
# SpringDoc接口文档 访问地址http://127.0.0.1:30000/doc.html
springdoc:
default-flat-param-object: true
api-docs:
enabled: true
#SpringDoc增强
#knife4j:
# basic: #接口文档访问鉴权
# enable: true
# username: yunzhupaas
# password: 123456
config:
# ===================== 是否开启测试环境 =====================
TestVersion: false
# ===================== ApacheShardingSphere 配置开关 =====================
sharding-sphere-enabled: false
# ===================== 文件存储配置 =====================
file-storage: #文件存储配置,不使用的情况下可以不写
default-platform: local-plus-1 #默认使用的存储平台
thumbnail-suffix: ".min.jpg" #缩略图后缀,例如【.min.jpg】【.png】
local-plus: # 本地存储升级版
- platform: local-plus-1 # 存储平台标识
enable-storage: true #启用存储
enable-access: true #启用访问(线上请使用 Nginx 配置,效率更高)
domain: "" # 访问域名例如“http://127.0.0.1:8030/”,注意后面要和 path-patterns 保持一致,“/”结尾,本地存储建议使用相对路径,方便后期更换域名
base-path: /data/wwwroot/yunzhupaas-resources/ # 基础路径
path-patterns: /** # 访问路径
storage-path: # 存储路径
aliyun-oss: # 阿里云 OSS ,不使用的情况下可以不写
- platform: aliyun-oss-1 # 存储平台标识
enable-storage: false # 启用存储
access-key: ??
secret-key: ??
end-point: ??
bucket-name: ??
domain: ?? # 访问域名,注意“/”结尾例如https://abc.oss-cn-shanghai.aliyuncs.com/
base-path: hy/ # 基础路径
qiniu-kodo: # 七牛云 kodo ,不使用的情况下可以不写
- platform: qiniu-kodo-1 # 存储平台标识
enable-storage: false # 启用存储
access-key: ??
secret-key: ??
bucket-name: ??
domain: ?? # 访问域名,注意“/”结尾例如http://abc.hn-bkt.clouddn.com/
base-path: base/ # 基础路径
tencent-cos: # 腾讯云 COS
- platform: tencent-cos-1 # 存储平台标识
enable-storage: false # 启用存储
secret-id: ??
secret-key: ??
region: ?? #存仓库所在地域
bucket-name: ??
domain: ?? # 访问域名,注意“/”结尾例如https://abc.cos.ap-nanjing.myqcloud.com/
base-path: hy/ # 基础路径
minio: # MinIO由于 MinIO SDK 支持 AWS S3其它兼容 AWS S3 协议的存储平台也都可配置在这里
- platform: minio-1 # 存储平台标识
enable-storage: true # 启用存储
access-key: Q9jJs2b6Tv
secret-key: Thj2WkpLu9DhmJyJ
end-point: http://192.168.0.207:9000/
bucket-name: yunzhupaassoftoss
domain: # 访问域名,注意“/”结尾例如http://minio.abc.com/abc/
base-path: # 基础路径

View File

@@ -0,0 +1,166 @@
# 应用服务器
server:
tomcat:
uri-encoding: UTF-8 #tomcat编码
port: 32000 #tomcat端口
spring:
devtools: #spring开发者工具模块
restart:
enabled: true #热部署开关
freemarker:
cache: false #spring内置freemarker缓存
thymeleaf:
cache: false #spring内置thymeleaf缓存
# ===================== 数据源配置 =====================
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure #排除自动配置手动配置druid
datasource:
db-type: MySQL #数据库类型(可选值 MySQL、SQLServer、Oracle、DM、KingbaseES、PostgreSQL请严格按可选值填写)
host: 127.0.0.1
port: 3306
username: root
password: 123456
db-name: yunzhupaas_init
db-schema: #金仓达梦选填
prepare-url: #自定义url
# ===================== 动态多数据源 =====================
dynamic:
primary: master #设置默认的数据源或者数据源组,默认值即为master
strict: true #严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源
druid:
# 空闲时执行连接测试
test-while-idle: true
# 连接测试最小间隔
time-between-eviction-runs-millis: 60000
# 获取连接等待3秒 根据网络情况设定
max-wait: 3000
# 初始化4个连接
initial-size: 4
# 最大20个连接
max-active: 20
# 最少保持4个空闲连接
min-idle: 4
# 空闲连接保活, 超过配置的空闲时间会进行连接检查完成保活操作(数据库自身会断开达到空闲时间的连接, 程序使用断开的连接会报错)
keep-alive: true
# 解除注释后Druid连接池打印SQL语句 忽略日志等级配置
#filters: slf4j
slf4j:
statementLogEnabled: true
resultSetLogEnabled: false
connectionLogEnabled: false
dataSourceLogEnabled: false
statementCreateAfterLogEnabled: false
statementCloseAfterLogEnabled: false
statementExecuteAfterLogEnabled: false
#打印SQL替换参数
statementExecutableSqlLogEnable: true
statementPrepareAfterLogEnabled: false
statementPrepareCallAfterLogEnabled: false
statementParameterSetLogEnabled: false
# datasource:
# master:
# url: jdbc:mysql://${spring.datasource.host}:${spring.datasource.port}/${spring.datasource.dbname}?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true&serverTimezone=UTC
# username: ${spring.datasource.username}
# password: ${spring.datasource.password}
# driver-class-name: com.mysql.cj.jdbc.Driver
# ===================== Redis配置 =====================
# redis单机模式
redis:
database: 1 #缓存库编号
host: 127.0.0.1
port: 6379
password: 123456 # 密码为空时,请将本行注释
timeout: 3000 #超时时间(单位:秒)
lettuce: #Lettuce为Redis的Java驱动包
pool:
max-active: 8 # 连接池最大连接数
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
min-idle: 0 # 连接池中的最小空闲连接
max-idle: 8 # 连接池中的最大空闲连接
# redis集群模式
# redis:
# cluster:
# nodes:
# - 192.168.0.225:6380
# - 192.168.0.225:6381
# - 192.168.0.225:6382
# - 192.168.0.225:6383
# - 192.168.0.225:6384
# - 192.168.0.225:6385
# password: 123456 # 密码为空时,请将本行注释
# timeout: 3000 # 超时时间(单位:秒)
# lettuce: #Lettuce为Redis的Java驱动包
# pool:
# max-active: 8 # 连接池最大连接数
# max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
# min-idle: 0 # 连接池中的最小空闲连接
# max-idle: 8 # 连接池中的最大空闲连接
# SpringDoc接口文档 访问地址http://127.0.0.1:30000/doc.html
springdoc:
default-flat-param-object: true
api-docs:
enabled: true
#SpringDoc增强
#knife4j:
# basic: #接口文档访问鉴权
# enable: true
# username: yunzhupaas
# password: 123456
config:
# ===================== 是否开启测试环境 =====================
TestVersion: false
# ===================== ApacheShardingSphere 配置开关 =====================
sharding-sphere-enabled: false
# ===================== 文件存储配置 =====================
file-storage: #文件存储配置,不使用的情况下可以不写
default-platform: local-plus-1 #默认使用的存储平台
thumbnail-suffix: ".min.jpg" #缩略图后缀,例如【.min.jpg】【.png】
local-plus: # 本地存储升级版
- platform: local-plus-1 # 存储平台标识
enable-storage: true #启用存储
enable-access: true #启用访问(线上请使用 Nginx 配置,效率更高)
domain: "" # 访问域名例如“http://127.0.0.1:8030/”,注意后面要和 path-patterns 保持一致,“/”结尾,本地存储建议使用相对路径,方便后期更换域名
base-path: /data/wwwroot/yunzhupaas-resources/ # 基础路径
path-patterns: /** # 访问路径
storage-path: # 存储路径
aliyun-oss: # 阿里云 OSS ,不使用的情况下可以不写
- platform: aliyun-oss-1 # 存储平台标识
enable-storage: false # 启用存储
access-key: ??
secret-key: ??
end-point: ??
bucket-name: ??
domain: ?? # 访问域名,注意“/”结尾例如https://abc.oss-cn-shanghai.aliyuncs.com/
base-path: hy/ # 基础路径
qiniu-kodo: # 七牛云 kodo ,不使用的情况下可以不写
- platform: qiniu-kodo-1 # 存储平台标识
enable-storage: false # 启用存储
access-key: ??
secret-key: ??
bucket-name: ??
domain: ?? # 访问域名,注意“/”结尾例如http://abc.hn-bkt.clouddn.com/
base-path: base/ # 基础路径
tencent-cos: # 腾讯云 COS
- platform: tencent-cos-1 # 存储平台标识
enable-storage: false # 启用存储
secret-id: ??
secret-key: ??
region: ?? #存仓库所在地域
bucket-name: ??
domain: ?? # 访问域名,注意“/”结尾例如https://abc.cos.ap-nanjing.myqcloud.com/
base-path: hy/ # 基础路径
minio: # MinIO由于 MinIO SDK 支持 AWS S3其它兼容 AWS S3 协议的存储平台也都可配置在这里
- platform: minio-1 # 存储平台标识
enable-storage: true # 启用存储
access-key: Q9jJs2b6Tv
secret-key: Thj2WkpLu9DhmJyJ
end-point: http://192.168.0.207:9000/
bucket-name: yunzhupaassoftoss
domain: # 访问域名,注意“/”结尾例如http://minio.abc.com/abc/
base-path: # 基础路径

View File

@@ -0,0 +1,84 @@
spring:
application:
name: yunzhupaas-datareport
profiles:
# 指定环境配置 dev(开发环境-默认)、test(测试环境)、preview(预生产环境)、prod(生产环境)
active: dev
servlet:
multipart: #文件传输配置
max-file-size: 100MB #单个数据大小限制
max-request-size: 100MB #请求总数据大小限制
enabled: true #是否启用分段上传支持
mvc:
hiddenmethod: #隐式方法过滤器
filter:
enabled: true #默认开启。开启以支持PUT,DELETE表单提交方法
jackson: #序列化和反序列化json框架
serialization:
write-dates-as-timestamps: true #是否写入日期时间时间戳格式
time-zone: GMT+8 #指定日期格式化时区
main:
allow-bean-definition-overriding: true #允许同名bean后者覆盖,默认true
allow-circular-references: true #允许Bean相互引用,默认false
config:
#===================== 访问域名 =====================
WebAnnexFilePath: WebAnnexFile
DataBackupFilePath: DataBackupFile
TemporaryFilePath: TemporaryFile
SystemFilePath: SystemFile
TemplateFilePath: TemplateFile
EmailFilePath: EmailFile
DocumentFilePath: DocumentFile
DocumentPreviewPath: DocumentPreview
UserAvatarFilePath: UserAvatar
IMContentFilePath: IMContentFile
MPMaterialFilePath: MPMaterial
TemplateCodePath: TemplateCode
BiVisualPath: BiVisualPath
ApiDomain: http://127.0.0.1:30000 #主项目后端域名(文档预览中使用)
FrontDomain: http://127.0.0.1:3100 #前端域名(文档预览中使用)
AppDomain: http://127.0.0.1:8080 #app/h5端域名配置(文档预览中使用)
#===================== 多租户 =====================
MultiTenancy: false #是否开启
MultiTenancyUrl: http://127.0.0.1:30006/api/tenant/DbName/ #多租户项目地址
# 接口放行地址 与GatewayWhite中的默认URL合并
gateway:
# 禁止访问接口
block-url:
## 配置示例
#- /api/message/Notice
#- /api/permission/Users/*
# 不验证Token, 放行接口(默认记录日志)
white-url:
# # 配置示例
#- /api/message/Notice
#- /api/permission/Users/*
# 放行接口(不记录日志)
exclude-url:
# # 配置示例
#- /api/message/Notice
#- /api/permission/Users/*
# 入站IP禁止配置以外的IP访问block-url配置的接口
white-ip:
#- 192.168.0.10
#- 192.168.0.20
# 日志配置
logging:
config: classpath:logback-spring.xml
level:
#自定义第三方包名日志等级
# 解除注释后Druid连接池打印SQL语句
druid.sql.Statement: debug
# druid.sql.DataSource: debug
# druid.sql.Connection: debug
# druid.sql.ResultSet: debug
log:
level:
# 等级 TRACE,DEBUG,INFO,WARN,ERROR(不区分大小写)
root: info
path: log/${spring.application.name}

View File

@@ -0,0 +1,327 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!--日志格式应用spring boot默认的格式也可以自己更改-->
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<property name="FILE_LOG_PATTERN" value="[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%thread] [%logger{50}] [%M] [%line] - %msg%n" />
<springProperty scope="context" name="SERVICE_NAME" source="spring.application.name" defaultValue="yunzhupaas"/>
<!--定义日志存放的位置,默认存放在项目启动的相对路径的目录-->
<springProperty scope="context" name="LOG_PATH" source="log.path" defaultValue="log/${SERVICE_NAME}"/>
<!-- 全局日志等级 -->
<springProperty scope="context" name="LOG_LEVEL_ROOT" source="log.level.root" defaultValue="INFO"/>
<!-- 服务自定义等级 如需自定义服务日志等级 修改下方的【自定义服务名】与nacos上的log.level.自定义服务名=等级 -->
<springProperty scope="context" name="LOG_LEVEL" source="log.level.yunzhupaas-boot" defaultValue="${LOG_LEVEL_ROOT}"/>
<!-- 日志记录器日期滚动记录level为 ERROR 日志 -->
<appender name="FILE_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${LOG_PATH}/log_error.log</file>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- 归档的日志文件的路径,%d{yyyy-MM-dd}指定日期格式,%i指定索引 -->
<fileNamePattern>${LOG_PATH}/error/%d{yyyy-MM-dd,aux}/log-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!--日志最大的历史7天-->
<maxHistory>7</maxHistory>
<!-- 除按日志记录之外还配置了日志文件不能超过2M若超过2M日志文件会以索引0开始
命名日志文件例如log-error-2013-12-21.0.log -->
<maxFileSize>10MB</maxFileSize>
</rollingPolicy>
<!-- 追加方式记录日志 -->
<append>true</append>
<!-- 日志文件的格式 -->
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${FILE_LOG_PATTERN}</pattern>
<charset>utf-8</charset>
</encoder>
<!-- 此日志文件只记录error级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>error</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 日志记录器日期滚动记录level为 INFO 日志 -->
<appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${LOG_PATH}/log_info.log</file>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- 归档的日志文件的路径,%d{yyyy-MM-dd}指定日期格式,%i指定索引 -->
<fileNamePattern>${LOG_PATH}/info/%d{yyyy-MM-dd,aux}/log-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!--日志最大的历史7天-->
<maxHistory>7</maxHistory>
<!-- 除按日志记录之外还配置了日志文件不能超过2M若超过2M日志文件会以索引0开始
命名日志文件例如log-error-2013-12-21.0.log -->
<maxFileSize>10MB</maxFileSize>
</rollingPolicy>
<!-- 追加方式记录日志 -->
<append>true</append>
<!-- 日志文件的格式 -->
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${FILE_LOG_PATTERN}</pattern>
<charset>utf-8</charset>
</encoder>
<!-- 此日志文件只记录info级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>info</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 日志记录器日期滚动记录level为 WARN 日志 -->
<appender name="FILE_WARN" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${LOG_PATH}/log_warn.log</file>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- 归档的日志文件的路径,%d{yyyy-MM-dd}指定日期格式,%i指定索引 -->
<fileNamePattern>${LOG_PATH}/warn/%d{yyyy-MM-dd,aux}/log-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!--日志最大的历史7天-->
<maxHistory>7</maxHistory>
<!-- 除按日志记录之外还配置了日志文件不能超过2M若超过2M日志文件会以索引0开始
命名日志文件例如log-error-2013-12-21.0.log -->
<maxFileSize>10MB</maxFileSize>
</rollingPolicy>
<!-- 追加方式记录日志 -->
<append>true</append>
<!-- 日志文件的格式 -->
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${FILE_LOG_PATTERN}</pattern>
<charset>utf-8</charset>
</encoder>
<!-- 此日志文件只记录warn级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>warn</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 日志记录器日期滚动记录level为 DEBUG 日志 -->
<appender name="FILE_DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${LOG_PATH}/log_debug.log</file>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- 归档的日志文件的路径,%d{yyyy-MM-dd}指定日期格式,%i指定索引 -->
<fileNamePattern>${LOG_PATH}/debug/%d{yyyy-MM-dd,aux}/log-debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!--日志最大的历史7天-->
<maxHistory>7</maxHistory>
<!-- 除按日志记录之外还配置了日志文件不能超过2M若超过2M日志文件会以索引0开始
命名日志文件例如log-error-2013-12-21.0.log -->
<maxFileSize>10MB</maxFileSize>
</rollingPolicy>
<!-- 追加方式记录日志 -->
<append>true</append>
<!-- 日志文件的格式 -->
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${FILE_LOG_PATTERN}</pattern>
<charset>utf-8</charset>
</encoder>
<!-- 此日志文件只记录debug级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>debug</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 日志记录器,日期滚动记录,所有日志 -->
<appender name="FILE_ALL" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${LOG_PATH}/log_total.log</file>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- 归档的日志文件的路径,%d{yyyy-MM-dd}指定日期格式,%i指定索引 -->
<fileNamePattern>${LOG_PATH}/total/%d{yyyy-MM-dd,aux}/log-total-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!--日志最大的历史7天-->
<maxHistory>7</maxHistory>
<!-- 除按日志记录之外还配置了日志文件不能超过2M若超过2M日志文件会以索引0开始
命名日志文件例如log-error-2013-12-21.0.log -->
<maxFileSize>10MB</maxFileSize>
</rollingPolicy>
<!-- 追加方式记录日志 -->
<append>true</append>
<!-- 日志文件的格式 -->
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${FILE_LOG_PATTERN}</pattern>
<charset>utf-8</charset>
</encoder>
</appender>
<!-- 日志记录器日期滚动记录level 根据配置动态输出日志 -->
<appender name="FILE_RELEASE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${LOG_PATH}/log_release.log</file>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- 归档的日志文件的路径,%d{yyyy-MM-dd}指定日期格式,%i指定索引 -->
<fileNamePattern>${LOG_PATH}/release/%d{yyyy-MM-dd,aux}/log-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!--日志最大的历史7天-->
<maxHistory>7</maxHistory>
<!-- 除按日志记录之外还配置了日志文件不能超过2M若超过2M日志文件会以索引0开始
命名日志文件例如log-error-2013-12-21.0.log -->
<maxFileSize>10MB</maxFileSize>
</rollingPolicy>
<!-- 追加方式记录日志 -->
<append>true</append>
<!-- 日志文件的格式 -->
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${FILE_LOG_PATTERN}</pattern>
<charset>utf-8</charset>
</encoder>
<!-- 此日志文件只记录warn级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>${LOG_LEVEL}</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 异步输出 DEBUG -->
<appender name="ASYNC_FILE_DEBUG" class="ch.qos.logback.classic.AsyncAppender">
<discardingThreshold>0</discardingThreshold>
<queueSize>256</queueSize>
<appender-ref ref="FILE_DEBUG"/>
</appender>
<!-- 异步输出 INFO -->
<appender name="ASYNC_FILE_INFO" class="ch.qos.logback.classic.AsyncAppender">
<discardingThreshold>0</discardingThreshold>
<queueSize>256</queueSize>
<appender-ref ref="FILE_INFO"/>
</appender>
<!-- 异步输出 WARN -->
<appender name="ASYNC_FILE_WARN" class="ch.qos.logback.classic.AsyncAppender">
<discardingThreshold>0</discardingThreshold>
<queueSize>256</queueSize>
<appender-ref ref="FILE_WARN"/>
</appender>
<!-- 异步输出 ERROR -->
<appender name="ASYNC_FILE_ERROR" class="ch.qos.logback.classic.AsyncAppender">
<discardingThreshold>0</discardingThreshold>
<queueSize>256</queueSize>
<appender-ref ref="FILE_ERROR"/>
</appender>
<!-- 异步输出 ALL -->
<appender name="ASYNC_FILE_ALL" class="ch.qos.logback.classic.AsyncAppender">
<discardingThreshold>0</discardingThreshold>
<queueSize>256</queueSize>
<appender-ref ref="FILE_ALL"/>
</appender>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<charset>utf-8</charset>
</encoder>
</appender>
<!-- 异步输出 控制台 -->
<appender name="ASYNC_STDOUT" class="ch.qos.logback.classic.AsyncAppender">
<discardingThreshold>0</discardingThreshold>
<queueSize>256</queueSize>
<appender-ref ref="STDOUT"/>
</appender>
<!--<appender name="LOGSTASH" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
&lt;!&ndash; 必填目标LogStash的 IP:Port &ndash;&gt;
<destination>192.168.0.50:50000</destination>
&lt;!&ndash; 可选:保持程序存活时间 &ndash;&gt;
<keepAliveDuration>5 minutes</keepAliveDuration>
&lt;!&ndash; 可选:重连延迟时长 &ndash;&gt;
<reconnectionDelay>10 second</reconnectionDelay>
&lt;!&ndash; 可选:等待策略 &ndash;&gt;
<waitStrategyType>sleeping</waitStrategyType>
&lt;!&ndash; ============ encoder必须配置,有多种可选 ============= &ndash;&gt;
&lt;!&ndash; 编码器二LoggingEventCompositeJsonEncoder &ndash;&gt;
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
<providers>
&lt;!&ndash; 时间戳:时区 &ndash;&gt;
<timestamp>
<timeZone>UTC</timeZone>
</timestamp>
&lt;!&ndash; 模式 &ndash;&gt;
<pattern>
<pattern>
{
"severity": "%level",
"service": "${SERVICE_NAME:-}",
"trace": "%X{X-B3-TraceId:-}",
"span": "%X{X-B3-SpanId:-}",
"exportable": "%X{X-Span-Export:-}",
"pid": "${PID:-}",
"thread": "%thread",
"class": "%logger{40}",
"msg": "%message"
&lt;!&ndash;"idx_pre": "elk-original-third-access",&ndash;&gt;
&lt;!&ndash;"json": "#asJson{%message}" 这个asJson可以把对应的字符串作为json对象取出来这样es可以对json里面的字段索引了&ndash;&gt;
}
</pattern>
</pattern>
</providers>
</encoder>
</appender>-->
<root level="${LOG_LEVEL}">
<appender-ref ref="ASYNC_STDOUT"/>
<appender-ref ref="ASYNC_FILE_ERROR"/>
<appender-ref ref="ASYNC_FILE_INFO"/>
<appender-ref ref="ASYNC_FILE_WARN"/>
<appender-ref ref="ASYNC_FILE_DEBUG"/>
<appender-ref ref="ASYNC_FILE_ALL"/>
<!--<appender-ref ref="LOGSTASH"/>-->
</root>
</configuration>

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.yunzhupaas</groupId>
<artifactId>yunzhupaas-datareport-univer</artifactId>
<version>5.2.0-RELEASE</version>
</parent>
<artifactId>yunzhupaas-datareport-univer-biz</artifactId>
<dependencies>
<dependency>
<groupId>com.yunzhupaas</groupId>
<artifactId>yunzhupaas-datareport-univer-entity</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,16 @@
package com.yunzhupaas.mapper;
import com.yunzhupaas.base.mapper.SuperMapper;
import com.yunzhupaas.entity.DictionaryDataEntity;
/**
* 字典数据
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2023/09/27
*/
public interface DictionaryDataMapper extends SuperMapper<DictionaryDataEntity> {
}

View File

@@ -0,0 +1,14 @@
package com.yunzhupaas.mapper;
import com.yunzhupaas.base.mapper.SuperMapper;
import com.yunzhupaas.entity.ReportEntity;
/**
* @author :云筑产品开发平台组
* @version: V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024/5/11 下午4:35
*/
public interface ReportMapper extends SuperMapper<ReportEntity> {
}

View File

@@ -0,0 +1,14 @@
package com.yunzhupaas.mapper;
import com.yunzhupaas.base.mapper.SuperMapper;
import com.yunzhupaas.entity.ReportVersionEntity;
/**
* @author :云筑产品开发平台组
* @version: V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024/5/11 下午4:35
*/
public interface ReportVersionMapper extends SuperMapper<ReportVersionEntity> {
}

View File

@@ -0,0 +1,14 @@
package com.yunzhupaas.mapper;
import com.yunzhupaas.base.mapper.SuperMapper;
import com.yunzhupaas.entity.UserEntity;
/**
* @author :云筑产品开发平台组
* @version: V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024/5/11 下午4:35
*/
public interface UserMapper extends SuperMapper<UserEntity> {
}

View File

@@ -0,0 +1,19 @@
package com.yunzhupaas.service;
import com.yunzhupaas.base.service.SuperService;
import com.yunzhupaas.entity.DictionaryDataEntity;
import java.util.List;
/**
* 字典数据
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2023/09/27
*/
public interface DictionaryDataService extends SuperService<DictionaryDataEntity> {
List<DictionaryDataEntity> getDictionName(List<String> id);
}

View File

@@ -0,0 +1,73 @@
package com.yunzhupaas.service;
import com.yunzhupaas.base.service.SuperService;
import com.yunzhupaas.entity.ReportEntity;
import com.yunzhupaas.model.report.ReportCrForm;
import com.yunzhupaas.model.report.ReportInfoVO;
import com.yunzhupaas.model.report.ReportPagination;
import com.yunzhupaas.model.report.ReportUpForm;
import java.util.List;
/**
* @author :云筑产品开发平台组
* @version: V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024/5/11 下午4:35
*/
public interface ReportService extends SuperService<ReportEntity> {
/**
* 列表
*
* @return 实体类
*/
List<ReportEntity> getList(ReportPagination pagination);
/**
* 创建
*/
void create(ReportCrForm form);
/**
* 更新
*/
void update(String id, ReportEntity entity);
/**
* 获取详情
*
* @return ReportInfoVO
*/
ReportInfoVO getVersionInfo(String versionId);
/**
* 保存或者发布 通过type0-保存1-发布
*
* @param form
*/
void saveOrRelease(ReportUpForm form);
/**
* 下拉选择
*
*/
List<ReportEntity> getTreeList();
/**
* 删除
*
* @param id
*/
void delete(String id);
/**
* 导入模板
*
* @param infoVO
* @param type
* @return
*/
String importData(ReportInfoVO infoVO, Integer type);
}

View File

@@ -0,0 +1,88 @@
package com.yunzhupaas.service;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.yunzhupaas.base.Pagination;
import com.yunzhupaas.base.service.SuperService;
import com.yunzhupaas.entity.ReportVersionEntity;
import com.yunzhupaas.model.report.ReportCrForm;
import com.yunzhupaas.model.report.ReportPagination;
import com.yunzhupaas.model.report.UploaderVO;
import com.yunzhupaas.univer.model.UniverPreview;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
* @author :云筑产品开发平台组
* @version: V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024/5/11 下午4:35
*/
public interface ReportVersionService extends SuperService<ReportVersionEntity> {
/**
* 创建版本
*
* @param form
*/
void create(ReportCrForm form);
/**
* 获取版本列表
*
* @param templateId
* @return
*/
List<ReportVersionEntity> getList(String templateId, SFunction<ReportVersionEntity, ?>... columns);
/**
* 复制版本(点击新增版本)
*
* @param versionId
*/
String copyVersion(String versionId);
/**
* 根据id删除版本
*
* @param templateId
* @return
*/
void removeByTemplateId(String templateId);
/**
* 预览数据
*
* @return
*/
UniverPreview preview(String id, ReportPagination pagination, Map<String, Object> params);
/**
* 预览数据
*
* @return
*/
UniverPreview previewTemplate(String id, ReportPagination pagination, Map<String, Object> params);
/**
* 导入excel
*
* @param multipartFile
*/
UniverPreview importExcel(MultipartFile multipartFile) throws IOException;
/**
* 导出excel
*
*/
UploaderVO downExcel(ReportPagination pagination, Map<String, Object> params);
/**
* 导出excel
*
* @param pagination
*/
UploaderVO downExcel(ReportPagination pagination);
}

View File

@@ -0,0 +1,23 @@
package com.yunzhupaas.service;
import com.yunzhupaas.base.service.SuperService;
import com.yunzhupaas.entity.UserEntity;
import java.util.List;
/**
* @author :云筑产品开发平台组
* @version: V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024/5/11 下午4:35
*/
public interface UserService extends SuperService<UserEntity> {
/**
*
* @param idList
* @return
*/
List<UserEntity> getUserName(List<String> idList);
}

View File

@@ -0,0 +1,36 @@
package com.yunzhupaas.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.entity.DictionaryDataEntity;
import com.yunzhupaas.mapper.DictionaryDataMapper;
import com.yunzhupaas.service.DictionaryDataService;
import org.springframework.stereotype.Service;
import java.util.*;
/**
* 字典数据
*
* @author 云筑产品开发平台组
* @version V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2023/09/27
*/
@Service
public class DictionaryDataServiceImpl extends SuperServiceImpl<DictionaryDataMapper, DictionaryDataEntity>
implements DictionaryDataService {
@Override
public List<DictionaryDataEntity> getDictionName(List<String> id) {
List<DictionaryDataEntity> dictionList = new ArrayList<>();
if (id.size() > 0) {
QueryWrapper<DictionaryDataEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().and(
t -> t.in(DictionaryDataEntity::getId, id));
dictionList = this.list(queryWrapper);
}
return dictionList;
}
}

View File

@@ -0,0 +1,271 @@
package com.yunzhupaas.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.http.Method;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yunzhupaas.base.ActionResult;
import com.yunzhupaas.base.UserInfo;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.constant.MsgCode;
import com.yunzhupaas.consts.ApiConst;
import com.yunzhupaas.emnus.DataSetTypeEnum;
import com.yunzhupaas.entity.ReportEntity;
import com.yunzhupaas.entity.ReportVersionEntity;
import com.yunzhupaas.exception.DataException;
import com.yunzhupaas.mapper.ReportMapper;
import com.yunzhupaas.model.data.DataForm;
import com.yunzhupaas.model.data.DataSetInfo;
import com.yunzhupaas.model.data.DataSetPagination;
import com.yunzhupaas.model.report.ReportCrForm;
import com.yunzhupaas.model.report.ReportInfoVO;
import com.yunzhupaas.model.report.ReportPagination;
import com.yunzhupaas.model.report.ReportUpForm;
import com.yunzhupaas.service.ReportService;
import com.yunzhupaas.service.ReportVersionService;
import com.yunzhupaas.util.*;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
/**
* @author :云筑产品开发平台组
* @version: V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024/5/11 下午4:35
*/
@Service
public class ReportServiceImpl extends SuperServiceImpl<ReportMapper, ReportEntity> implements ReportService {
@Autowired
private ReportVersionService versionService;
@Override
public List<ReportEntity> getList(ReportPagination pagination) {
QueryWrapper<ReportEntity> queryWrapper = new QueryWrapper<>();
String keyword = pagination.getKeyword();
if (ObjectUtil.isNotEmpty(keyword)) {
queryWrapper.lambda()
.and(t -> t.like(ReportEntity::getEnCode, keyword).or().like(ReportEntity::getFullName, keyword));
}
if (ObjectUtil.isNotEmpty(pagination.getCategory())) {
queryWrapper.lambda().eq(ReportEntity::getCategory, pagination.getCategory());
}
if (ObjectUtil.isNotEmpty(pagination.getState())) {
queryWrapper.lambda().eq(ReportEntity::getEnabledMark, pagination.getState());
}
queryWrapper.lambda().orderByAsc(ReportEntity::getSortCode).orderByDesc(ReportEntity::getCreatorTime);
Page<ReportEntity> page = new Page<>(pagination.getCurrentPage(), pagination.getPageSize());
IPage<ReportEntity> userPage = this.page(page, queryWrapper);
return pagination.setData(userPage.getRecords(), page.getTotal());
}
@Override
public void create(ReportCrForm form) {
ReportEntity entity = JsonUtil.getJsonToBean(form, ReportEntity.class);
UserInfo userInfo = UserProvider.getUser();
this.creUpdateCheck(entity, true, true);
String id = StringUtil.isNotEmpty(entity.getId()) ? entity.getId() : RandomUtil.uuId();
entity.setId(id);
entity.setEnabledMark(0);
entity.setCreatorUserId(userInfo.getUserId());
entity.setCreatorTime(new Date());
entity.setLastModifyUserId(null);
entity.setLastModifyTime(null);
this.setIgnoreLogicDelete().removeById(entity.getId());
this.setIgnoreLogicDelete().saveOrUpdate(entity);
this.clearIgnoreLogicDelete();
form.setId(id);
List<ReportVersionEntity> list = versionService.getList(id, ReportVersionEntity::getId);
if (CollectionUtils.isEmpty(list)) {
versionService.create(form);
}
}
@Override
public void update(String id, ReportEntity entity) {
ReportEntity report = getById(id);
this.creUpdateCheck(entity, !report.getFullName().equals(entity.getFullName()),
!report.getEnCode().equals(entity.getEnCode()));
entity.setId(id);
updateById(entity);
}
@Override
public ReportInfoVO getVersionInfo(String versionId) {
ReportVersionEntity versionEntity = versionService.getById(versionId);
ReportEntity entity = this.getById(versionEntity.getTemplateId());
ReportInfoVO vo = JsonUtil.getJsonToBean(versionEntity, ReportInfoVO.class);
vo.setVersionId(versionId);
vo.setId(entity.getId());
vo.setFullName(entity.getFullName());
vo.setAllowExport(entity.getAllowExport());
vo.setAllowPrint(entity.getAllowPrint());
vo.setCategory(entity.getCategory());
vo.setEnCode(entity.getEnCode());
vo.setSortCode(entity.getSortCode());
DataSetPagination pagination = new DataSetPagination();
pagination.setObjectId(versionId);
pagination.setObjectType(DataSetTypeEnum.REPORT_VER.getCode());
String json = ReportUtil.http(ApiConst.DATASET_LIST, Method.GET, JsonUtil.entityToMap(pagination));
ActionResult result = JsonUtil.getJsonToBean(json, ActionResult.class);
List<DataSetInfo> dataSetList = new ArrayList<>();
if (ObjectUtil.isNotEmpty(result.getData())) {
dataSetList = JsonUtil.getJsonToList(result.getData(), DataSetInfo.class);
}
vo.setDataSetList(dataSetList);
return vo;
}
@Override
public void saveOrRelease(ReportUpForm form) {
ReportVersionEntity versionEntity = versionService.getById(form.getVersionId());
ReportVersionEntity versionNew = JsonUtil.getJsonToBean(form, ReportVersionEntity.class);
versionNew.setId(versionEntity.getId());
versionNew.setState(versionEntity.getState());
ReportEntity entity = this.getById(form.getId());
// 发布流程
if (Objects.equals(form.getType(), 1)) {
// 改流程版本
if (StringUtil.isNotEmpty(form.getVersionId())) {
boolean isRelease = Objects.equals(versionNew.getState(), 2);
ReportVersionEntity info = versionService
.getList(form.getId(), ReportVersionEntity::getId, ReportVersionEntity::getState).stream()
.filter(t -> Objects.equals(t.getState(), 1)).findFirst().orElse(null);
if (info != null) {
// 变更归档状态,排序码
info.setSortCode(0L);
info.setState(2);
versionService.updateById(info);
}
versionNew.setState(1);
versionNew.setSortCode(1L);
entity.setEnabledMark(1);
if (isRelease) {
versionService.updateById(versionNew);
return;
}
}
}
versionService.updateById(versionNew);
// 数据集创建
String versionId = versionNew.getId();
List<DataSetInfo> dataSetList = form.getDataSetList() != null ? form.getDataSetList() : new ArrayList<>();
DataForm dataForm = new DataForm();
dataForm.setObjectId(versionId);
dataForm.setObjectType(DataSetTypeEnum.REPORT_VER.getCode());
dataForm.setList(dataSetList);
ReportUtil.http(ApiConst.DATASET_SAVE, Method.POST, JsonUtil.entityToMap(dataForm));
entity.setAllowExport(form.getAllowExport());
entity.setAllowPrint(form.getAllowPrint());
entity.setLastModifyTime(new Date());
entity.setLastModifyUserId(UserProvider.getLoginUserId());
this.updateById(entity);
}
@Override
public List<ReportEntity> getTreeList() {
QueryWrapper<ReportEntity> query = new QueryWrapper<>();
query.lambda().eq(ReportEntity::getEnabledMark, 1);
query.lambda().orderByAsc(ReportEntity::getSortCode).orderByDesc(ReportEntity::getCreatorTime);
List<ReportEntity> list = this.list(query);
return list;
}
@Override
public void delete(String id) {
removeById(id);
versionService.removeByTemplateId(id);
}
@Override
public String importData(ReportInfoVO infoVO, Integer type) {
ReportEntity entity = JsonUtil.getJsonToBean(infoVO, ReportEntity.class);
StringJoiner stringJoiner = new StringJoiner("");
// id为空切名称不存在时
QueryWrapper<ReportEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ReportEntity::getId, entity.getId());
if (this.getById(infoVO.getId()) != null) {
if (Objects.equals(type, 0)) {
stringJoiner.add("ID");
} else {
entity.setId(RandomUtil.uuId());
}
}
queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ReportEntity::getEnCode, entity.getEnCode());
if (this.count(queryWrapper) > 0) {
stringJoiner.add(MsgCode.IMP009.get());
}
queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ReportEntity::getFullName, entity.getFullName());
if (this.count(queryWrapper) > 0) {
stringJoiner.add(MsgCode.IMP008.get());
}
if (stringJoiner.length() > 0 && ObjectUtil.equal(type, 1)) {
String copyNum = UUID.randomUUID().toString().substring(0, 5);
entity.setFullName(entity.getFullName() + ".副本" + copyNum);
entity.setEnCode(entity.getEnCode() + copyNum);
} else if (ObjectUtil.equal(type, 0) && stringJoiner.length() > 0) {
return stringJoiner + MsgCode.IMP007.get();
}
entity.setEnabledMark(0);
entity.setCreatorTime(new Date());
entity.setCreatorUserId(UserProvider.getLoginUserId());
entity.setLastModifyTime(null);
entity.setLastModifyUserId(null);
this.setIgnoreLogicDelete().removeById(entity);
this.setIgnoreLogicDelete().saveOrUpdate(entity);
this.clearIgnoreLogicDelete();
// 版本添加
ReportVersionEntity versionEntity = JsonUtil.getJsonToBean(infoVO, ReportVersionEntity.class);
String versionId = RandomUtil.uuId();
versionEntity.setId(versionId);
versionEntity.setTemplateId(entity.getId());
versionEntity.setCreatorUserId(UserProvider.getLoginUserId());
versionEntity.setCreatorTime(new Date());
versionEntity.setVersion(1);
versionEntity.setState(0);
versionEntity.setSortCode(0l);
versionService.save(versionEntity);
// 数据集创建
List<DataSetInfo> dataSetList = infoVO.getDataSetList() != null ? infoVO.getDataSetList() : new ArrayList<>();
if (dataSetList.size() > 0) {
DataForm dataForm = new DataForm();
dataForm.setObjectId(versionId);
dataForm.setObjectType(DataSetTypeEnum.REPORT_VER.getCode());
dataForm.setList(dataSetList);
ReportUtil.http(ApiConst.DATASET_SAVE, Method.POST, JsonUtil.entityToMap(dataForm));
}
return "";
}
public void creUpdateCheck(ReportEntity entity, Boolean fullNameCheck, Boolean encodeCheck) {
String fullName = entity.getFullName();
String encode = entity.getEnCode();
// 名称长度验证
if (fullName.length() > 80) {
throw new DataException(MsgCode.EXIST005.get());
}
QueryWrapper<ReportEntity> query = new QueryWrapper<>();
// 重名验证
if (fullNameCheck) {
query.lambda().eq(ReportEntity::getFullName, fullName);
if (this.list(query).size() > 0) {
throw new DataException(MsgCode.EXIST003.get());
}
}
// 编码验证
if (encodeCheck) {
query.clear();
query.lambda().eq(ReportEntity::getEnCode, encode);
if (this.list(query).size() > 0) {
throw new DataException(MsgCode.EXIST002.get());
}
}
}
}

View File

@@ -0,0 +1,303 @@
package com.yunzhupaas.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.http.Method;
import cn.hutool.json.JSONUtil;
import cn.xuyanwu.spring.file.storage.FileInfo;
import com.alibaba.fastjson.JSON;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.google.common.collect.ImmutableList;
import com.yunzhupaas.base.ActionResult;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.constant.MsgCode;
import com.yunzhupaas.consts.ApiConst;
import com.yunzhupaas.emnus.DataSetTypeEnum;
import com.yunzhupaas.entity.ReportEntity;
import com.yunzhupaas.entity.ReportVersionEntity;
import com.yunzhupaas.exception.DataException;
import com.yunzhupaas.mapper.ReportVersionMapper;
import com.yunzhupaas.model.DataQuery;
import com.yunzhupaas.model.data.*;
import com.yunzhupaas.model.report.ReportCrForm;
import com.yunzhupaas.model.report.ReportPagination;
import com.yunzhupaas.model.report.UploaderVO;
import com.yunzhupaas.service.ReportService;
import com.yunzhupaas.service.ReportVersionService;
import com.yunzhupaas.univer.chart.UniverChartModel;
import com.yunzhupaas.univer.data.custom.UniverCustom;
import com.yunzhupaas.univer.model.UniverPreview;
import com.yunzhupaas.univer.model.UniverWorkBook;
import com.yunzhupaas.util.*;
import lombok.Cleanup;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author :云筑产品开发平台组
* @version: V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024/5/11 下午4:35
*/
@Service
public class ReportVersionServiceImpl extends SuperServiceImpl<ReportVersionMapper, ReportVersionEntity>
implements ReportVersionService {
@Autowired
private RedisUtil redisUtil;
@Autowired
private ReportService reportService;
@Override
@DSTransactional
public void create(ReportCrForm form) {
String versionId = RandomUtil.uuId();
ReportVersionEntity entity = JsonUtil.getJsonToBean(form, ReportVersionEntity.class);
entity.setId(versionId);
entity.setTemplateId(form.getId());
entity.setCreatorUserId(UserProvider.getLoginUserId());
entity.setCreatorTime(new Date());
List<ReportVersionEntity> verList = getList(entity.getId(), ReportVersionEntity::getVersion);
int version = verList.stream().map(ReportVersionEntity::getVersion).max(Comparator.naturalOrder()).orElse(0)
+ 1;
entity.setVersion(version);
entity.setState(0);
entity.setSortCode(0l);
this.setIgnoreLogicDelete().removeById(entity.getId());
this.setIgnoreLogicDelete().saveOrUpdate(entity);
this.clearIgnoreLogicDelete();
List<DataSetInfo> dataSetList = form.getDataSetList() != null ? form.getDataSetList() : new ArrayList<>();
if (dataSetList.size() > 0) {
// 数据集创建
DataForm dataForm = new DataForm();
dataForm.setObjectId(versionId);
dataForm.setObjectType(DataSetTypeEnum.REPORT_VER.getCode());
dataForm.setList(dataSetList);
ReportUtil.http(ApiConst.DATASET_SAVE, Method.POST, JsonUtil.entityToMap(dataForm));
}
}
@Override
public List<ReportVersionEntity> getList(String templateId, SFunction<ReportVersionEntity, ?>... columns) {
QueryWrapper<ReportVersionEntity> queryWrapper = new QueryWrapper<>();
if (columns != null && columns.length > 0) {
queryWrapper.lambda().select(columns);
}
queryWrapper.lambda().eq(ReportVersionEntity::getTemplateId, templateId);
queryWrapper.lambda().orderByDesc(ReportVersionEntity::getSortCode).orderByAsc(ReportVersionEntity::getState);
return this.list(queryWrapper);
}
@Override
public String copyVersion(String versionId) {
ReportVersionEntity entity = this.getById(versionId);
ReportVersionEntity versionEntity = JsonUtil.getJsonToBean(entity, ReportVersionEntity.class);
String newVersionId = RandomUtil.uuId();
versionEntity.setId(newVersionId);
List<ReportVersionEntity> verList = getList(entity.getTemplateId(), ReportVersionEntity::getVersion);
int version = verList.stream().map(ReportVersionEntity::getVersion).max(Comparator.naturalOrder()).orElse(0)
+ 1;
versionEntity.setVersion(version);
versionEntity.setState(0);
versionEntity.setSortCode(0l);
versionEntity.setCreatorTime(new Date());
versionEntity.setCreatorUserId(UserProvider.getLoginUserId());
versionEntity.setLastModifyTime(null);
versionEntity.setLastModifyUserId(null);
DataSetPagination pagination = new DataSetPagination();
pagination.setObjectId(versionId);
pagination.setObjectType(DataSetTypeEnum.REPORT_VER.getCode());
String json = ReportUtil.http(ApiConst.DATASET_LIST, Method.GET, JsonUtil.entityToMap(pagination));
ActionResult result = JsonUtil.getJsonToBean(json, ActionResult.class);
List<DataSetInfo> dataSetList = new ArrayList<>();
if (ObjectUtil.isNotEmpty(result.getData())) {
dataSetList.addAll(JsonUtil.getJsonToList(result.getData(), DataSetInfo.class));
}
if (dataSetList.size() > 0) {
for (DataSetInfo item : dataSetList) {
item.setId(null);
item.setObjectType(DataSetTypeEnum.REPORT_VER.getCode());
item.setObjectId(newVersionId);
}
DataForm dataForm = new DataForm();
dataForm.setObjectId(newVersionId);
dataForm.setObjectType(DataSetTypeEnum.REPORT_VER.getCode());
dataForm.setList(dataSetList);
ReportUtil.http(ApiConst.DATASET_SAVE, Method.POST, JsonUtil.entityToMap(dataForm));
}
this.save(versionEntity);
return newVersionId;
}
@Override
public void removeByTemplateId(String templateId) {
QueryWrapper<ReportVersionEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ReportVersionEntity::getTemplateId, templateId);
this.remove(queryWrapper);
}
@Override
public UniverPreview preview(String id, ReportPagination pagination, Map<String, Object> params) {
ReportVersionEntity entity = getById(id);
if (ObjectUtil.isEmpty(entity)) {
throw new DataException(MsgCode.FA015.get());
}
if (ObjectUtil.isEmpty(entity.getSnapshot())) {
throw new DataException(MsgCode.FA105.get());
}
Object univerData = redisUtil.getString(id);
if (ObjectUtil.isNotEmpty(univerData)) {
return JsonUtil.getJsonToBean(String.valueOf(univerData), UniverPreview.class);
}
// 获取当前
UniverWorkBook univerWorkBook = JsonUtil.getJsonToBean(entity.getSnapshot(), UniverWorkBook.class);
List<String> sheetOrder = univerWorkBook.getSheetOrder();
ReportEntity report = reportService.getById(entity.getTemplateId());
Map<String, Map<String, List<Map<String, Object>>>> sheetData = new HashMap<>();
Map<String, Map<String, Map<String, Object>>> parameterData = new HashMap<>();
// 当前数据
String sheet = StringUtil.isNotEmpty(pagination.getSheetId()) ? pagination.getSheetId()
: !sheetOrder.isEmpty() ? sheetOrder.get(0) : null;
for (String sheetId : sheetOrder) {
DataSetQuery query = new DataSetQuery();
query.setModuleId(entity.getTemplateId());
query.setId(id);
Map<String, Object> dataMap = new HashMap<>(params);
Object object = params.get(sheetId);
if (object instanceof Map) {
Map<String, Object> data = (Map<String, Object>) object;
dataMap.putAll(data);
}
query.setMap(dataMap);
query.setType(DataSetTypeEnum.REPORT_VER.getCode());
query.setSnowFlakeId(RandomUtil.uuId());
query.setConvertConfig(entity.getConvertConfig());
List<DataQuery> dataQueryList = StringUtil.isNotEmpty(entity.getQueryList())
? JsonUtil.getJsonToList(entity.getQueryList(), DataQuery.class)
: new ArrayList<>();
Map<String, List<DataQuery>> queryMap = dataQueryList.stream()
.collect(Collectors.groupingBy(DataQuery::getSheet));
List<DataQuery> queryListAll = queryMap.get(sheetId) != null ? queryMap.get(sheetId) : new ArrayList<>();
List<Object> queryList = new ArrayList<>();
if (Objects.equals(sheetId, sheet)) {
for (DataQuery dataQuery : queryListAll) {
queryList.addAll(dataQuery.getQueryList());
}
}
query.setQueryList(JSONUtil.toJsonStr(queryList));
String sheetJson = ReportUtil.http(ApiConst.DATASET_DATA, Method.POST, JsonUtil.entityToMap(query));
if (StringUtil.isNotEmpty(sheetJson)) {
Map<String, List<Map<String, Object>>> dataList = new HashMap<>();
try {
ActionResult result = JsonUtil.getJsonToBean(sheetJson, ActionResult.class);
if (ObjectUtil.isNotEmpty(result) && result.getData() instanceof Map) {
Map<String, List<Map<String, Object>>> data = JsonUtil.getJsonToBean(result.getData(),
Map.class);
dataList.putAll(data);
}
} catch (Exception e) {
}
sheetData.put(sheetId, dataList);
}
// 参数数据
String parameterJson = ReportUtil.http(ApiConst.PARAMETER_DATA, Method.POST, JsonUtil.entityToMap(query));
if (StringUtil.isNotEmpty(parameterJson)) {
Map<String, Map<String, Object>> dataList = new HashMap<>();
try {
ActionResult result = JsonUtil.getJsonToBean(parameterJson, ActionResult.class);
if (ObjectUtil.isNotEmpty(result) && result.getData() instanceof Map) {
Map<String, Map<String, Object>> data = JsonUtil.getJsonToBean(result.getData(), Map.class);
dataList.putAll(data);
}
} catch (Exception e) {
}
parameterData.put(sheetId, dataList);
}
}
UniverConvert convert = new UniverConvert();
UniverPreview vo = convert.transform(entity.getSnapshot(), entity.getCells(), entity.getSortList(), sheetData,
parameterData);
vo.setVersionId(id);
vo.setQueryList(entity.getQueryList());
vo.setFullName(report.getFullName());
vo.setAllowExport(report.getAllowExport());
vo.setAllowPrint(report.getAllowPrint());
redisUtil.insert(id, JSON.toJSONString(vo), 5);
return vo;
}
@Override
public UniverPreview previewTemplate(String id, ReportPagination pagination, Map<String, Object> params) {
ReportVersionEntity entity = getList(id, ReportVersionEntity::getId, ReportVersionEntity::getState).stream()
.filter(t -> Objects.equals(t.getState(), 1)).findFirst().orElse(null);
if (ObjectUtil.isEmpty(entity)) {
throw new DataException(MsgCode.FA015.get());
}
return preview(entity.getId(), pagination, params);
}
@Override
public UniverPreview importExcel(MultipartFile multipartFile) throws IOException {
UniverCustom cellData = new UniverCustom();
UniverWorkBook univerWorkBook = UniverExcel.formFile(multipartFile);
UniverPreview vo = new UniverPreview();
vo.setSnapshot(JSONUtil.toJsonStr(univerWorkBook));
vo.setCells(JSONUtil.toJsonStr(cellData));
return vo;
}
@Override
public UploaderVO downExcel(ReportPagination pagination, Map<String, Object> params) {
String id = pagination.getId();
UploaderVO vo = new UploaderVO();
ReportVersionEntity versionEntity = getById(id);
if (ObjectUtil.isEmpty(versionEntity)) {
return vo;
}
ReportEntity entity = reportService.getById(versionEntity.getTemplateId());
UniverPreview preview = preview(id, pagination, params);
pagination.setSnapshot(preview.getSnapshot());
pagination.setFullName(entity.getFullName());
vo = downExcel(pagination);
return vo;
}
@Override
public UploaderVO downExcel(ReportPagination pagination) {
UploaderVO vo = new UploaderVO();
if (StringUtil.isNotEmpty(pagination.getSnapshot())) {
try {
List<UniverChartModel> chartList = new ArrayList<>();
@Cleanup
XSSFWorkbook workbook = new XSSFWorkbook();
List<String> sheetList = ImmutableList.of(pagination.getSheetId());
UniverExcel.downExcel(pagination.getSnapshot(), chartList, workbook, sheetList);
String fileName = pagination.getFullName() + ".xlsx";
@Cleanup
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
workbook.write(outputStream);
String type = "Temporary";
String url = "/api/Report/data/Download?name=" + fileName + "&encryption=";
String temporaryFilePath = FilePathUtil.getFilePath(type);
FileInfo fileInfo = FileUploadUtils.uploadFile(outputStream.toByteArray(), temporaryFilePath, fileName);
vo.setName(fileInfo.getFilename());
vo.setUrl(UploaderUtil.uploaderFile(url, fileInfo.getFilename() + "#" + type));
} catch (Exception e) {
log.error("报表导出excel异常" + e.getMessage());
throw new DataException(MsgCode.FA107.get());
}
}
return vo;
}
}

View File

@@ -0,0 +1,32 @@
package com.yunzhupaas.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.entity.UserEntity;
import com.yunzhupaas.mapper.UserMapper;
import com.yunzhupaas.service.UserService;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* @author :云筑产品开发平台组
* @version: V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024/5/11 下午4:35
*/
@Service
public class UserServiceImpl extends SuperServiceImpl<UserMapper, UserEntity> implements UserService {
@Override
public List<UserEntity> getUserName(List<String> idList) {
List<UserEntity> list = new ArrayList<>();
if (idList.size() > 0) {
QueryWrapper<UserEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().in(UserEntity::getId, idList);
list = this.list(queryWrapper);
}
return list;
}
}

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.yunzhupaas</groupId>
<artifactId>yunzhupaas-datareport-univer</artifactId>
<version>5.2.0-RELEASE</version>
</parent>
<artifactId>yunzhupaas-datareport-univer-controller</artifactId>
<dependencies>
<dependency>
<groupId>com.yunzhupaas</groupId>
<artifactId>yunzhupaas-datareport-univer-biz</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,393 @@
package com.yunzhupaas.controller;
import cn.hutool.http.Method;
import cn.xuyanwu.spring.file.storage.FileInfo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import com.yunzhupaas.base.ActionResult;
import com.yunzhupaas.base.vo.DownloadVO;
import com.yunzhupaas.base.vo.ListVO;
import com.yunzhupaas.base.vo.PageListVO;
import com.yunzhupaas.base.vo.PaginationVO;
import com.yunzhupaas.constant.GlobalConst;
import com.yunzhupaas.constant.MsgCode;
import com.yunzhupaas.consts.ApiConst;
import com.yunzhupaas.emnus.ModuleTypeEnum;
import com.yunzhupaas.entity.DictionaryDataEntity;
import com.yunzhupaas.entity.ReportEntity;
import com.yunzhupaas.entity.ReportVersionEntity;
import com.yunzhupaas.entity.UserEntity;
import com.yunzhupaas.exception.DataException;
import com.yunzhupaas.model.data.DataSetInfo;
import com.yunzhupaas.model.data.MenuModel;
import com.yunzhupaas.model.data.ModuleNameVO;
import com.yunzhupaas.model.report.*;
import com.yunzhupaas.service.DictionaryDataService;
import com.yunzhupaas.service.ReportService;
import com.yunzhupaas.service.ReportVersionService;
import com.yunzhupaas.service.UserService;
import com.yunzhupaas.util.*;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author :云筑产品开发平台组
* @version: V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024/5/11 下午4:35
*/
@Tag(name = "报表信息", description = "Report")
@RestController
@RequestMapping("/api/Report")
public class ReportController {
@Autowired
private ReportService reportService;
@Autowired
private UserService userService;
@Autowired
private DictionaryDataService dictionaryDataService;
@Autowired
private ReportVersionService versionService;
@Operation(summary = "列表")
@GetMapping
public ActionResult<PageListVO<ReportListVO>> list(ReportPagination paginationPrint) {
List<ReportEntity> list = reportService.getList(paginationPrint);
List<String> userId = new ArrayList<>();
userId.addAll(list.stream().filter(t -> StringUtil.isNotEmpty(t.getCreatorUserId()))
.map(ReportEntity::getCreatorUserId).collect(Collectors.toList()));
userId.addAll(list.stream().filter(t -> StringUtil.isNotEmpty(t.getLastModifyUserId()))
.map(ReportEntity::getLastModifyUserId).collect(Collectors.toList()));
List<UserEntity> userList = userService.getUserName(userId);
List<String> dictionary = new ArrayList<>();
dictionary.addAll(list.stream().map(ReportEntity::getCategory).collect(Collectors.toList()));
List<DictionaryDataEntity> dictionList = dictionaryDataService.getDictionName(dictionary);
List<ReportListVO> listVOS = new ArrayList<>();
for (ReportEntity entity : list) {
ReportListVO vo = JsonUtil.getJsonToBean(entity, ReportListVO.class);
vo.setState(vo.getEnabledMark());
DictionaryDataEntity dataEntity = dictionList.stream().filter(t -> t.getId().equals(entity.getCategory()))
.findFirst().orElse(null);
vo.setCategory(dataEntity != null ? dataEntity.getFullName() : "");
// 创建者
UserEntity creatorUser = userList.stream().filter(t -> t.getId().equals(entity.getCreatorUserId()))
.findFirst().orElse(null);
vo.setCreatorUser(creatorUser != null ? creatorUser.getRealName() + "/" + creatorUser.getAccount()
: entity.getCreatorUserId());
// 修改人
UserEntity lastModifyUser = userList.stream().filter(t -> t.getId().equals(entity.getLastModifyUserId()))
.findFirst().orElse(null);
vo.setLastModifyUser(
lastModifyUser != null ? lastModifyUser.getRealName() + "/" + lastModifyUser.getAccount()
: entity.getLastModifyUserId());
listVOS.add(vo);
}
PaginationVO paginationVO = JsonUtil.getJsonToBean(paginationPrint, PaginationVO.class);
return ActionResult.page(listVOS, paginationVO);
}
@PostMapping
@Operation(summary = "新建")
@Parameters({
@Parameter(name = "form", description = "模型", required = true),
})
public ActionResult create(@RequestBody ReportCrForm form) {
form.setAllowExport(1);
form.setAllowPrint(1);
reportService.create(form);
return ActionResult.success(MsgCode.SU001.get(), form.getId());
}
@Operation(summary = "详情")
@Parameters({
@Parameter(name = "id", description = "模板id")
})
@GetMapping("/{id}")
public ActionResult<ReportInfoVO> info(@PathVariable("id") String id) {
ReportEntity byId = reportService.getById(id);
ReportInfoVO vo = JsonUtil.getJsonToBean(byId, ReportInfoVO.class);
return ActionResult.success(vo);
}
@Operation(summary = "更新")
@PutMapping("/{id}")
@Parameters({
@Parameter(name = "id", description = "主键", required = true),
@Parameter(name = "form", description = "模型", required = true),
})
public ActionResult update(@PathVariable("id") String id, @RequestBody ReportUpForm form) {
ReportEntity entity = JsonUtil.getJsonToBean(form, ReportEntity.class);
reportService.update(id, entity);
return ActionResult.success(MsgCode.SU004.get());
}
@Operation(summary = "删除")
@Parameters({
@Parameter(name = "id", description = "模板id", required = true)
})
@DeleteMapping("/{id}")
public ActionResult delete(@PathVariable String id) {
if (reportService.getById(id) != null) {
reportService.delete(id);
return ActionResult.success(MsgCode.SU003.get());
} else {
return ActionResult.fail(MsgCode.FA003.get());
}
}
/* ============版本增删改============== */
@Operation(summary = "版本详情")
@Parameters({
@Parameter(name = "versionId", description = "版本id", required = true)
})
@GetMapping("/Info/{versionId}")
public ActionResult<ReportInfoVO> versionInfo(@PathVariable String versionId) {
ReportInfoVO info = reportService.getVersionInfo(versionId);
return ActionResult.success(info);
}
@Operation(summary = "版本新增")
@Parameters({
@Parameter(name = "versionId", description = "版本id", required = true)
})
@PostMapping("/Info/{versionId}")
public ActionResult copyVersion(@PathVariable String versionId) {
String newVersionId = versionService.copyVersion(versionId);
return ActionResult.success(MsgCode.SU005.get(), newVersionId);
}
@Operation(summary = "版本删除")
@Parameters({
@Parameter(name = "versionId", description = "版本id", required = true)
})
@DeleteMapping("/Info/{versionId}")
public ActionResult deleteVersion(@PathVariable String versionId) {
ReportVersionEntity entity = versionService.getById(versionId);
if (entity != null) {
List<ReportVersionEntity> list = versionService.getList(entity.getTemplateId(), ReportVersionEntity::getId);
if (list.size() == 1) {
return ActionResult.fail(MsgCode.SYS043.get());
}
if (Objects.equals(entity.getState(), 1)) {
return ActionResult.fail(MsgCode.SYS044.get());
}
if (Objects.equals(entity.getState(), 2)) {
return ActionResult.fail(MsgCode.SYS045.get());
}
versionService.removeById(versionId);
}
return ActionResult.success(MsgCode.SU003.get());
}
@Operation(summary = "版本列表")
@Parameters({
@Parameter(name = "id", description = "模板id", required = true)
})
@GetMapping("/Version/{id}")
public ActionResult<List<ReportVersionListVO>> versionList(@PathVariable String id) {
List<ReportVersionEntity> list = versionService.getList(id, ReportVersionEntity::getId,
ReportVersionEntity::getState, ReportVersionEntity::getVersion);
List<ReportVersionListVO> listVO = new ArrayList<>();
for (ReportVersionEntity jsonEntity : list) {
ReportVersionListVO vo = JsonUtil.getJsonToBean(jsonEntity, ReportVersionListVO.class);
vo.setFullName("报表版本V" + vo.getVersion());
listVO.add(vo);
}
if (listVO.isEmpty()) {
return ActionResult.fail(MsgCode.PRI008.get());
}
return ActionResult.success(listVO);
}
@Operation(summary = "保存或者发布")
@PostMapping("/Save")
public ActionResult saveOrRelease(@RequestBody ReportUpForm form) {
reportService.saveOrRelease(form);
if (Objects.equals(form.getType(), 1)) {
return ActionResult.success(MsgCode.SU011.get());
}
return ActionResult.success(MsgCode.SU002.get());
}
@Operation(summary = "复制")
@Parameters({
@Parameter(name = "id", description = "模板id", required = true)
})
@PostMapping("/{id}/Actions/Copy")
public ActionResult copy(@PathVariable String id) {
ReportEntity entity = reportService.getById(id);
String copyNum = UUID.randomUUID().toString().substring(0, 5);
String fullName = entity.getFullName() + ".副本" + copyNum;
if (fullName.length() > 50) {
return ActionResult.fail(MsgCode.PRI006.get());
}
List<ReportVersionEntity> list = versionService.getList(id, ReportVersionEntity::getId);
ReportInfoVO info = new ReportInfoVO();
List<DataSetInfo> listVO = new ArrayList<>();
if (CollectionUtils.isNotEmpty(list)) {
info = reportService.getVersionInfo(list.get(0).getId());
List<DataSetInfo> dataSetList = info.getDataSetList() != null ? info.getDataSetList() : new ArrayList<>();
for (DataSetInfo dataSetInfo : dataSetList) {
dataSetInfo.setObjectId(null);
dataSetInfo.setId(null);
listVO.add(dataSetInfo);
}
}
ReportCrForm form = JsonUtil.getJsonToBean(info, ReportCrForm.class);
form.setFullName(fullName);
form.setEnCode(entity.getEnCode() + copyNum);
form.setCategory(entity.getCategory());
form.setSortCode(entity.getSortCode());
form.setDescription(entity.getDescription());
form.setId(null);
reportService.create(form);
return ActionResult.success(MsgCode.SU007.get());
}
@Operation(summary = "导出")
@Parameters({
@Parameter(name = "id", description = "模板id")
})
@GetMapping("/{id}/Actions/Export")
public ActionResult<DownloadVO> export(@PathVariable String id) {
DownloadVO vo = new DownloadVO();
ReportEntity entity = reportService.getById(id);
List<ReportVersionEntity> list = versionService.getList(id, ReportVersionEntity::getId);
if (CollectionUtils.isEmpty(list)) {
throw new DataException(MsgCode.FA001.get());
}
ReportInfoVO info = reportService.getVersionInfo(list.get(0).getId());
String json = JsonUtil.getObjectToString(info);
String tableName = ModuleTypeEnum.REPORT_TEMPLATE.getTableName();
String fileName = entity.getFullName() + "_" + DateUtil.dateFormatByPattern(new Date(), "yyyyMMddHHmmss") + "."
+ tableName;
try {
String type = "Temporary";
String url = "/api/Report/data/Download?name=" + fileName + "&encryption=";
String temporaryFilePath = FilePathUtil.getFilePath(type);
FileInfo fileInfo = FileUploadUtils.uploadFile(json.getBytes(GlobalConst.DEFAULT_CHARSET),
temporaryFilePath, fileName);
vo.setName(fileInfo.getFilename());
vo.setUrl(UploaderUtil.uploaderFile(url, fileInfo.getFilename() + "#" + type));
} catch (Exception e) {
}
return ActionResult.success(vo);
}
@Operation(summary = "导入")
@PostMapping(value = "/Actions/Import", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ActionResult importData(@RequestPart("file") MultipartFile multipartFile,
@RequestParam("type") Integer type) throws DataException {
// 判断是否为.rp结尾
if (FileUtil.existsSuffix(multipartFile, ModuleTypeEnum.REPORT_TEMPLATE.getTableName())) {
return ActionResult.fail(MsgCode.IMP002.get());
}
// 读取文件内容
String fileContent = FileUtil.getFileContent(multipartFile);
ReportInfoVO infVo = JsonUtil.getJsonToBean(fileContent, ReportInfoVO.class);
String str = reportService.importData(infVo, type);
if (StringUtil.isNotEmpty(str)) {
return ActionResult.fail(str);
}
return ActionResult.success(MsgCode.IMP001.get());
}
@Operation(summary = "下拉列表")
@GetMapping("/Selector")
public ActionResult<ListVO<ReportSelectVO>> selectorList() {
List<ReportEntity> list = reportService.getTreeList();
List<String> dictionary = new ArrayList<>();
dictionary.addAll(list.stream().map(ReportEntity::getCategory).collect(Collectors.toList()));
List<DictionaryDataEntity> dictionList = dictionaryDataService.getDictionName(dictionary);
Map<String, List<ReportEntity>> map = list.stream().collect(Collectors.groupingBy(ReportEntity::getCategory));
List<ReportSelectVO> listVO = new ArrayList<>();
for (DictionaryDataEntity entity : dictionList) {
List<ReportEntity> entityList = map.get(entity.getId()) != null ? map.get(entity.getId())
: new ArrayList<>();
if (entityList.size() > 0) {
ReportSelectVO vo = new ReportSelectVO();
vo.setId(entity.getId());
vo.setFullName(entity.getFullName());
vo.setHasChildren(true);
vo.setChildren(JsonUtil.getJsonToList(entityList, ReportSelectVO.class));
listVO.add(vo);
}
}
ListVO vo = new ListVO<>();
vo.setList(listVO);
return ActionResult.success(vo);
}
@Operation(summary = "报表发布菜单")
@Parameters({
@Parameter(name = "id", description = "模板id", required = true)
})
@PostMapping("/{id}/Actions/Module")
public ActionResult module(@PathVariable String id, @RequestBody MenuModel model) {
ReportEntity entity = reportService.getById(id);
if (entity == null) {
return ActionResult.fail(MsgCode.FA012.get());
}
model.setId(id);
model.setFullName(entity.getFullName());
model.setEncode(entity.getEnCode());
model.setType(10);
model.setApp(0);
entity.setPlatformRelease(model.getPlatformRelease());
String json = ReportUtil.http(ApiConst.SAVE_MENU, Method.POST, JsonUtil.entityToMap(model));
ActionResult result = JsonUtil.getJsonToBean(json, ActionResult.class);
if (result == null) {
return ActionResult.fail(MsgCode.FA101.get());
}
if (!Objects.equals(result.getCode(), 200)) {
return ActionResult.fail(result.getMsg());
}
reportService.update(id, entity);
return ActionResult.success(MsgCode.SU011.get());
}
@Operation(summary = "获取报表发布菜单")
@Parameters({
@Parameter(name = "id", description = "模板id", required = true)
})
@GetMapping("/{id}/getReleaseMenu")
public ActionResult getReleaseMenu(@PathVariable String id) {
ReportEntity entity = reportService.getById(id);
if (entity == null) {
return ActionResult.fail(MsgCode.FA012.get());
}
MenuModel model = new MenuModel();
model.setId(id);
String json = ReportUtil.http(ApiConst.GET_MENU, Method.POST, JsonUtil.entityToMap(model));
ActionResult result = JsonUtil.getJsonToBean(json, ActionResult.class);
ModuleNameVO moduleNameVO = new ModuleNameVO();
if (Objects.equals(result.getCode(), 200)) {
moduleNameVO = JsonUtil.getJsonToBean(result.getData(), ModuleNameVO.class);
}
ReportInfoVO vo = JsonUtil.getJsonToBean(entity, ReportInfoVO.class);
vo.setAppIsRelease(0);
vo.setPcIsRelease(0);
if (moduleNameVO != null) {
if (StringUtil.isNotEmpty(moduleNameVO.getPcNames())) {
vo.setPcIsRelease(1);
vo.setPcReleaseName(moduleNameVO.getPcNames());
}
if (StringUtil.isNotEmpty(moduleNameVO.getAppNames())) {
vo.setAppIsRelease(1);
vo.setAppReleaseName(moduleNameVO.getAppNames());
}
}
return ActionResult.success(vo);
}
}

View File

@@ -0,0 +1,158 @@
package com.yunzhupaas.controller;
import cn.hutool.core.codec.Base64;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.Method;
import cn.xuyanwu.spring.file.storage.FileInfo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import com.yunzhupaas.base.ActionResult;
import com.yunzhupaas.enums.ImageEnum;
import com.yunzhupaas.model.report.ReportPagination;
import com.yunzhupaas.model.report.UploaderVO;
import com.yunzhupaas.service.ReportVersionService;
import com.yunzhupaas.univer.model.UniverPreview;
import com.yunzhupaas.util.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.Map;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author :云筑产品开发平台组
* @version: V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024/5/11 下午4:35
*/
@Tag(name = "报表数据", description = "Report")
@RestController
@RequestMapping("/api/Report/data")
public class ReportDataController {
@Autowired
private ReportVersionService reportVersionService;
@Operation(summary = "预览")
@Parameters({
@Parameter(name = "id", description = "模板id")
})
@PostMapping("/{id}/preview")
public ActionResult preview(@PathVariable String id, @RequestBody Map<String, Object> params) {
ReportPagination pagination = JsonUtil.getJsonToBean(params, ReportPagination.class);
UniverPreview preview = reportVersionService.preview(id, pagination, params);
return ActionResult.success(preview);
}
@Operation(summary = "预览")
@Parameters({
@Parameter(name = "id", description = "模板id")
})
@PostMapping("/{id}/previewTemplate")
public ActionResult previewTemplate(@PathVariable String id, @RequestBody Map<String, Object> params) {
ReportPagination pagination = JsonUtil.getJsonToBean(params, ReportPagination.class);
UniverPreview preview = reportVersionService.previewTemplate(id, pagination, params);
return ActionResult.success(preview);
}
@Operation(summary = "上传图片")
@PostMapping(value = "/upload/file", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ActionResult upload(@RequestPart("file") MultipartFile file) {
UploaderVO vo = new UploaderVO();
String type = "annex";
try {
String filePath = FilePathUtil.getFilePath(type);
String fileName = RandomUtil.uuId() + ".jpeg";
byte[] bytes = file.getBytes();
String url = "/api/Report/data/Download?name=" + fileName + "&encryption=";
FileInfo fileInfo = FileUploadUtils.uploadFile(bytes, filePath, fileName);
vo.setName(fileInfo.getFilename());
vo.setUrl(UploaderUtil.uploaderFile(url, fileInfo.getFilename() + "#" + type));
} catch (Exception e) {
}
return ActionResult.success(vo);
}
@Operation(summary = "远端接口下载图片")
@PostMapping(value = "/downImg")
public ActionResult upload(@RequestBody ReportPagination pagination) {
UploaderVO vo = new UploaderVO();
String type = "annex";
try {
byte[] bytes = null;
String imgValue = pagination.getImgValue();
String imgType = pagination.getImgType();
if (StringUtil.isNotEmpty(imgValue)) {
if (Objects.equals(ImageEnum.BASE64.name(), imgType)) {
String regex = "data:image/\\w+;base64,";
String base64Img = imgValue;
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(imgValue);
if (matcher.find()) {
base64Img = imgValue.replace(matcher.group(), "");
}
bytes = Base64.decode(base64Img);
} else {
HttpRequest request = HttpRequest.of(imgValue).method(Method.GET);
bytes = request.execute().bodyBytes();
}
}
if (bytes != null && bytes.length > 0) {
String filePath = FilePathUtil.getFilePath(type);
String fileName = RandomUtil.uuId() + ".jpeg";
String url = "/api/Report/data/Download?name=" + fileName + "&encryption=";
FileInfo fileInfo = FileUploadUtils.uploadFile(bytes, filePath, fileName);
vo.setName(fileInfo.getFilename());
vo.setUrl(UploaderUtil.uploaderFile(url, fileInfo.getFilename() + "#" + type));
}
} catch (Exception e) {
}
return ActionResult.success(vo);
}
@Operation(summary = "上传excel")
@PostMapping(value = "/ImportExcel", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ActionResult importExcel(@RequestPart("file") MultipartFile multipartFile) throws IOException {
UniverPreview preview = reportVersionService.importExcel(multipartFile);
return ActionResult.success(preview);
}
@Operation(summary = "下载excel")
@Parameters({
@Parameter(name = "id", description = "模板id")
})
@PostMapping("/{id}/DownExcel")
public ActionResult down(@PathVariable String id, @RequestBody Map<String, Object> params) {
ReportPagination pagination = JsonUtil.getJsonToBean(params, ReportPagination.class);
pagination.setId(id);
UploaderVO vo = reportVersionService.downExcel(pagination);
return ActionResult.success(vo);
}
@NoDataSourceBind()
@Operation(summary = "下载文件")
@GetMapping("/Download")
public void downExcel(String encryption, String name) {
String fileNameAll = DesUtil.aesDecode(encryption).replaceAll("\n", "");
if (!StringUtil.isEmpty(fileNameAll)) {
String[] data = fileNameAll.split("#");
String fileName = data.length > 1 ? data[1] : "";
String type = data.length > 2 ? data[2] : "";
String typePath = FilePathUtil.getFilePath(type.toLowerCase());
byte[] bytes = FileUploadUtils.downloadFileByte(typePath, fileName, false);
if (fileName.endsWith(".jpeg")) {
FileDownloadUtil.flushImage(bytes, fileName);
} else {
FileDownloadUtil.downloadFile(bytes, fileName, name);
}
}
}
}

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.yunzhupaas</groupId>
<artifactId>yunzhupaas-datareport-univer</artifactId>
<version>5.2.0-RELEASE</version>
</parent>
<artifactId>yunzhupaas-datareport-univer-entity</artifactId>
<dependencies>
<dependency>
<groupId>com.yunzhupaas</groupId>
<artifactId>yunzhupaas-datareport-univer-common${com.yunzhupaas.datareport.core.jdk.version}</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<profiles>
</profiles>
</project>

View File

@@ -0,0 +1,26 @@
package com.yunzhupaas.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yunzhupaas.base.entity.SuperExtendEntity;
import lombok.Data;
import java.io.Serializable;
/**
* @author云筑产品开发平台组
* @version: V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024/5/11 下午 4:35
*/
@Data
@TableName("base_dictionary_data")
public class DictionaryDataEntity extends SuperExtendEntity.SuperExtendDEEntity<String> implements Serializable {
/**
* 名称
*/
@TableField("f_full_name")
private String fullName;
}

View File

@@ -0,0 +1,60 @@
package com.yunzhupaas.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yunzhupaas.base.entity.SuperExtendEntity;
import lombok.Data;
/**
* @author云筑产品开发平台组
* @version: V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024/5/11 下午 4:35
*/
@Data
@TableName("report_template")
public class ReportEntity extends SuperExtendEntity.SuperExtendDEEntity<String> {
/**
* 主版本
*/
@TableField("f_version_id")
private String versionId;
/**
* 名称
*/
@TableField("F_FULL_NAME")
private String fullName;
/**
* 编码
*/
@TableField("F_EN_CODE")
private String enCode;
/**
* 分类
*/
@TableField("F_CATEGORY")
private String category;
/**
* 导出
*/
@TableField("F_ALLOW_EXPORT")
private Integer allowExport;
/**
* 打印
*/
@TableField("F_ALLOW_PRINT")
private Integer allowPrint;
/**
* 发布时勾选平台类型
*/
@TableField("F_PLATFORM_RELEASE")
private String platformRelease;
}

View File

@@ -0,0 +1,66 @@
package com.yunzhupaas.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yunzhupaas.base.entity.SuperExtendEntity;
import lombok.Data;
/**
* @author云筑产品开发平台组
* @version: V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024/5/11 下午 4:35
*/
@Data
@TableName("report_version")
public class ReportVersionEntity extends SuperExtendEntity.SuperExtendDEEntity<String> {
/**
* 主版本
*/
@TableField("f_template_id")
private String templateId;
/**
* 版本
*/
@TableField("f_version")
private Integer version;
/**
* 状态 (0.设计中1.启用中2.已归档)
*/
@TableField("f_state")
private Integer state;
/**
* 模板 json
*/
@TableField("f_snapshot")
private String snapshot;
/**
* 模板 json
*/
@TableField("f_cells")
private String cells;
/**
* 模板 json
*/
@TableField("f_query_list")
private String queryList;
/**
* 模板 json
*/
@TableField("f_convert_config")
private String convertConfig;
/**
* 模板 json
*/
@TableField("f_sort_list")
private String sortList;
}

View File

@@ -0,0 +1,29 @@
package com.yunzhupaas.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yunzhupaas.base.entity.SuperExtendEntity;
import lombok.Data;
/**
* @author云筑产品开发平台组
* @version: V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024/5/11 下午 4:35
*/
@Data
@TableName("base_user")
public class UserEntity extends SuperExtendEntity.SuperExtendDEEntity<String> {
/**
* 账户
*/
@TableField("F_ACCOUNT")
private String account;
/**
* 姓名
*/
@TableField("F_REAL_NAME")
private String realName;
}

View File

@@ -0,0 +1,18 @@
package com.yunzhupaas.model.data;
import lombok.Data;
import java.util.List;
/**
* @author云筑产品开发平台组
* @version: V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024/5/11 下午 4:35
*/
@Data
public class DataForm {
private String ObjectType;
private String ObjectId;
private List<DataSetInfo> list;
}

View File

@@ -0,0 +1,63 @@
package com.yunzhupaas.model.data;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import com.yunzhupaas.model.report.TableTreeModel;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author云筑产品开发平台组
* @version: V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024/5/11 下午 4:35
*/
@Data
@Schema(description = "数据集合详情")
public class DataSetInfo implements Serializable {
@Schema(description = "主键")
private String id;
@Schema(description = "关联数据类型")
private String objectType;
@Schema(description = "关联数据类型")
private String objectId;
@NotBlank
@Schema(description = "数据集名称")
private String fullName;
@NotBlank
@Schema(description = "数据库连接")
private String dbLinkId;
@Schema(description = "数据 sql 语句")
private String dataConfigJson;
@Schema(description = "参数 json")
private String parameterJson;
@Schema(description = "字段 json")
private String fieldJson;
@Schema(description = "类型1-sql 语句2-配置式")
private Integer type;
@Schema(description = "sql 语句")
private String visualConfigJson;
@Schema(description = "配置式 json")
private String filterConfigJson;
@Schema(description = "数据接口名称")
private String treePropsName;
@Schema(description = "数据接口 id")
private String interfaceId;
@Schema(description = "字段信息")
private List<TableTreeModel> children;
}

View File

@@ -0,0 +1,20 @@
package com.yunzhupaas.model.data;
import io.swagger.v3.oas.annotations.media.Schema;
import com.yunzhupaas.base.Pagination;
import lombok.Data;
/**
* @author云筑产品开发平台组
* @version: V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024/5/11 下午 4:35
*/
@Data
@Schema(description = "数据集列表参数")
public class DataSetPagination extends Pagination {
@Schema(description = "数据集数据类型:参考枚举 DataSetTypeEnum")
private String objectType;
@Schema(description = "数据集数据 id")
private String objectId;
}

View File

@@ -0,0 +1,42 @@
package com.yunzhupaas.model.data;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import java.util.HashMap;
import java.util.Map;
/**
* 打印模板 - 数查询对象
*
* @author 云筑产品开发平台组 YY
* @version V3.2.0
* @copyright 深圳市乐程软件有限公司
* @date 2024-09-30
*/
@Data
public class DataSetQuery {
@NotBlank(message = "必填")
@Schema(description = "模板 id")
private String id;
@NotBlank(message = "必填")
@Schema(description = "表单 id")
private String formId;
@Schema(description = "数据来源:打印=printVersion报表=reportVersion")
private String type;
private String queryList;
private String convertConfig;
private String moduleId;
private String snowFlakeId;
@Schema(description = "查询参数")
private Map<String, Object> map = new HashMap<>();
}

View File

@@ -0,0 +1,43 @@
package com.yunzhupaas.model.data;
import lombok.Data;
import java.util.List;
/**
* 可视化菜单对象
*
* @author 云筑产品开发平台组
* @version V3.4
* @copyright 深圳市乐程软件有限公司http://www.szlecheng.cn
* @date 2024/4/6
*/
@Data
public class MenuModel {
/**
* 功能 id
*/
private String id;
/**
* 功能名
*/
private String fullName;
/**
* 功能编码
*/
private String encode;
private Integer pc;
private Integer app;
private List<String> pcModuleParentId;
private List<String> appModuleParentId;
private Integer type;
private String platformRelease;
}

View File

@@ -0,0 +1,19 @@
package com.yunzhupaas.model.data;
import lombok.Data;
import java.util.List;
/**
* @author云筑产品开发平台组
* @version: V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024/12/3 下午 2:39
*/
@Data
public class ModuleNameVO {
private List<String> pcIds;
private List<String> appIds;
private String pcNames;
private String appNames;
}

View File

@@ -0,0 +1,60 @@
package com.yunzhupaas.model.report;
import io.swagger.v3.oas.annotations.media.Schema;
import com.yunzhupaas.model.data.DataSetInfo;
import lombok.Data;
import java.util.List;
/**
* @author云筑产品开发平台组
* @version: V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024/5/11 下午 4:35
*/
@Data
@Schema(description = "基础信息")
public class ReportCrForm {
@Schema(description = "主键 id")
private String id;
@Schema(description = "名称")
private String fullName;
@Schema(description = "编码")
private String enCode;
@Schema(description = "分类")
private String category;
@Schema(description = "排序")
private Long sortCode;
@Schema(description = "说明")
private String description;
@Schema(description = "模板内容")
private String cells;
@Schema(description = "模板内容")
private String snapshot;
@Schema(description = "模板内容")
private String queryList;
@Schema(description = "模板内容")
private String convertConfig;
@Schema(description = "模板内容")
private String sortList;
@Schema(description = "导出")
private Integer allowExport;
@Schema(description = "打印")
private Integer allowPrint;
@Schema(description = "数据集")
private List<DataSetInfo> dataSetList;
}

View File

@@ -0,0 +1,75 @@
package com.yunzhupaas.model.report;
import io.swagger.v3.oas.annotations.media.Schema;
import com.yunzhupaas.model.data.DataSetInfo;
import lombok.Data;
import java.util.List;
/**
* @author云筑产品开发平台组
* @version: V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024/5/11 下午 4:35
*/
@Data
@Schema(description = "模板详情")
public class ReportInfoVO {
@Schema(description = "模板 id")
private String id;
@Schema(description = "版本 id")
private String versionId;
@Schema(description = "名称")
private String fullName;
@Schema(description = "编码")
private String enCode;
@Schema(description = "分类")
private String category;
@Schema(description = "模板内容")
private String cells;
@Schema(description = "模板内容")
private String snapshot;
@Schema(description = "搜索列表")
private String queryList;
@Schema(description = "转换配置")
private String convertConfig;
@Schema(description = "排序")
private String sortList;
@Schema(description = "是否导出")
private Integer allowExport;
@Schema(description = "是否打印")
private Integer allowPrint;
@Schema(description = "排序")
private Long sortCode;
@Schema(description = "发布时勾选平台类型")
private String platformRelease;
@Schema(description = "pc 已发布菜单名称")
private String pcReleaseName;
@Schema(description = "app 已发布菜单名称")
private String appReleaseName;
@Schema(description = "pc 是否发布")
private Integer pcIsRelease;
@Schema(description = "app 是否发布")
private Integer appIsRelease;
@Schema(description = "模板内容")
private List<DataSetInfo> dataSetList;
}

View File

@@ -0,0 +1,46 @@
package com.yunzhupaas.model.report;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* @author云筑产品开发平台组
* @version: V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024/5/11 下午 4:35
*/
@Data
public class ReportListVO {
@Schema(description = "主键 id")
private String id;
@Schema(description = "名称")
private String fullName;
@Schema(description = "编码")
private String enCode;
@Schema(description = "分类")
private String category;
@Schema(description = "创建人")
private String creatorUser;
@Schema(description = "创建时间")
private Long creatorTime;
@Schema(description = "修改人")
private String lastModifyUser;
@Schema(description = "修改时")
private Long lastModifyTime;
@Schema(description = "排序")
private Long sortCode;
@Schema(description = "有效标志")
private Integer enabledMark;
@Schema(description = "状态")
private Integer state;
}

View File

@@ -0,0 +1,26 @@
package com.yunzhupaas.model.report;
import io.swagger.v3.oas.annotations.media.Schema;
import com.yunzhupaas.base.Pagination;
import lombok.Data;
/**
* @author云筑产品开发平台组
* @version: V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024/5/11 下午 4:35
*/
@Data
@Schema(description = "分页模型")
public class ReportPagination extends Pagination {
@Schema(description = "分类")
private String category;
@Schema(description = "标志")
private Integer state;
private String sheetId;
private String snapshot;
private String fullName;
private String id;
private String imgValue;
private String imgType;
}

View File

@@ -0,0 +1,21 @@
package com.yunzhupaas.model.report;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* @author云筑产品开发平台组
* @version: V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024/5/17 下午 1:58
*/
@Data
public class ReportPreview {
@Schema(description = "模板内容")
private String customs;
@Schema(description = "模板内容")
private String snapshot;
}

View File

@@ -0,0 +1,24 @@
package com.yunzhupaas.model.report;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
/**
* @author云筑产品开发平台组
* @version: V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024/5/11 下午 4:35
*/
@Data
public class ReportSelectVO {
@Schema(description = "主键 id")
private String id;
@Schema(description = "名称")
private String fullName;
@Schema(description = "是否有子集")
private Boolean hasChildren;
@Schema(description = "子集对象")
private List<ReportSelectVO> children;
}

View File

@@ -0,0 +1,21 @@
package com.yunzhupaas.model.report;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* @author云筑产品开发平台组
* @version: V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024/5/11 下午 4:35
*/
@Data
@Schema(description = "表单基础信息")
public class ReportUpForm extends ReportCrForm {
@Schema(description = "版本 id")
private String versionId;
@Schema(description = "动作类型0-保存1-发布")
private Integer type;
}

View File

@@ -0,0 +1,23 @@
package com.yunzhupaas.model.report;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* @author云筑产品开发平台组
* @version: V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024/5/11 下午 4:35
*/
@Data
@Schema(description = "版本")
public class ReportVersionListVO {
@Schema(description = "状态")
private Integer state;
@Schema(description = "主键")
private String id;
@Schema(description = "名称")
private String fullName;
@Schema(description = "版本")
private String version;
}

View File

@@ -0,0 +1,19 @@
package com.yunzhupaas.model.report;
import com.yunzhupaas.util.treeutil.SumTree;
import lombok.Data;
/**
* @author云筑产品开发平台组
* @version: V3.1.0
* @copyright 深圳市乐程软件有限公司
* @date 2024/5/11 下午 4:35
*/
@Data
public class TableTreeModel extends SumTree<TableTreeModel> {
private String fullName;
private String label;
}

View File

@@ -0,0 +1,21 @@
package com.yunzhupaas.model.report;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Data;
@Data
public class UploaderVO {
@Schema(description = "名称")
private String name;
@Schema(description = "请求接口")
private String url;
@Schema(description = "预览文件 id")
private String fileVersionId;
@Schema(description = "文件大小")
private Long fileSize;
@Schema(description = "文件后缀")
private String fileExtension;
@Schema(description = "缩略图")
private String thumbUrl;
}