mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-23 07:25:07 +08:00
🐛 REPORT:支持 SaaS 租户模式
This commit is contained in:
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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<Servlet> uReportRegistrationBean() {
|
||||
return new ServletRegistrationBean<>(new UReportServlet(), "/ureport/*");
|
||||
}
|
||||
// TODO 芋艿:JDK21 暂时不支持 UReport2,原因是 Spring Boot 3 的 javax 替换成 jakarta 了
|
||||
// @Bean
|
||||
// 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 赤焰
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
//@Component
|
||||
public class UReportDataSource implements BuildinDatasource {
|
||||
|
||||
private static final String NAME = "UReportDataSource";
|
||||
|
@ -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 {
|
||||
|
Reference in New Issue
Block a user