zhaowenxuan
2025-02-13 eee018cdbf547cfbd246f42c66b315b595ee31a3
Merge remote-tracking branch 'origin/master'

# Conflicts:
# ltkj-framework/src/main/java/com/ltkj/framework/config/WebConfig.java
3个文件已修改
57 ■■■■■ 已修改文件
ltkj-admin/src/main/java/com/ltkj/web/config/swagger/SwaggerConfig.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ltkj-admin/src/main/java/com/ltkj/web/controller/swagger/SwaggerController.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ltkj-admin/src/main/java/com/ltkj/web/jmreport/JimuController.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ltkj-admin/src/main/java/com/ltkj/web/config/swagger/SwaggerConfig.java
@@ -100,10 +100,12 @@
     */
    private List<SecurityReference> defaultAuth() {
        AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
        AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
        AuthorizationScope[] authorizationScopes = new AuthorizationScope[2];
        authorizationScopes[0] = authorizationScope;
//        authorizationScopes[1] = authorizationScope;
        List<SecurityReference> securityReferences = new ArrayList<>();
        securityReferences.add(new SecurityReference("Authorization", authorizationScopes));
//        securityReferences.add(new SecurityReference("hospId", authorizationScopes));
        return securityReferences;
    }
ltkj-admin/src/main/java/com/ltkj/web/controller/swagger/SwaggerController.java
@@ -1,10 +1,20 @@
package com.ltkj.web.controller.swagger;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ltkj.common.enums.DataSourceType;
import com.ltkj.db.DataSourceConfig;
import com.ltkj.db.DataSourceContextHolder;
import com.ltkj.hosp.domain.DictHosp;
import com.ltkj.hosp.service.IDictHospService;
import jodd.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.ltkj.common.core.controller.BaseController;
import javax.servlet.http.HttpServletRequest;
/**
 * swagger 接口
@@ -14,9 +24,24 @@
@Controller
@RequestMapping("/tool/swagger")
public class SwaggerController extends BaseController {
    @Autowired
    private DataSourceConfig dataSourceConfig;
    @Autowired
    private IDictHospService dictHospService;
    @PreAuthorize("@ss.hasPermi('tool:swagger:view')")
    @GetMapping()
    public String index() {
    public String index(HttpServletRequest request) {
        dataSourceConfig.addDataSource(DataSourceType.MASTER.name());
        DataSourceContextHolder.setDataSourceKey(DataSourceType.MASTER.name());
//        String hospId = request.getHeader("hospId");
//        LambdaQueryWrapper<DictHosp> wrapper = new LambdaQueryWrapper<>();
//        wrapper.eq(DictHosp::getCode,hospId);
//        DictHosp hosp = dictHospService.getOne(wrapper);
//        if (hosp != null && StringUtil.isNotBlank(hosp.getDbname())) {
//            dataSourceConfig.addDataSource(hosp.getDbname());
//            DataSourceContextHolder.setDataSourceKey(hosp.getDbname());
//        }
        return redirect("/doc.html");
    }
}
ltkj-admin/src/main/java/com/ltkj/web/jmreport/JimuController.java
@@ -1,11 +1,19 @@
package com.ltkj.web.jmreport;
import cn.hutool.http.server.HttpServerRequest;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ltkj.common.core.domain.AjaxResult;
import com.ltkj.common.enums.DataSourceType;
import com.ltkj.db.DataSourceConfig;
import com.ltkj.db.DataSourceContextHolder;
import com.ltkj.hosp.domain.DictHosp;
import com.ltkj.hosp.mapper.TestMapper;
import com.ltkj.hosp.service.IDictHospService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jodd.util.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.omg.CORBA.Environment;
import org.springframework.beans.factory.annotation.Autowired;
@@ -16,6 +24,8 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -41,6 +51,10 @@
    @Autowired
    private TestMapper testMapper;
    @Autowired
    private DataSourceConfig dataSourceConfig;
    @Autowired
    private IDictHospService dictHospService;
    @Value ("${config.properties}")
    public void setConfigPath(String path) {
@@ -91,7 +105,17 @@
    @GetMapping("/view")
    @ApiOperation(value = "view")
    //@PreAuthorize("@ss.hasPermi('report:jimu:view')")
    public String view(){
    public String view(HttpServletRequest request){
//        dataSourceConfig.addDataSource(DataSourceType.MASTER.name());
//        DataSourceContextHolder.setDataSourceKey(DataSourceType.MASTER.name());
//        String hospId = request.getHeader("hospId");
//        LambdaQueryWrapper<DictHosp> wrapper = new LambdaQueryWrapper<>();
//        wrapper.eq(DictHosp::getCode,hospId);
//        DictHosp hosp = dictHospService.getOne(wrapper);
//        if (hosp != null && StringUtil.isNotBlank(hosp.getDbname())) {
//            dataSourceConfig.addDataSource(hosp.getDbname());
//            DataSourceContextHolder.setDataSourceKey(hosp.getDbname());
//        }
        return value+"/jmreport/view";
    }