فهرست منبع

Merge remote-tracking branch 'origin/master'

Qchen 1 سال پیش
والد
کامیت
86a927a0fd

+ 51 - 0
commons/src/main/java/com/jzg/commons/constants/report/enums/SearchKeyCodeEnum.java

@@ -0,0 +1,51 @@
+package com.jzg.commons.constants.report.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2025/9/17 9:10
+ *  @Description:  数据报表查询key的枚举
+ */
+@AllArgsConstructor
+@Getter
+public enum SearchKeyCodeEnum {
+
+    SEARCHKEY_COMPANYID("companyId", "保险公司",""),
+    SEARCHKEY_PARTNERCOMPANYIDS("partnerCompanyIds", "合作保险公司",""),
+    SEARCHKEY_ORGIDS("orgIds", "出单机构",""),
+    SEARCHKEY_ORDERTYPES("orderTypes", "订单类型","report_order_type"),
+    SEARCHKEY_RISKTYPES("riskTypes", "险种","report_risk_code"),
+    SEARCHKEY_AGREETYPES("agreeTypes", "协议类型","report_agree_type"),
+    SEARCHKEY_SALESMANTYPES("salesmanTypes", "业务员类型","report_salesman_type"),
+    SEARCHKEY_AREACODES("areaCodes", "所在地区",""),
+    SEARCHKEY_ORDERSOURCE("orderSource", "报价来源","report_order_source"),
+    SEARCHKEY_ORDERSTATUS("orderStatus", "订单状态","report_order_status"),
+    SEARCHKEY_ORDERCHECKSTATUS("orderCheckStatus", "订单审核状态","report_order_check_status"),
+    SEARCHKEY_PRODUCTTYPE("productType", "保险产品","report_product_type");
+
+    // 编号
+    private final String code;
+    // 说明
+    private final String desc;
+
+    // 字典编码
+    private final String distCode;
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/17 10:05
+     *  @Description: 获取对象
+     */
+    public static SearchKeyCodeEnum getSearchKeyCode(String code) {
+        for (SearchKeyCodeEnum searchKeyCode : SearchKeyCodeEnum.values()) {
+            if (searchKeyCode.getCode().equals(code)) {
+                return searchKeyCode;
+            }
+        }
+        return null;
+    }
+}

+ 0 - 3
commons/src/main/java/com/jzg/commons/entity/finance/vo/ReceivableQueryVo.java

