✨ Introducing new features. #1936 支持 ureport 报表系统
This commit is contained in:
1 parent
7f651b4667
commit
163277fd16
12 files changed
+460
No files matched your search
@@ -0,0 +1,18 @@
|
||||
FROM pig4cloud/java:8-jre
|
||||
|
||||
MAINTAINER wangiegie@gmail.com
|
||||
|
||||
ENV TZ=Asia/Shanghai
|
||||
ENV JAVA_OPTS="-Xms128m -Xmx256m -Djava.security.egd=file:/dev/./urandom"
|
||||
|
||||
RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
RUN mkdir -p /pigx-bi-platform
|
||||
|
||||
WORKDIR /pigx-bi-platform
|
||||
|
||||
EXPOSE 5006
|
||||
|
||||
ADD ./target/pigx-bi-platform.jar ./
|
||||
|
||||
CMD sleep 60;java $JAVA_OPTS -jar pigx-bi-platform.jar
|
||||
Executable
+83
@@ -0,0 +1,83 @@
|
||||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-visual</artifactId>
|
||||
<version>3.10.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-bi-platform</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>基于 ureport 的报表系统</description>
|
||||
|
||||
<dependencies>
|
||||
<!--注册中心客户端-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
<!--配置中心客户端-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
<!--sentinel-->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common-sentinel</artifactId>
|
||||
</dependency>
|
||||
<!--ureport-->
|
||||
<dependency>
|
||||
<groupId>com.bstek.ureport</groupId>
|
||||
<artifactId>ureport2-console</artifactId>
|
||||
<version>${ureport.version}</version>
|
||||
</dependency>
|
||||
<!--数据库-->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
<!--web 模块-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<!--undertow容器-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-undertow</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--server-api-->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--oss-->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common-oss</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>false</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, lengleng All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the pig4cloud.com developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: lengleng (wangiegie@gmail.com)
|
||||
*/
|
||||
|
||||
package com.pig4cloud.pigx.ureport;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.cloud.client.SpringCloudApplication;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2020-10-15 报表模块
|
||||
* <p>
|
||||
* 此模块由于使用的是ureport 封装报表设计器,无法区分租户权限较大建议不提供具体租户使用。
|
||||
* <p>
|
||||
* http://127.0.0.1:5006/ureport/designer
|
||||
*/
|
||||
@SpringCloudApplication
|
||||
public class PigxBiApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(PigxBiApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.pig4cloud.pigx.ureport.config;
|
||||
|
||||
import com.bstek.ureport.console.UReportServlet;
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.ImportResource;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2020/7/25
|
||||
* <p>
|
||||
* ureport 配置类
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ImportResource(UreportAutoConfiguration.CONTEXT)
|
||||
public class UreportAutoConfiguration {
|
||||
|
||||
static final String CONTEXT = "classpath:ureport-console-context.xml";
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean<UReportServlet> buildUreportServlet() {
|
||||
return new ServletRegistrationBean<>(new UReportServlet(), "/ureport/*");
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
package com.pig4cloud.pigx.ureport.config;
|
||||
|
||||
import com.bstek.ureport.UReportPropertyPlaceholderConfigurer;
|
||||
import com.bstek.ureport.provider.report.ReportProvider;
|
||||
import com.pig4cloud.pigx.common.oss.OssProperties;
|
||||
import com.pig4cloud.pigx.common.oss.service.OssTemplate;
|
||||
import com.pig4cloud.pigx.ureport.processor.UReportPropertyPlaceholderConfigurerPlus;
|
||||
import com.pig4cloud.pigx.ureport.provider.DfsReportProvider;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.web.servlet.LocaleResolver;
|
||||
import org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2020/7/25
|
||||
* <p>
|
||||
* 增强默认Ureport 行为
|
||||
*/
|
||||
@ConditionalOnClass(OssTemplate.class)
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class UreportExtConfig {
|
||||
|
||||
@Bean
|
||||
public ReportProvider dfsReportProvider(OssTemplate ossTemplate, OssProperties properties) {
|
||||
return new DfsReportProvider(ossTemplate, properties);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public UReportPropertyPlaceholderConfigurer uReportPropertyPlaceholderConfigurerPlus() {
|
||||
return new UReportPropertyPlaceholderConfigurerPlus();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
public LocaleResolver localeResolver() {
|
||||
|
||||
AcceptHeaderLocaleResolver lr = new AcceptHeaderLocaleResolver();
|
||||
|
||||
// 设置默认区域,
|
||||
|
||||
lr.setDefaultLocale(Locale.CHINA);
|
||||
|
||||
return lr;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.pig4cloud.pigx.ureport.processor;
|
||||
|
||||
import com.bstek.ureport.UReportPropertyPlaceholderConfigurer;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2020/7/25
|
||||
* <p>
|
||||
* 重写默认的 PropertyPlaceholder
|
||||
*/
|
||||
public class UReportPropertyPlaceholderConfigurerPlus extends UReportPropertyPlaceholderConfigurer {
|
||||
|
||||
public UReportPropertyPlaceholderConfigurerPlus() {
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty("ureport.fileStoreDir", "");
|
||||
properties.setProperty("ureport.fileStoreDir", "");
|
||||
properties.setProperty("ureport.debug", "false");
|
||||
properties.setProperty("ureport.disableHttpSessionReportCache", "false");
|
||||
this.setProperties(properties);
|
||||
}
|
||||
|
||||
}
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
package com.pig4cloud.pigx.ureport.provider;
|
||||
|
||||
import com.amazonaws.services.s3.model.S3Object;
|
||||
import com.amazonaws.services.s3.model.S3ObjectSummary;
|
||||
import com.bstek.ureport.provider.report.ReportFile;
|
||||
import com.bstek.ureport.provider.report.ReportProvider;
|
||||
import com.pig4cloud.pigx.common.oss.OssProperties;
|
||||
import com.pig4cloud.pigx.common.oss.service.OssTemplate;
|
||||
import lombok.Cleanup;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2020/7/25
|
||||
* <p>
|
||||
* 基于OSS 的文件存储支持
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class DfsReportProvider implements ReportProvider {
|
||||
|
||||
/**
|
||||
* 保存文件增加默认前缀,方便查找
|
||||
*/
|
||||
private static final String PREFIX = "oss_";
|
||||
|
||||
private final OssTemplate ossTemplate;
|
||||
|
||||
private final OssProperties properties;
|
||||
|
||||
@Override
|
||||
public InputStream loadReport(String file) {
|
||||
S3Object object = ossTemplate.getObject(properties.getBucketName(), file);
|
||||
return object.getObjectContent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteReport(String file) {
|
||||
try {
|
||||
ossTemplate.removeObject(properties.getBucketName(), file);
|
||||
}
|
||||
catch (Exception e) {
|
||||
log.error("文件删除失败 ", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ReportFile> getReportFiles() {
|
||||
List<S3ObjectSummary> objectSummaryList = ossTemplate.getAllObjectsByPrefix(properties.getBucketName(), PREFIX,
|
||||
true);
|
||||
|
||||
return objectSummaryList.stream()
|
||||
.map(s3ObjectSummary -> new ReportFile(s3ObjectSummary.getKey().replaceAll(PREFIX, ""),
|
||||
s3ObjectSummary.getLastModified()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveReport(String file, String content) {
|
||||
try {
|
||||
@Cleanup
|
||||
InputStream inputStream = IOUtils.toInputStream(content);
|
||||
ossTemplate.putObject(properties.getBucketName(), file, inputStream);
|
||||
}
|
||||
catch (Exception e) {
|
||||
log.error("文件上传失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "分布式文件存储";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean disabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrefix() {
|
||||
return PREFIX;
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"properties": [
|
||||
{
|
||||
"name": "ureport.disableFileProvider",
|
||||
"type": "java.lang.String",
|
||||
"description": "是否开启本地文件系统 true/false"
|
||||
},
|
||||
{
|
||||
"name": "ureport.fileStoreDir",
|
||||
"type": "java.lang.String",
|
||||
"description": "本地文件保存路径"
|
||||
},
|
||||
{
|
||||
"name": "ureport.debug",
|
||||
"type": "java.lang.String",
|
||||
"description": "DEBUG模式 true/false"
|
||||
},
|
||||
{
|
||||
"name": "ureport.disableHttpSessionReportCache",
|
||||
"type": "java.lang.String",
|
||||
"description": "是否关闭 session cache"
|
||||
}
|
||||
],
|
||||
"hints": []
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
server:
|
||||
port: 5006
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: @artifactId@
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: ${NACOS_HOST:pigx-register}:${NACOS_PORT:8848}
|
||||
service: @artifactId@
|
||||
config:
|
||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
||||
file-extension: yml
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
profiles:
|
||||
active: @profiles.active@
|
||||
@@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2018-2025, lengleng All rights reserved.
|
||||
~
|
||||
~ Redistribution and use in source and binary forms, with or without
|
||||
~ modification, are permitted provided that the following conditions are met:
|
||||
~
|
||||
~ Redistributions of source code must retain the above copyright notice,
|
||||
~ this list of conditions and the following disclaimer.
|
||||
~ Redistributions in binary form must reproduce the above copyright
|
||||
~ notice, this list of conditions and the following disclaimer in the
|
||||
~ documentation and/or other materials provided with the distribution.
|
||||
~ Neither the name of the pig4cloud.com developer nor the names of its
|
||||
~ contributors may be used to endorse or promote products derived from
|
||||
~ this software without specific prior written permission.
|
||||
~ Author: lengleng (wangiegie@gmail.com)
|
||||
-->
|
||||
|
||||
<!--
|
||||
小技巧: 在根pom里面设置统一存放路径,统一管理方便维护
|
||||
<properties>
|
||||
<log-path>/Users/lengleng</log-path>
|
||||
</properties>
|
||||
1. 其他模块加日志输出,直接copy本文件放在resources 目录即可
|
||||
2. 注意修改 <property name="${log-path}/log.path" value=""/> 的value模块
|
||||
-->
|
||||
<configuration debug="false" scan="false">
|
||||
<property name="log.path" value="logs/${project.artifactId}"/>
|
||||
<!-- 彩色日志格式 -->
|
||||
<property name="CONSOLE_LOG_PATTERN"
|
||||
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
|
||||
<!-- 彩色日志依赖的渲染类 -->
|
||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
||||
<conversionRule conversionWord="wex"
|
||||
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
||||
<conversionRule conversionWord="wEx"
|
||||
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
|
||||
<!-- Console log output -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- Log file debug output -->
|
||||
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/debug.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- Log file error output -->
|
||||
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>ERROR</level>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!--nacos 心跳 INFO 屏蔽-->
|
||||
<logger name="com.alibaba.nacos" level="OFF">
|
||||
<appender-ref ref="error"/>
|
||||
</logger>
|
||||
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="console"/>
|
||||
<appender-ref ref="debug"/>
|
||||
</root>
|
||||
</configuration>
|
||||
@@ -32,6 +32,7 @@
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
<module>pigx-bi-platform</module>
|
||||
<module>pigx-codegen</module>
|
||||
<module>pigx-daemon-elastic-job</module>
|
||||
<module>pigx-daemon-quartz</module>
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
<lcn.version>4.1.0</lcn.version>
|
||||
<jasypt.version>2.1.1</jasypt.version>
|
||||
<ttl.version>2.11.4</ttl.version>
|
||||
<ureport.version>2.2.9</ureport.version>
|
||||
<aws.version>1.11.543</aws.version>
|
||||
<xxl.job.version>2.2.0</xxl.job.version>
|
||||
<activiti.version>5.22.0</activiti.version>
|
||||
|
||||
Reference in new issue
Block a user