Explorar el Código

查询管理员机构树

hxl13994548489 hace 1 año
padre
commit
8747fc1924

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

@@ -16,6 +16,7 @@ public enum SearchKeyCodeEnum {
     SEARCHKEY_COMPANYID("companyId", "保险公司",""),
     SEARCHKEY_PARTNERCOMPANYIDS("partnerCompanyIds", "合作保险公司",""),
     SEARCHKEY_ORGIDS("orgIds", "出单机构",""),
+    SEARCHKEY_MANAGEID("manageIds", "管理人",""),
     SEARCHKEY_ORDERTYPES("orderTypes", "订单类型","report_order_type"),
     SEARCHKEY_RISKTYPES("riskTypes", "险种","report_risk_code"),
     SEARCHKEY_AGREETYPES("agreeTypes", "协议类型","report_agree_type"),

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

@@ -88,6 +88,14 @@ public interface ReportSearchConfigurationMapper extends BaseMapper<ReportSearch
      *  @Description: 通过用户id查询租户code
      */
     String getUserByUserId(@Param("userId") String userId);
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/19 15:44
+     *  @Description: 通过用户id查询租户code
+     */
+    String getUserByPhone(@Param("userId") String userId);
     /**
      *  @version
      *  @author: hxl

+ 35 - 9
consoleStatistics/src/main/java/com/jzg/console/service/impl/ReportSearchConfigurationServiceImpl.java

@@ -100,6 +100,10 @@ public class ReportSearchConfigurationServiceImpl extends ServiceImpl<ReportSear
         if("date-cascader".equals(showType) && searchKey.equals(SearchKeyCodeEnum.SEARCHKEY_AREACODES.getCode())){
             return querySysAreaList();
         }
+        //查询管理人树
+        if("date-tree".equals(showType) && searchKey.equals(SearchKeyCodeEnum.SEARCHKEY_MANAGEID.getCode())){
+            return getUserManageListByUserIdByPhone(userId);
+        }
         //查询 合作保险公司 单独写
         return  null;
     }
@@ -161,6 +165,29 @@ public class ReportSearchConfigurationServiceImpl extends ServiceImpl<ReportSear
     public List<ReportDictDto> getPartnerCompanyListByCompanyId(String companyId) {
         return this.getBaseMapper().getPartnerCompanyListByCompanyId(companyId);
     }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/22 15:08
+     *  @Description:  通过用户id查询管理员树
+     */
+    public List<UserTreeDto> getUserManageListByUserIdByPhone(String userId) {
+        //先查租户是最上级  本人不需要查询
+        //直接查询机构表中构造成树
+        String systemCode = this.getBaseMapper().getUserByPhone(userId);
+        List<UserTreeDto> userTreeDtoList = this.getBaseMapper().getUserListBySystemCode(systemCode);
+        List<UserTreeDto> voUserList = new ArrayList<>();
+        userTreeDtoList.forEach(item->{
+            UserTreeDto userTreeDto = new UserTreeDto(item);
+            voUserList.add(userTreeDto);
+        });
+        Map<String, List<UserTreeDto>> map = voUserList.stream().collect(Collectors.groupingBy(UserTreeDto::getParentId));
+        voUserList.forEach(i -> i.setChildren(map.getOrDefault(i.getId(), new ArrayList<>())));
+        List<UserTreeDto> sysUserVos = map.get("0");
+        List<UserTreeDto> newResultDept = new ArrayList<>();
+        newResultDept.addAll(sysUserVos);
+        return newResultDept;
+    }
     /**
      *  @version
      *  @author: hxl
@@ -172,18 +199,17 @@ public class ReportSearchConfigurationServiceImpl extends ServiceImpl<ReportSear
         //先查租户是最上级  本人不需要查询
         //直接查询机构表中构造成树
         String systemCode = this.getBaseMapper().getUserByUserId(userId);
-
-        List<UserTreeDto> sysDeptList = this.getBaseMapper().getUserListBySystemCode(systemCode);
-        List<UserTreeDto> voDept = new ArrayList<>();
-        sysDeptList.forEach(item->{
+        List<UserTreeDto> userTreeDtoList = this.getBaseMapper().getUserListBySystemCode(systemCode);
+        List<UserTreeDto> voUserList = new ArrayList<>();
+        userTreeDtoList.forEach(item->{
             UserTreeDto userTreeDto = new UserTreeDto(item);
-            voDept.add(userTreeDto);
+            voUserList.add(userTreeDto);
         });
-        Map<String, List<UserTreeDto>> map = voDept.stream().collect(Collectors.groupingBy(UserTreeDto::getParentId));
-        voDept.forEach(i -> i.setChildren(map.getOrDefault(i.getId(), new ArrayList<>())));
-        List<UserTreeDto> sysDeptVos = map.get("0");
+        Map<String, List<UserTreeDto>> map = voUserList.stream().collect(Collectors.groupingBy(UserTreeDto::getParentId));
+        voUserList.forEach(i -> i.setChildren(map.getOrDefault(i.getId(), new ArrayList<>())));
+        List<UserTreeDto> sysUserVos = map.get("0");
         List<UserTreeDto> newResultDept = new ArrayList<>();
-        newResultDept.addAll(sysDeptVos);
+        newResultDept.addAll(sysUserVos);
         return newResultDept;
     }
 

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

@@ -192,6 +192,15 @@
                     mobile = #{ userId }
                 )
     </select>
+
+    <select id="getUserByPhone" resultType="java.lang.String">
+        SELECT
+            sys_code
+        FROM
+            sys_system
+        WHERE
+            user_id =  #{ userId }
+    </select>
     <select id="getUserListBySystemCode" resultType="com.jzg.commons.entity.report.dto.UserTreeDto">
         WITH RECURSIVE org_hierarchy AS (
             SELECT