@@ -56,9 +56,6 @@ public class ReceivableQueryVo extends PageRequest {
     @Schema(description = "出单机构")
     private String deptId;
 
-    @Schema(description = "产品id")
-    private String productId;
-
     @Schema(description = "险种")
     private String riskCode;
 

+ 31 - 0
commons/src/main/java/com/jzg/commons/entity/report/dto/ReportDictDto.java

@@ -0,0 +1,31 @@
+package com.jzg.commons.entity.report.dto;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2025/9/17 10:09
+ *  @Description:  字典对象
+ */
+@Data
+@Schema(description = "字典对象")
+@AllArgsConstructor
+@NoArgsConstructor
+public class ReportDictDto implements Serializable {
+    /**
+     * 值
+     */
+    @Schema(description = "值")
+    private String value;
+    /**
+     *  名称
+     */
+    @Schema(description = "名称")
+    private String label;
+}

+ 82 - 0
commons/src/main/java/com/jzg/commons/entity/report/dto/ReportSearchConfigurationDto.java

@@ -0,0 +1,82 @@
+package com.jzg.commons.entity.report.dto;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.jzg.commons.entity.report.po.ReportSearchConfiguration;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2025/9/16 17:50
+ *  @Description:  参数列表数据
+ */
+@Data
+@Schema(description = "筛选参数对象")
+@AllArgsConstructor
+@NoArgsConstructor
+public class ReportSearchConfigurationDto implements Serializable {
+    /**
+     * 主键
+     */
+    @Schema(description = "主键")
+    private String id;
+
+    /**
+     * 查询key
+     */
+    @Schema(description = "查询key")
+    private String searchKey;
+
+    /**
+     * 查询名称
+     */
+    @Schema(description = "查询名称")
+    private String searchName;
+
+    /**
+     * 是否多选  0  不参与  1 单选 2. 多选
+     */
+    @Schema(description = "是否多选  0  不参与  1 单选 2. 多选")
+    private String selectType;
+
+    /**
+     * 显示类型  1. input  2. select 3. tree 4.dateRange
+     */
+    @Schema(description = "显示类型  1. input  2. select 3. tree 4.dateRange ")
+    private String showType;
+
+
+    @Schema(description = "显示类型为 select 或者 tree 时使用")
+    private List<?>  list;
+
+    /**
+     * 屏蔽不返回前台
+     */
+    @JSONField(serialize = false)
+    @JsonIgnore
+    @Schema(description = "sql")
+    private String searchSql;
+
+    /**
+     * 是否默认   true 是  false 否
+     */
+    @Schema(description = "是否默认   true 是  false 否")
+    private boolean defaultFlag;
+
+    /**
+     * 是否可以选择   true 是  false 否
+     */
+    @Schema(description = "是否可以选择   true 是  false 否")
+    private boolean selectFlag;
+}

+ 137 - 0
commons/src/main/java/com/jzg/commons/entity/report/po/ReportSearchConfiguration.java

@@ -0,0 +1,137 @@
+package com.jzg.commons.entity.report.po;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2025/9/16 16:59
+ *  @Description:  报表筛选项配置
+ */
+@TableName(value ="report_search_configuration")
+@Data
+@Schema(description = "导入任务表")
+@AllArgsConstructor
+@NoArgsConstructor
+public class ReportSearchConfiguration implements Serializable {
+    /**
+     * 主键
+     */
+    @Schema(description = "主键")
+    @TableId(type = IdType.ASSIGN_ID)
+    private String id;
+
+    /**
+     * 路由唯一标识
+     */
+    @Schema(description = "路由唯一标识")
+    private String routerPathKey;
+
+    /**
+     * 查询key
+     */
+    @Schema(description = "查询key")
+    private String searchKey;
+
+    /**
+     * 查询名称
+     */
+    @Schema(description = "查询名称")
+    private String searchName;
+
+    /**
+     * 是否多选  0  不参与  1 单选 2. 多选
+     */
+    @Schema(description = "是否多选  0  不参与  1 单选 2. 多选")
+    private String selectType;
+
+    /**
+     * 显示类型  1. input  2. select 3. tree 4.dateRange
+     */
+    @Schema(description = "显示类型  1. input  2. select 3. tree 4.dateRange ")
+    private String showType;
+
+
+    /**
+     * 查询字典或者数据的sql
+     */
+    @Schema(description = "查询字典或者数据的sql")
+    private String searchSql;
+
+    /**
+     * 创建时间
+     */
+    @Schema(description = "创建时间")
+    private Date createTime;
+
+    /**
+     * 创建用户id
+     */
+    @Schema(description = "创建用户id")
+    private String createUserId;
+
+
+    @Override
+    public boolean equals(Object that) {
+        if (this == that) {
+            return true;
+        }
+        if (that == null) {
+            return false;
+        }
+        if (getClass() != that.getClass()) {
+            return false;
+        }
+        ReportSearchConfiguration other = (ReportSearchConfiguration) that;
+        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+            && (this.getRouterPathKey() == null ? other.getRouterPathKey() == null : this.getRouterPathKey().equals(other.getRouterPathKey()))
+            && (this.getSearchKey() == null ? other.getSearchKey() == null : this.getSearchKey().equals(other.getSearchKey()))
+            && (this.getSearchName() == null ? other.getSearchName() == null : this.getSearchName().equals(other.getSearchName()))
+            && (this.getSelectType() == null ? other.getSelectType() == null : this.getSelectType().equals(other.getSelectType()))
+            && (this.getSearchSql() == null ? other.getSearchSql() == null : this.getSearchSql().equals(other.getSearchSql()))
+            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
+            && (this.getCreateUserId() == null ? other.getCreateUserId() == null : this.getCreateUserId().equals(other.getCreateUserId()));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+        result = prime * result + ((getRouterPathKey() == null) ? 0 : getRouterPathKey().hashCode());
+        result = prime * result + ((getSearchKey() == null) ? 0 : getSearchKey().hashCode());
+        result = prime * result + ((getSearchName() == null) ? 0 : getSearchName().hashCode());
+        result = prime * result + ((getSelectType() == null) ? 0 : getSelectType().hashCode());
+        result = prime * result + ((getSearchSql() == null) ? 0 : getSearchSql().hashCode());
+        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
+        result = prime * result + ((getCreateUserId() == null) ? 0 : getCreateUserId().hashCode());
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", routerPathKey=").append(routerPathKey);
+        sb.append(", searchKey=").append(searchKey);
+        sb.append(", searchName=").append(searchName);
+        sb.append(", selectType=").append(selectType);
+        sb.append(", searchSql=").append(searchSql);
+        sb.append(", createTime=").append(createTime);
+        sb.append(", createUserId=").append(createUserId);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 97 - 0
commons/src/main/java/com/jzg/commons/entity/report/vo/ReportSearchCommonVo.java

@@ -0,0 +1,97 @@
+package com.jzg.commons.entity.report.vo;
+
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2025/9/16 17:32
+ *  @Description:  查询列表统一的请求参数
+ */
+@Data
+@Schema(description = "导入任务列表")
+@AllArgsConstructor
+@NoArgsConstructor
+public class ReportSearchCommonVo implements Serializable {
+
+     @Schema(description = "时间开始日期")
+     private String createTimeBegin;
+
+     @Schema(description = "时间结束日期")
+     private String createTimeEnd;
+
+     @Schema(description = "录单开始日期")
+     private String recordTimeBegin;
+
+     @Schema(description = "录单结束日期")
+     private String recordTimeEnd;
+
+     @Schema(description = "签单开始日期")
+     private String signTimeBegin;
+
+     @Schema(description = "签单结束日期")
+     private String signTimeEnd;
+
+     @Schema(description = "公司公司id")
+     private String companyId;
+
+     @Schema(description = "合作保险公司ids(多选)")
+     private List<String> partnerCompanyIds;
+
+
+     @Schema(description = "出单机构ids(多选)")
+     private List<String> orgIds;
+
+     @Schema(description = "订单类型(多选)")
+     private List<String> orderTypes;
+
+     @Schema(description = "险种(多选)")
+     private List<String> riskTypes;
+
+     @Schema(description = "协议类型(多选)")
+     private List<String> agreeTypes;
+
+     @Schema(description = "业务员类型(多选)")
+     private List<String> salesmanTypes;
+
+     @Schema(description = "业务员姓名")
+     private String salesmanName;
+
+     @Schema(description = "业务员手机号")
+     private String salesmanPhone;
+
+     @Schema(description = "管理人姓名")
+     private String manageName;
+
+     @Schema(description = "管理人手机号")
+     private String managePhone;
+
+    @Schema(description = "车牌号")
+    private String licenseNo;
+
+    @Schema(description = "所在地区(省+市 数组)")
+    private List<String> areaCodes;
+
+    @Schema(description = "报价来源")
+    private String orderSource;
+
+    @Schema(description = "订单状态")
+    private String orderStatus;
+
+    @Schema(description = "订单审核状态")
+    private String orderCheckStatus;
+
+    @Schema(description = "年份")
+    private String year;
+
+    @Schema(description = "保险产品")
+    private String productType;
+
+}

+ 118 - 0
consoleStatistics/src/main/java/com/jzg/console/controller/ReportSearchConfigurationController.java

@@ -0,0 +1,118 @@
+package com.jzg.console.controller;
+
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.jzg.commons.core.base.BaseController;
+import com.jzg.commons.core.page.HttpResult;
+import com.jzg.commons.entity.report.dto.ReportDictDto;
+import com.jzg.commons.entity.report.dto.ReportSearchConfigurationDto;
+import com.jzg.commons.entity.report.dto.ReportUploadExcelTaskDto;
+import com.jzg.commons.entity.vo.SysDeptVo;
+import com.jzg.console.service.ReportSearchConfigurationService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2025/9/16 17:59
+ *  @Description: 查询公共的查询参数
+ */
+@Slf4j
+@Tag(name="公共查询参数管理")
+@RestController
+@RequestMapping("/console/searchConfiguration")
+public class ReportSearchConfigurationController extends BaseController {
+
+
+    @Autowired
+    private ReportSearchConfigurationService reportSearchConfigurationService;
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/15 18:11
+     *  @Description: 导出任务中心-列表查询
+     */
+    @Operation(summary = "公共查询参数管理-列表查询", description = "公共查询参数管理-列表查询")
+    @GetMapping(value = "/getSearchConfigurationList")
+    public HttpResult<?> getSearchConfigurationList(@RequestParam(name="userId",required=true) String userId,@RequestParam(name="routerKey",required=true) String routerKey) {
+        try{
+            List<ReportSearchConfigurationDto> list = reportSearchConfigurationService.getSearchConfigurationList(userId,routerKey);
+            return HttpResult.ok(list);
+        }catch (Exception e){
+            return HttpResult.error(e.getMessage());
+        }
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/15 18:11
+     *  @Description: 导出任务中心-列表查询
+     */
+    @Operation(summary = "公共查询参数管理-查询页面默认参数", description = "公共查询参数管理-查询页面默认参数")
+    @GetMapping(value = "/getSearchDefaultList")
+    public HttpResult<?> getSearchDefaultList(@RequestParam(name="userId",required=true) String userId,@RequestParam(name="routerKey",required=true) String routerKey) {
+        try{
+            List<ReportSearchConfigurationDto> list = reportSearchConfigurationService.getSearchDefaultList(userId,routerKey);
+            return HttpResult.ok(list);
+        }catch (Exception e){
+            return HttpResult.error(e.getMessage());
+        }
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/17 14:39
+     *  @Description: 通过用户id查询所在的机构树
+     */
+    @Operation(summary = "公共查询参数管理-通过用户id查询所在的机构树", description = "公共查询参数管理-通过用户id查询所在的机构树")
+    @GetMapping(value = "/getDeptListByUserId")
+    public HttpResult<?> getDeptListByUserId(@RequestParam(name="userId",required=true) String userId) {
+        try{
+            List<SysDeptVo> deptTree = reportSearchConfigurationService.getDeptTree(userId);
+            return HttpResult.ok(deptTree);
+        }catch (Exception e){
+            return HttpResult.error(e.getMessage());
+        }
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/17 14:41
+     *  @Description: 通过保险公司id查询合作公司列表
+     */
+    @Operation(summary = "公共查询参数管理-通过保险公司id查询合作公司列表", description = "公共查询参数管理-通过保险公司id查询合作公司列表")
+    @GetMapping(value = "/getPartnerCompanyListByCompanyId")
+    public HttpResult<?> getPartnerCompanyListByCompanyId(@RequestParam(name="companyId",required=true) String companyId) {
+        try{
+            List<ReportDictDto>  partnerCompanyList= reportSearchConfigurationService.getPartnerCompanyListByCompanyId(companyId);
+            return HttpResult.ok(partnerCompanyList);
+        }catch (Exception e){
+            return HttpResult.error(e.getMessage());
+        }
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/17 17:35
+     *  @Description: 查询管理员数据
+     */
+    @Operation(summary = "公共查询参数管理-查询管理员数据列表", description = "公共查询参数管理-查询管理员数据列表")
+    @GetMapping(value = "/getUserManageListByUserId")
+    public HttpResult<?> getUserManageListByUserId(@RequestParam(name="userId",required=true) String userId) {
+        try{
+            List<ReportDictDto>  userManageList= reportSearchConfigurationService.getUserManageListByUserId(userId);
+            return HttpResult.ok(userManageList);
+        }catch (Exception e){
+            return HttpResult.error(e.getMessage());
+        }
+    }
+}

+ 74 - 0
consoleStatistics/src/main/java/com/jzg/console/mapper/ReportSearchConfigurationMapper.java

@@ -0,0 +1,74 @@
+package com.jzg.console.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.jzg.commons.entity.po.SysArea;
+import com.jzg.commons.entity.po.SysDept;
+import com.jzg.commons.entity.report.dto.ReportDictDto;
+import com.jzg.commons.entity.report.dto.ReportSearchConfigurationDto;
+import com.jzg.commons.entity.report.po.ReportSearchConfiguration;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author Administrator
+ * @description 针对表【report_search_configuration(报表查询配置)】的数据库操作Mapper
+ * @createDate 2025-09-16 16:57:57
+ * @Entity generator.domain.ReportSearchConfiguration
+ */
+public interface ReportSearchConfigurationMapper extends BaseMapper<ReportSearchConfiguration> {
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/16 18:07
+     *  @Description: 查询公共筛选参数
+     */
+    List<ReportSearchConfigurationDto> getSearchConfigurationList(@Param("routerPath") String routerPath);
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/17 11:15
+     *  @Description:  查询字典
+     */
+    List<ReportDictDto> selectDictListByCode(@Param("distCode") String distCode);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/17 11:48
+     *  @Description:  查询省市的二级机构
+     */
+    List<SysArea> getSecondLevelAreaList();
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/17 14:22
+     *  @Description:  查询用户关联的机构树
+     */
+    List<SysDept> getDeptListByUserId(@Param("userId") String userId);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/17 15:05
+     *  @Description:  查询用户配置的保信公司
+     */
+    List<ReportDictDto> queryCompanyListByUserId(@Param("userId") String userId);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/17 15:09
+     *  @Description: 通过保险公司查询合作公司三级id
+     */
+    List<ReportDictDto> getPartnerCompanyListByCompanyId(@Param("companyId") String companyId);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/18 10:41
+     *  @Description:  查看页面默认参数
+     */
+    List<ReportSearchConfigurationDto> getSearchDefaultList(@Param("routerKey") String routerKey);
+}
+
+
+
+

+ 54 - 0
consoleStatistics/src/main/java/com/jzg/console/service/ReportSearchConfigurationService.java

@@ -0,0 +1,54 @@
+package com.jzg.console.service;
+
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.jzg.commons.entity.report.dto.ReportDictDto;
+import com.jzg.commons.entity.report.dto.ReportSearchConfigurationDto;
+import com.jzg.commons.entity.report.po.ReportSearchConfiguration;
+import com.jzg.commons.entity.vo.SysDeptVo;
+
+import java.util.List;
+
+/**
+* @author Administrator
+* @description 针对表【report_search_configuration(报表查询配置)】的数据库操作Service
+* @createDate 2025-09-16 16:57:57
+*/
+public interface ReportSearchConfigurationService extends IService<ReportSearchConfiguration> {
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/16 18:05
+     *  @Description: 查询公共参数列表
+     */
+    List<ReportSearchConfigurationDto> getSearchConfigurationList(String userId,String routerKey);
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/17 14:35
+     *  @Description: 查询用户所在的机构树
+     */
+    List<SysDeptVo> getDeptTree(String userId);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/17 15:02
+     *  @Description: 通过保险公司id查询三级的合作公司
+     */
+    List<ReportDictDto> getPartnerCompanyListByCompanyId(String companyId);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/17 17:37
+     *  @Description:  查询管理员列表
+     */
+    List<ReportDictDto> getUserManageListByUserId(String userId);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/18 10:34
+     *  @Description: 查询默认参数列表
+     */
+    List<ReportSearchConfigurationDto> getSearchDefaultList(String userId, String routerKey);
+}

+ 171 - 0
consoleStatistics/src/main/java/com/jzg/console/service/impl/ReportSearchConfigurationServiceImpl.java

@@ -0,0 +1,171 @@
+package com.jzg.console.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.jzg.commons.constants.report.enums.SearchKeyCodeEnum;
+import com.jzg.commons.entity.po.SysArea;
+import com.jzg.commons.entity.po.SysDept;
+import com.jzg.commons.entity.report.dto.ReportDictDto;
+import com.jzg.commons.entity.report.dto.ReportSearchConfigurationDto;
+import com.jzg.commons.entity.report.po.ReportSearchConfiguration;
+import com.jzg.commons.entity.vo.SysAreaVo;
+import com.jzg.commons.entity.vo.SysDeptVo;
+import com.jzg.console.mapper.ReportSearchConfigurationMapper;
+import com.jzg.console.service.ReportSearchConfigurationService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+* @author Administrator
+* @description 针对表【report_search_configuration(报表查询配置)】的数据库操作Service实现
+* @createDate 2025-09-16 16:57:57
+*/
+@Service
+public class ReportSearchConfigurationServiceImpl extends ServiceImpl<ReportSearchConfigurationMapper, ReportSearchConfiguration>
+    implements ReportSearchConfigurationService {
+
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/16 18:05
+     *  @Description:  查询公共参数列表
+     *   common 时公共参数 ,后期如果单独配置也是靠 routerPath 区分
+     */
+    @Override
+    public List<ReportSearchConfigurationDto> getSearchConfigurationList(String userId,String routerKey) {
+        List<ReportSearchConfigurationDto> list = this.getBaseMapper().getSearchConfigurationList(routerKey);
+        if(list!=null  && !list.isEmpty()){
+            for (ReportSearchConfigurationDto reportSearchConfigurationDto : list) {
+                if(StringUtils.isNotBlank(reportSearchConfigurationDto.getSearchSql())){
+                    //通过配置的sql查询具体的对象
+                    List<?> searchConfigurationList = getSearchConfigurationList(userId, reportSearchConfigurationDto.getSearchSql(), reportSearchConfigurationDto.getSearchKey(), reportSearchConfigurationDto.getShowType());
+                    reportSearchConfigurationDto.setList(searchConfigurationList);
+                }
+            }
+        }
+        return list;
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/17 9:01
+     *  @Description:
+     */
+    public List<?> getSearchConfigurationList(String userId,String sqlType,String searchKey,String showType) {
+        // 查询字典列表
+        if("select".equals(showType) && SearchKeyCodeEnum.getSearchKeyCode(searchKey)!=null && StringUtils.isNotBlank(SearchKeyCodeEnum.getSearchKeyCode(searchKey).getDistCode()) && "dictSql".equals(sqlType) ){
+            String distCode = SearchKeyCodeEnum.getSearchKeyCode(searchKey).getDistCode();
+            return this.getBaseMapper().selectDictListByCode(distCode);
+        }
+        //查询用户配置的查询保险公司
+        if("select".equals(showType) && searchKey.equals(SearchKeyCodeEnum.SEARCHKEY_COMPANYID.getCode())){
+            return queryCompanyListByUserId(userId);
+        }
+        //查询用户配置的出单机构
+        if("tree".equals(showType) && searchKey.equals(SearchKeyCodeEnum.SEARCHKEY_ORGIDS.getCode())){
+            return getDeptTree(userId);
+        }
+        //查询所有的省
+        if("areaSelect".equals(showType) && searchKey.equals(SearchKeyCodeEnum.SEARCHKEY_AREACODES.getCode())){
+            return querySysAreaList();
+        }
+        //查询 合作保险公司 单独写
+        return  null;
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/17 11:46
+     *  @Description:  查询 省、市
+     */
+    public List<SysAreaVo> querySysAreaList() {
+        List<SysArea> list = this.getBaseMapper().getSecondLevelAreaList();
+        List<SysAreaVo> collect = list.stream().map(SysAreaVo::new).collect(Collectors.toList());
+        Map<String, List<SysAreaVo>> map = collect.stream().collect(Collectors.groupingBy(SysAreaVo::getUpperCode));
+        collect.forEach(i -> i.setChild(map.getOrDefault(i.getAreaCode(), new ArrayList<>())));
+        return map.get("0");
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/17 14:16
+     *  @Description: 查询租户下的出单机构
+     */
+    @Override
+    public List<SysDeptVo> getDeptTree(String userId) {
+        List<SysDept> sysDeptList = this.getBaseMapper().getDeptListByUserId(userId);
+        List<SysDeptVo> voDept = new ArrayList<>();
+        sysDeptList.forEach(item->{
+            SysDeptVo sysDeptv = new SysDeptVo(item);
+            voDept.add(sysDeptv);
+        });
+        Map<String, List<SysDeptVo>> map = voDept.stream().collect(Collectors.groupingBy(SysDeptVo::getParentId));
+        voDept.forEach(i -> i.setChildren(map.getOrDefault(i.getId(), new ArrayList<>())));
+        List<SysDeptVo> sysDeptVos = map.get("0");
+        List<SysDeptVo> newResultDept = new ArrayList<>();
+        newResultDept.addAll(sysDeptVos);
+        return newResultDept;
+    }
+
+
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/17 14:37
+     *  @Description:  查询用户所在的保险公司
+     */
+    public List<ReportDictDto> queryCompanyListByUserId(String userId) {
+        return this.getBaseMapper().queryCompanyListByUserId(userId);
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/17 14:43
+     *  @Description: 通过保险公司id查询合作公司的第三级
+     */
+    @Override
+    public List<ReportDictDto> getPartnerCompanyListByCompanyId(String companyId) {
+        return this.getBaseMapper().getPartnerCompanyListByCompanyId(companyId);
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/17 17:37
+     *  @Description: 查询管理员树   暂时不知道如何处理暂放
+     */
+    @Override
+    public List<ReportDictDto> getUserManageListByUserId(String userId) {
+
+        return null;
+    }
+
+    @Override
+    public List<ReportSearchConfigurationDto> getSearchDefaultList(String userId, String routerKey) {
+        List<ReportSearchConfigurationDto> list = this.getBaseMapper().getSearchDefaultList(routerKey);
+        if(list!=null  && !list.isEmpty()){
+            for (ReportSearchConfigurationDto reportSearchConfigurationDto : list) {
+                if(StringUtils.isNotBlank(reportSearchConfigurationDto.getSearchSql())){
+                    //通过配置的sql查询具体的对象
+                    List<?> searchConfigurationList = getSearchConfigurationList(userId, reportSearchConfigurationDto.getSearchSql(), reportSearchConfigurationDto.getSearchKey(), reportSearchConfigurationDto.getShowType());
+                    reportSearchConfigurationDto.setList(searchConfigurationList);
+                }
+            }
+        }
+        return list;
+    }
+
+
+}
+
+
+
+

+ 4 - 2
consoleStatistics/src/main/resources/application-dev.yml

@@ -8,10 +8,12 @@ spring:
       password: nacos
       config:
         file-extension: yaml
-        namespace: 1096345e-2a2d-4307-8025-ee1b669e127b
+        #namespace: 1096345e-2a2d-4307-8025-ee1b669e127b
+        namespace: 83c21527-44e1-4063-9ec5-b8812928237f
         group: DEFAULT_GROUP
       discovery:
-        namespace: 1096345e-2a2d-4307-8025-ee1b669e127b
+        #namespace: 1096345e-2a2d-4307-8025-ee1b669e127b
+        namespace: 83c21527-44e1-4063-9ec5-b8812928237f
   config:
     import:
       - nacos:mysql

+ 7 - 2
consoleStatistics/src/main/resources/application.yml

@@ -73,8 +73,13 @@ tenant:
     - sys_relation_person
     - sys_user_account
     - report_upload_excel_task
-
-
+    - report_search_configuration
+    - esm_ins_company
+    - sys_system_bus_perms
+    - sys_system_bus_perms_link
+    - company_hierarchy
+    - report_page_set_search_param
+    - report_page_select_disable
   ignoreLoginNames:
 
 data-scope:

+ 159 - 0
consoleStatistics/src/main/resources/mapper/ReportSearchConfigurationMapper.xml

@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.jzg.console.mapper.ReportSearchConfigurationMapper">
+    <select id="getSearchConfigurationList"
+            resultType="com.jzg.commons.entity.report.dto.ReportSearchConfigurationDto">
+        SELECT
+            b.search_key AS searchKey,
+            b.search_name AS searchName,
+            b.select_type AS selectType,
+            b.show_type AS showType,
+            b.search_sql AS searchSql,
+            b.id AS id,
+            a.show_flag AS showFlag,
+            CASE
+            WHEN (
+            SELECT COUNT(0)
+            FROM report_page_set_search_param
+            WHERE report_configuration_id = a.report_configuration_id
+            AND router_path_key = #{ routerPath }
+            ) > 0 THEN true
+            ELSE false
+            END AS defaultFlag,
+            CASE
+            WHEN (
+            SELECT COUNT(0)
+            FROM report_page_select_disable
+            WHERE report_configuration_id = a.report_configuration_id
+            AND router_path_key = #{ routerPath }
+            ) > 0 THEN true
+            ELSE false
+            END AS selectFlag
+        FROM
+            report_page_set_search_param a
+        LEFT JOIN report_search_configuration b ON a.report_configuration_id = b.id
+         WHERE
+             a.router_path_key = 'common'
+        ORDER BY
+            a.sort
+    </select>
+
+    <select id="selectDictListByCode" resultType="com.jzg.commons.entity.report.dto.ReportDictDto">
+        SELECT
+            p.VALUE AS value,
+            p.label AS label
+        FROM
+            sys_dict p
+            LEFT JOIN sys_dict_type c ON p.type_code = c.dict_code
+        WHERE
+            c.dict_code = #{distCode}
+        ORDER BY
+            p.sort
+    </select>
+    <select id="getSecondLevelAreaList" resultType="com.jzg.commons.entity.po.SysArea">
+        SELECT
+            *
+        FROM
+            sys_area
+        WHERE
+            `level` IN (1,2)
+    </select>
+    <select id="getDeptListByUserId" resultType="com.jzg.commons.entity.po.SysDept">
+        SELECT
+            *
+        FROM
+            sys_dept
+        WHERE
+            system_code =(
+                SELECT
+                    sys_code
+                FROM
+                    sys_system
+                WHERE
+                    user_id = #{userId}
+            )
+        order by id
+    </select>
+    <select id="queryCompanyListByUserId" resultType="com.jzg.commons.entity.report.dto.ReportDictDto">
+        SELECT
+            id AS VALUE,
+	        NAME AS label
+        FROM
+            esm_ins_company
+        WHERE
+            id IN (
+                SELECT
+                    bus_id
+                FROM
+                    sys_system_bus_perms_link
+                WHERE
+                    perms_id =(
+                        SELECT
+                            p.id
+                        FROM
+                            sys_system_bus_perms p
+                            LEFT JOIN sys_system ss ON p.system_code = ss.sys_code
+                        WHERE
+                            ss.user_id = #{userId}
+                    )
+                    AND bus_code = 'quoteCompany'
+            )
+    </select>
+    <select id="getPartnerCompanyListByCompanyId" resultType="com.jzg.commons.entity.report.dto.ReportDictDto">
+        WITH RECURSIVE company_hierarchy AS (
+            SELECT
+                id,
+                name,
+                parent_id,
+                1 AS level
+            FROM
+               esm_ins_company
+            WHERE
+                id = #{companyId}
+                AND is_delete = 0
+            UNION ALL
+                SELECT
+                    c.id,
+                    c.name,
+                    c.parent_id,
+                    ch.level + 1 AS level
+                FROM
+                   esm_ins_company c
+                   INNER JOIN  company_hierarchy ch ON c.parent_id = ch.id
+                WHERE
+                   c.is_delete = 0
+                   AND ch.level <![CDATA[< ]]>  3
+        )
+        SELECT
+            id as value,
+            name as label,
+            parent_id,
+            level
+        FROM
+        company_hierarchy
+        WHERE
+        level = 3;
+    </select>
+    <select id="getSearchDefaultList"
+            resultType="com.jzg.commons.entity.report.dto.ReportSearchConfigurationDto">
+        SELECT
+            b.search_key AS searchKey,
+            b.search_name AS searchName,
+            b.select_type AS selectType,
+            b.show_type AS showType,
+            b.search_sql AS searchSql,
+            b.id AS id,
+            a.show_flag AS showFlag,
+            true  as   defaultFlag,
+            true  as  selectFlag
+        FROM
+            report_page_set_search_param a
+                LEFT JOIN report_search_configuration b ON a.report_configuration_id = b.id
+        WHERE
+            a.router_path_key = #{ routerKey }
+        ORDER BY
+            a.sort
+    </select>
+</mapper>

+ 5 - 1
gateway/src/main/resources/application-test.yml

@@ -29,6 +29,10 @@ spring:
           uri: http://172.24.144.223:9084/
           predicates:
             - Path=/tenant/**,/dept/**,/area/**,/dict/**,/userInfo/**,/sysOrganization/**,/activity/**,/message/**,/messageNotice/**,,/pltAgreement/**,/agreementRules/**,/poster/**,/agreement/**,/ptl/areaLicense/**,/ptlAgreementCost/**,/scheme/**,/ptlAgreementCostExternal/**,/plt/areaLicense/**
-
+        #数据报表
+        - id: console_route
+          uri: http://172.24.144.223:9085/
+          predicates:
+            - Path=/console/**