Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

Qchen 1 год назад
Родитель
Сommit
4c18c73401

+ 33 - 7
commons/src/main/java/com/jzg/commons/entity/report/dto/ReportSearchConfigurationDto.java

@@ -36,13 +36,13 @@ public class ReportSearchConfigurationDto implements Serializable {
      * 查询key
      */
     @Schema(description = "查询key")
-    private String searchKey;
+    private String key;
 
     /**
      * 查询名称
      */
     @Schema(description = "查询名称")
-    private String searchName;
+    private String label;
 
     /**
      * 是否多选  0  不参与  1 单选 2. 多选
@@ -51,14 +51,28 @@ public class ReportSearchConfigurationDto implements Serializable {
     private String selectType;
 
     /**
-     * 显示类型  1. input  2. select 3. tree 4.dateRange
+     * 显示类型  input select-single select-multiple date-picker date-tree date-cascader
      */
-    @Schema(description = "显示类型  1. input  2. select 3. tree 4.dateRange ")
-    private String showType;
+    @Schema(description = "显示类型  input select-single select-multiple date-picker date-tree date-cascader")
+    private String inputType;
 
 
-    @Schema(description = "显示类型为 select 或者 tree 时使用")
-    private List<?>  list;
+    @Schema(description = "显示类型为 select-single select-multiple  或者 date-tree date-cascader 时使用")
+    private List<?>  listOption;
+
+
+    @Schema(description = "默认值")
+    private String defaultValue;
+
+
+    @Schema(description = "选中值")
+    private String selectValue;
+
+    @Schema(description = "是否是通过一级查询  保险公司查询赋值true")
+    private Boolean isFirst = false;
+
+    @Schema(description = "选中值")
+    private String isFirstLabel;
 
     /**
      * 屏蔽不返回前台
@@ -79,4 +93,16 @@ public class ReportSearchConfigurationDto implements Serializable {
      */
     @Schema(description = "是否可以选择   true 是  false 否")
     private boolean selectFlag;
+
+    /**
+     * 參數是否显示   true 是  false 否
+     */
+    @Schema(description = "參數是否显示   true 是  false 否")
+    private boolean showFlag;
+
+    /**
+     * 參數是否显示   true 是  false 否
+     */
+    @Schema(description = "參數是否显示   true 是  false 否")
+    private boolean isShowDelIcon;
 }

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

@@ -1,6 +1,7 @@
 package com.jzg.console.controller;
 
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.jzg.commons.core.base.BaseController;
 import com.jzg.commons.core.page.HttpResult;
@@ -12,10 +13,12 @@ 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.redisson.api.RedissonClient;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
+import java.util.Objects;
 
 
 /**
@@ -31,6 +34,9 @@ import java.util.List;
 public class ReportSearchConfigurationController extends BaseController {
 
 
+    @Autowired
+    private RedissonClient redissonClient;
+
     @Autowired
     private ReportSearchConfigurationService reportSearchConfigurationService;
     /**
@@ -43,6 +49,7 @@ public class ReportSearchConfigurationController extends BaseController {
     @GetMapping(value = "/getSearchConfigurationList")
     public HttpResult<?> getSearchConfigurationList(@RequestParam(name="userId",required=true) String userId,@RequestParam(name="routerKey",required=true) String routerKey) {
         try{
+            userId = reportSearchConfigurationService.getUserIdByUserName(userId);
             List<ReportSearchConfigurationDto> list = reportSearchConfigurationService.getSearchConfigurationList(userId,routerKey);
             return HttpResult.ok(list);
         }catch (Exception e){
@@ -60,6 +67,7 @@ public class ReportSearchConfigurationController extends BaseController {
     @GetMapping(value = "/getSearchDefaultList")
     public HttpResult<?> getSearchDefaultList(@RequestParam(name="userId",required=true) String userId,@RequestParam(name="routerKey",required=true) String routerKey) {
         try{
+            userId = reportSearchConfigurationService.getUserIdByUserName(userId);
             List<ReportSearchConfigurationDto> list = reportSearchConfigurationService.getSearchDefaultList(userId,routerKey);
             return HttpResult.ok(list);
         }catch (Exception e){
@@ -76,6 +84,7 @@ public class ReportSearchConfigurationController extends BaseController {
     @GetMapping(value = "/getDeptListByUserId")
     public HttpResult<?> getDeptListByUserId(@RequestParam(name="userId",required=true) String userId) {
         try{
+            userId = reportSearchConfigurationService.getUserIdByUserName(userId);
             List<SysDeptVo> deptTree = reportSearchConfigurationService.getDeptTree(userId);
             return HttpResult.ok(deptTree);
         }catch (Exception e){
@@ -109,6 +118,7 @@ public class ReportSearchConfigurationController extends BaseController {
     @GetMapping(value = "/getUserManageListByUserId")
     public HttpResult<?> getUserManageListByUserId(@RequestParam(name="userId",required=true) String userId) {
         try{
+            userId = reportSearchConfigurationService.getUserIdByUserName(userId);
             List<ReportDictDto>  userManageList= reportSearchConfigurationService.getUserManageListByUserId(userId);
             return HttpResult.ok(userManageList);
         }catch (Exception e){

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

@@ -67,6 +67,14 @@ public interface ReportSearchConfigurationMapper extends BaseMapper<ReportSearch
      *  @Description:  查看页面默认参数
      */
     List<ReportSearchConfigurationDto> getSearchDefaultList(@Param("routerKey") String routerKey);
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/19 15:44
+     *  @Description: 通过用户id查询用户名称
+     */
+    String getUserIdByUserName(@Param("userId") String userId);
 }
 
 

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

@@ -51,4 +51,13 @@ public interface ReportSearchConfigurationService extends IService<ReportSearchC
      *  @Description: 查询默认参数列表
      */
     List<ReportSearchConfigurationDto> getSearchDefaultList(String userId, String routerKey);
+
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/19 16:02
+     *  @Description: 通过手机号查询用户id
+     */
+    String  getUserIdByUserName(String userId);
 }

+ 49 - 19
consoleStatistics/src/main/java/com/jzg/console/service/impl/ReportSearchConfigurationServiceImpl.java

@@ -39,16 +39,38 @@ public class ReportSearchConfigurationServiceImpl extends ServiceImpl<ReportSear
     @Override
     public List<ReportSearchConfigurationDto> getSearchConfigurationList(String userId,String routerKey) {
         List<ReportSearchConfigurationDto> list = this.getBaseMapper().getSearchConfigurationList(routerKey);
-        if(list!=null  && !list.isEmpty()){
+        setParamList(userId, list);
+        return list;
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/19 11:12
+     *  @Description: 设置参数信息
+     */
+    private void setParamList(String userId, List<ReportSearchConfigurationDto> list) {
+        if(list !=null  && !list.isEmpty()){
             for (ReportSearchConfigurationDto reportSearchConfigurationDto : list) {
+                //赋值多选框
+                if("2".equals(reportSearchConfigurationDto.getSelectType())){
+                    reportSearchConfigurationDto.setInputType("select-multiple");
+                }
                 if(StringUtils.isNotBlank(reportSearchConfigurationDto.getSearchSql())){
                     //通过配置的sql查询具体的对象
-                    List<?> searchConfigurationList = getSearchConfigurationList(userId, reportSearchConfigurationDto.getSearchSql(), reportSearchConfigurationDto.getSearchKey(), reportSearchConfigurationDto.getShowType());
-                    reportSearchConfigurationDto.setList(searchConfigurationList);
+                    List<?> searchConfigurationList = getSearchConfigurationList(userId, reportSearchConfigurationDto.getSearchSql(), reportSearchConfigurationDto.getKey(), reportSearchConfigurationDto.getInputType());
+                    reportSearchConfigurationDto.setListOption(searchConfigurationList);
+                }
+                //单选、多选赋值默认值和选中值
+                if("select-single".equals(reportSearchConfigurationDto.getInputType()) || "select-multiple".equals(reportSearchConfigurationDto.getInputType())){
+                    reportSearchConfigurationDto.setDefaultValue("0");
+                    reportSearchConfigurationDto.setSelectValue("全部");
+                }
+                //保险公司添加
+                if("select-single".equals(reportSearchConfigurationDto.getInputType()) && reportSearchConfigurationDto.getKey().equals(SearchKeyCodeEnum.SEARCHKEY_COMPANYID.getCode())){
+                    reportSearchConfigurationDto.setIsFirst(true);
                 }
             }
         }
-        return list;
     }
 
     /**
@@ -59,20 +81,21 @@ public class ReportSearchConfigurationServiceImpl extends ServiceImpl<ReportSear
      */
     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) ){
+        if(("select-single".equals(showType) || " select-multiple".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);
+            List<ReportDictDto> reportDictDtos = this.getBaseMapper().selectDictListByCode(distCode);
+            return reportDictDtos;
         }
         //查询用户配置的查询保险公司
-        if("select".equals(showType) && searchKey.equals(SearchKeyCodeEnum.SEARCHKEY_COMPANYID.getCode())){
+        if("select-single".equals(showType) && searchKey.equals(SearchKeyCodeEnum.SEARCHKEY_COMPANYID.getCode())){
             return queryCompanyListByUserId(userId);
         }
         //查询用户配置的出单机构
-        if("tree".equals(showType) && searchKey.equals(SearchKeyCodeEnum.SEARCHKEY_ORGIDS.getCode())){
+        if("date-tree".equals(showType) && searchKey.equals(SearchKeyCodeEnum.SEARCHKEY_ORGIDS.getCode())){
             return getDeptTree(userId);
         }
         //查询所有的省
-        if("areaSelect".equals(showType) && searchKey.equals(SearchKeyCodeEnum.SEARCHKEY_AREACODES.getCode())){
+        if("date-cascader".equals(showType) && searchKey.equals(SearchKeyCodeEnum.SEARCHKEY_AREACODES.getCode())){
             return querySysAreaList();
         }
         //查询 合作保险公司 单独写
@@ -144,6 +167,12 @@ public class ReportSearchConfigurationServiceImpl extends ServiceImpl<ReportSear
      */
     @Override
     public List<ReportDictDto> getUserManageListByUserId(String userId) {
+        //先查租户是最上级
+
+        //
+
+
+
 
         return null;
     }
@@ -151,18 +180,19 @@ public class ReportSearchConfigurationServiceImpl extends ServiceImpl<ReportSear
     @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);
-                }
-            }
-        }
+        setParamList(userId, list);
         return list;
     }
-
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/19 16:01
+     *  @Description: 用户id
+     */
+    @Override
+    public String  getUserIdByUserName(String userId){
+        return this.getBaseMapper().getUserIdByUserName(userId);
+    }
 
 }
 

+ 29 - 9
consoleStatistics/src/main/resources/mapper/ReportSearchConfigurationMapper.xml

@@ -6,10 +6,18 @@
     <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_key AS 'key',
+            b.search_name AS label,
+            b.show_type AS inputType,
+            CASE
+                WHEN (SELECT select_type FROM report_page_set_search_param
+                      WHERE report_configuration_id = a.report_configuration_id
+                        AND router_path_key = #{ routerPath }) IS NOT NULL THEN
+                (SELECT select_type FROM report_page_set_search_param
+                 WHERE report_configuration_id = a.report_configuration_id
+                   AND router_path_key = #{ routerPath })
+                ELSE a.select_type
+            END AS selectType,
             b.search_sql AS searchSql,
             b.id AS id,
             a.show_flag AS showFlag,
@@ -30,7 +38,8 @@
             AND router_path_key = #{ routerPath }
             ) > 0 THEN true
             ELSE false
-            END AS selectFlag
+            END AS selectFlag,
+            false AS isShowDelIcon
         FROM
             report_page_set_search_param a
         LEFT JOIN report_search_configuration b ON a.report_configuration_id = b.id
@@ -139,15 +148,16 @@
     <select id="getSearchDefaultList"
             resultType="com.jzg.commons.entity.report.dto.ReportSearchConfigurationDto">
         SELECT
-            b.search_key AS searchKey,
-            b.search_name AS searchName,
+            b.search_key AS 'key',
+            b.search_name AS label,
+            b.show_type AS inputType,
             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
+            true  as  selectFlag,
+            false AS isShowDelIcon
         FROM
             report_page_set_search_param a
                 LEFT JOIN report_search_configuration b ON a.report_configuration_id = b.id
@@ -156,4 +166,14 @@
         ORDER BY
             a.sort
     </select>
+
+    <select id="getUserIdByUserName"
+            resultType="java.lang.String">
+        SELECT
+            id
+        FROM
+            sys_user
+        WHERE
+            mobile = #{ userId }
+    </select>
 </mapper>