mirror of
				https://github.com/YunaiV/ruoyi-vue-pro.git
				synced 2025-11-01 03:28:41 +08:00 
			
		
		
		
	🐛 REPORT:支持 SaaS 租户模式
This commit is contained in:
		| @ -71,7 +71,7 @@ | |||||||
|         <aliyun-java-sdk-dysmsapi.version>2.2.1</aliyun-java-sdk-dysmsapi.version> |         <aliyun-java-sdk-dysmsapi.version>2.2.1</aliyun-java-sdk-dysmsapi.version> | ||||||
|         <tencentcloud-sdk-java.version>3.1.880</tencentcloud-sdk-java.version> |         <tencentcloud-sdk-java.version>3.1.880</tencentcloud-sdk-java.version> | ||||||
|         <justauth.version>2.0.5</justauth.version> |         <justauth.version>2.0.5</justauth.version> | ||||||
|         <jimureport.version>1.6.1</jimureport.version> |         <jimureport.version>1.6.6-beta2</jimureport.version> | ||||||
|         <xercesImpl.version>2.12.2</xercesImpl.version> |         <xercesImpl.version>2.12.2</xercesImpl.version> | ||||||
|         <weixin-java.version>4.5.7.B</weixin-java.version> |         <weixin-java.version>4.5.7.B</weixin-java.version> | ||||||
|         <ureport2.version>2.2.9</ureport2.version> |         <ureport2.version>2.2.9</ureport2.version> | ||||||
| @ -639,7 +639,7 @@ | |||||||
|             <!-- 积木报表--> |             <!-- 积木报表--> | ||||||
|             <dependency> |             <dependency> | ||||||
|                 <groupId>org.jeecgframework.jimureport</groupId> |                 <groupId>org.jeecgframework.jimureport</groupId> | ||||||
|                 <artifactId>jimureport-spring-boot-starter</artifactId> |                 <artifactId>jimureport-spring-boot3-starter</artifactId> | ||||||
|                 <version>${jimureport.version}</version> |                 <version>${jimureport.version}</version> | ||||||
|                 <exclusions> |                 <exclusions> | ||||||
|                     <exclusion> |                     <exclusion> | ||||||
|  | |||||||
| @ -66,7 +66,7 @@ | |||||||
|         <!-- 积木报表--> |         <!-- 积木报表--> | ||||||
|         <dependency> |         <dependency> | ||||||
|             <groupId>org.jeecgframework.jimureport</groupId> |             <groupId>org.jeecgframework.jimureport</groupId> | ||||||
|             <artifactId>jimureport-spring-boot-starter</artifactId> |             <artifactId>jimureport-spring-boot3-starter</artifactId> | ||||||
|         </dependency> |         </dependency> | ||||||
|         <!-- 单独依赖升级版本,解决低版本validator失败问题 --> |         <!-- 单独依赖升级版本,解决低版本validator失败问题 --> | ||||||
|         <dependency> |         <dependency> | ||||||
|  | |||||||
| @ -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.framework.web.core.util.WebFrameworkUtils; | ||||||
| import cn.iocoder.yudao.module.system.api.oauth2.OAuth2TokenApi; | 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.oauth2.dto.OAuth2AccessTokenCheckRespDTO; | ||||||
|  | import cn.iocoder.yudao.module.system.api.permission.RoleApi; | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.jeecg.modules.jmreport.api.JmReportTokenServiceI; | import org.jeecg.modules.jmreport.api.JmReportTokenServiceI; | ||||||
| import org.springframework.http.HttpHeaders; | import org.springframework.http.HttpHeaders; | ||||||
| @ -128,4 +129,20 @@ public class JmReportTokenServiceImpl implements JmReportTokenServiceI { | |||||||
|         return user; |         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()); | ||||||
|  |     } | ||||||
|  |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,29 +1,25 @@ | |||||||
| package cn.iocoder.yudao.module.report.framework.ureport.config; | 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.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.Configuration; | ||||||
| import org.springframework.context.annotation.ImportResource; | import org.springframework.context.annotation.ImportResource; | ||||||
| import org.springframework.context.annotation.PropertySource; | import org.springframework.context.annotation.PropertySource; | ||||||
|  |  | ||||||
| import jakarta.servlet.Servlet; |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * UReport2 配置类 |  * UReport2 配置类 | ||||||
|  * |  * | ||||||
|  * @author 赤焰 |  * @author 赤焰 | ||||||
|  */ |  */ | ||||||
| @Configuration | // @Configuration TODO 芋艿:JDK21 暂时不支持 UReport2,原因是 Spring Boot 3 的 javax 替换成 jakarta 了 | ||||||
| @ImportResource({"classpath:ureport-console-context.xml"}) | @ImportResource({"classpath:ureport-console-context.xml"}) | ||||||
| @PropertySource(value = {"classpath:ureport.properties"}) // TODO @赤焰:这个可以搞到 application.yaml 里么? | @PropertySource(value = {"classpath:ureport.properties"}) // TODO @赤焰:这个可以搞到 application.yaml 里么? | ||||||
| @EnableConfigurationProperties({UReportProperties.class}) | @EnableConfigurationProperties({UReportProperties.class}) | ||||||
| public class UReportConfiguration { | public class UReportConfiguration { | ||||||
|  |  | ||||||
|     @Bean | //    TODO 芋艿:JDK21 暂时不支持 UReport2,原因是 Spring Boot 3 的 javax 替换成 jakarta 了 | ||||||
|     public ServletRegistrationBean<Servlet> uReportRegistrationBean() { | //    @Bean | ||||||
|         return new ServletRegistrationBean<>(new UReportServlet(), "/ureport/*"); | //    public ServletRegistrationBean<Servlet> uReportRegistrationBean() { | ||||||
|     } | //        return new ServletRegistrationBean<>(new UReportServlet(), "/ureport/*"); | ||||||
|  | //    } | ||||||
|  |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -18,7 +18,7 @@ import static cn.iocoder.yudao.module.report.enums.ErrorCodeConstants.UREPORT_DA | |||||||
|  * @author 赤焰 |  * @author 赤焰 | ||||||
|  */ |  */ | ||||||
| @Slf4j | @Slf4j | ||||||
| @Component | //@Component | ||||||
| public class UReportDataSource implements BuildinDatasource { | public class UReportDataSource implements BuildinDatasource { | ||||||
|  |  | ||||||
| 	private static final String NAME = "UReportDataSource"; | 	private static final String NAME = "UReportDataSource"; | ||||||
|  | |||||||
| @ -29,7 +29,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils. | |||||||
|  * @author 赤焰 |  * @author 赤焰 | ||||||
|  */ |  */ | ||||||
| // TODO @赤焰:这个 bean 的注解,交给 UReportConfiguration 搞 | // TODO @赤焰:这个 bean 的注解,交给 UReportConfiguration 搞 | ||||||
| @Component | //@Component | ||||||
| @Slf4j | @Slf4j | ||||||
| @Setter | @Setter | ||||||
| public class UReportDatabaseProvider implements ReportProvider { | public class UReportDatabaseProvider implements ReportProvider { | ||||||
|  | |||||||
| @ -5,9 +5,6 @@ server: | |||||||
|  |  | ||||||
| spring: | spring: | ||||||
|   # 数据源配置项 |   # 数据源配置项 | ||||||
|   autoconfigure: |  | ||||||
|     exclude: |  | ||||||
|       - org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration # 排除积木报表带来的 MongoDB 的自动配置 |  | ||||||
|   datasource: |   datasource: | ||||||
|     druid: # Druid 【监控】相关的全局配置 |     druid: # Druid 【监控】相关的全局配置 | ||||||
|       web-stat-filter: |       web-stat-filter: | ||||||
|  | |||||||
| @ -7,7 +7,6 @@ spring: | |||||||
|   # 数据源配置项 |   # 数据源配置项 | ||||||
|   autoconfigure: |   autoconfigure: | ||||||
|     exclude: |     exclude: | ||||||
|       - org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration # 排除积木报表带来的 MongoDB 的自动配置 |  | ||||||
|       - org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration # 默认 local 环境,不开启 Quartz 的自动配置 |       - org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration # 默认 local 环境,不开启 Quartz 的自动配置 | ||||||
|       - de.codecentric.boot.admin.server.config.AdminServerAutoConfiguration # 禁用 Spring Boot Admin 的 Server 的自动配置 |       - de.codecentric.boot.admin.server.config.AdminServerAutoConfiguration # 禁用 Spring Boot Admin 的 Server 的自动配置 | ||||||
|       - de.codecentric.boot.admin.server.ui.config.AdminServerUiAutoConfiguration # 禁用 Spring Boot Admin 的 Server UI 的自动配置 |       - 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.trade.dal.mysql: debug | ||||||
|     cn.iocoder.yudao.module.promotion.dal.mysql: debug |     cn.iocoder.yudao.module.promotion.dal.mysql: debug | ||||||
|     cn.iocoder.yudao.module.statistics.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 | debug: false | ||||||
|  |  | ||||||
|  | |||||||
| @ -260,9 +260,9 @@ yudao: | |||||||
| debug: false | debug: false | ||||||
|  |  | ||||||
| # 积木报表配置 | # 积木报表配置 | ||||||
| minidao : | jeecg: | ||||||
|   base-package: org.jeecg.modules.jmreport.desreport.dao* |   jmreport: | ||||||
|   db-type: mysql |     saas-mode: tenant | ||||||
|  |  | ||||||
| # UReport 配置 | # UReport 配置 | ||||||
| ureport: | ureport: | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 YunaiV
					YunaiV