From 078ead536bef09b0ef78690ca12c3ac5bc3a46e9 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 30 Dec 2023 10:30:47 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20REPORT=EF=BC=9A=E6=94=AF?= =?UTF-8?q?=E6=8C=81=20SaaS=20=E7=A7=9F=E6=88=B7=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-dependencies/pom.xml | 4 ++-- .../yudao-module-report-biz/pom.xml | 2 +- .../core/service/JmReportTokenServiceImpl.java | 17 +++++++++++++++++ .../ureport/config/UReportConfiguration.java | 16 ++++++---------- .../ureport/core/UReportDataSource.java | 2 +- .../ureport/core/UReportDatabaseProvider.java | 2 +- .../src/main/resources/application-dev.yaml | 3 --- .../src/main/resources/application-local.yaml | 2 +- .../src/main/resources/application.yaml | 6 +++--- 9 files changed, 32 insertions(+), 22 deletions(-) diff --git a/yudao-dependencies/pom.xml b/yudao-dependencies/pom.xml index 00ac14356..e58ba4254 100644 --- a/yudao-dependencies/pom.xml +++ b/yudao-dependencies/pom.xml @@ -71,7 +71,7 @@ 2.2.1 3.1.880 2.0.5 - 1.6.1 + 1.6.6-beta2 2.12.2 4.5.7.B 2.2.9 @@ -639,7 +639,7 @@ org.jeecgframework.jimureport - jimureport-spring-boot-starter + jimureport-spring-boot3-starter ${jimureport.version} diff --git a/yudao-module-report/yudao-module-report-biz/pom.xml b/yudao-module-report/yudao-module-report-biz/pom.xml index 83461f5fe..62aeb3ee0 100644 --- a/yudao-module-report/yudao-module-report-biz/pom.xml +++ b/yudao-module-report/yudao-module-report-biz/pom.xml @@ -66,7 +66,7 @@ org.jeecgframework.jimureport - jimureport-spring-boot-starter + jimureport-spring-boot3-starter diff --git a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/jmreport/core/service/JmReportTokenServiceImpl.java b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/jmreport/core/service/JmReportTokenServiceImpl.java index ad4240f2f..f4685432f 100644 --- a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/jmreport/core/service/JmReportTokenServiceImpl.java +++ b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/jmreport/core/service/JmReportTokenServiceImpl.java @@ -11,6 +11,7 @@ import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils; import cn.iocoder.yudao.module.system.api.oauth2.OAuth2TokenApi; import cn.iocoder.yudao.module.system.api.oauth2.dto.OAuth2AccessTokenCheckRespDTO; +import cn.iocoder.yudao.module.system.api.permission.RoleApi; import lombok.RequiredArgsConstructor; import org.jeecg.modules.jmreport.api.JmReportTokenServiceI; import org.springframework.http.HttpHeaders; @@ -128,4 +129,20 @@ public class JmReportTokenServiceImpl implements JmReportTokenServiceI { return user; } + @Override + public String[] getRoles(String s) { + // 暂时不用实现,因为不用 JmReport 的角色 + return null; + } + + @Override + public String getTenantId() { + // 补充说明:不能直接通过 TenantContext 获取,因为 jimu 报表前端请求时,没有带上 tenant-id Header + LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); + if (loginUser == null) { + return null; + } + return StrUtil.toStringOrNull(loginUser.getTenantId()); + } + } diff --git a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/config/UReportConfiguration.java b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/config/UReportConfiguration.java index 3cf09c6aa..313ec4e66 100644 --- a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/config/UReportConfiguration.java +++ b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/config/UReportConfiguration.java @@ -1,29 +1,25 @@ package cn.iocoder.yudao.module.report.framework.ureport.config; -import com.bstek.ureport.console.UReportServlet; import org.springframework.boot.context.properties.EnableConfigurationProperties; -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; import org.springframework.context.annotation.PropertySource; -import jakarta.servlet.Servlet; - /** * UReport2 配置类 * * @author 赤焰 */ -@Configuration +// @Configuration TODO 芋艿:JDK21 暂时不支持 UReport2,原因是 Spring Boot 3 的 javax 替换成 jakarta 了 @ImportResource({"classpath:ureport-console-context.xml"}) @PropertySource(value = {"classpath:ureport.properties"}) // TODO @赤焰:这个可以搞到 application.yaml 里么? @EnableConfigurationProperties({UReportProperties.class}) public class UReportConfiguration { - @Bean - public ServletRegistrationBean uReportRegistrationBean() { - return new ServletRegistrationBean<>(new UReportServlet(), "/ureport/*"); - } +// TODO 芋艿:JDK21 暂时不支持 UReport2,原因是 Spring Boot 3 的 javax 替换成 jakarta 了 +// @Bean +// public ServletRegistrationBean uReportRegistrationBean() { +// return new ServletRegistrationBean<>(new UReportServlet(), "/ureport/*"); +// } } diff --git a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/core/UReportDataSource.java b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/core/UReportDataSource.java index eb5d5e48c..69bee4476 100644 --- a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/core/UReportDataSource.java +++ b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/core/UReportDataSource.java @@ -18,7 +18,7 @@ import static cn.iocoder.yudao.module.report.enums.ErrorCodeConstants.UREPORT_DA * @author 赤焰 */ @Slf4j -@Component +//@Component public class UReportDataSource implements BuildinDatasource { private static final String NAME = "UReportDataSource"; diff --git a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/core/UReportDatabaseProvider.java b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/core/UReportDatabaseProvider.java index d04c088bc..077c55a91 100644 --- a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/core/UReportDatabaseProvider.java +++ b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/core/UReportDatabaseProvider.java @@ -29,7 +29,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils. * @author 赤焰 */ // TODO @赤焰:这个 bean 的注解,交给 UReportConfiguration 搞 -@Component +//@Component @Slf4j @Setter public class UReportDatabaseProvider implements ReportProvider { diff --git a/yudao-server/src/main/resources/application-dev.yaml b/yudao-server/src/main/resources/application-dev.yaml index 6263a4278..3358e678e 100644 --- a/yudao-server/src/main/resources/application-dev.yaml +++ b/yudao-server/src/main/resources/application-dev.yaml @@ -5,9 +5,6 @@ server: spring: # 数据源配置项 - autoconfigure: - exclude: - - org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration # 排除积木报表带来的 MongoDB 的自动配置 datasource: druid: # Druid 【监控】相关的全局配置 web-stat-filter: diff --git a/yudao-server/src/main/resources/application-local.yaml b/yudao-server/src/main/resources/application-local.yaml index 900656ecf..93b2a69e9 100644 --- a/yudao-server/src/main/resources/application-local.yaml +++ b/yudao-server/src/main/resources/application-local.yaml @@ -7,7 +7,6 @@ spring: # 数据源配置项 autoconfigure: exclude: - - org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration # 排除积木报表带来的 MongoDB 的自动配置 - org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration # 默认 local 环境,不开启 Quartz 的自动配置 - de.codecentric.boot.admin.server.config.AdminServerAutoConfiguration # 禁用 Spring Boot Admin 的 Server 的自动配置 - de.codecentric.boot.admin.server.ui.config.AdminServerUiAutoConfiguration # 禁用 Spring Boot Admin 的 Server UI 的自动配置 @@ -188,6 +187,7 @@ logging: cn.iocoder.yudao.module.trade.dal.mysql: debug cn.iocoder.yudao.module.promotion.dal.mysql: debug cn.iocoder.yudao.module.statistics.dal.mysql: debug + org.springframework.context.support.PostProcessorRegistrationDelegate: ERROR # TODO 芋艿:先禁用,Spring Boot 3.X 存在部分错误的 WARN 提示 debug: false diff --git a/yudao-server/src/main/resources/application.yaml b/yudao-server/src/main/resources/application.yaml index 627028bdd..bb952d26e 100644 --- a/yudao-server/src/main/resources/application.yaml +++ b/yudao-server/src/main/resources/application.yaml @@ -260,9 +260,9 @@ yudao: debug: false # 积木报表配置 -minidao : - base-package: org.jeecg.modules.jmreport.desreport.dao* - db-type: mysql +jeecg: + jmreport: + saas-mode: tenant # UReport 配置 ureport: