许鹏程
2023-05-25 213cc37cbf0b2515a4de56cc1e01813211bad183
组织机构多选类型解析
已修改2个文件
38 ■■■■ 文件已修改
product-server-admin/src/main/java/com/product/admin/service/OrganizationCacheService.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
product-server-org-admin/src/main/java/com/product/org/admin/service/OrganizationServiceV2.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
product-server-admin/src/main/java/com/product/admin/service/OrganizationCacheService.java
@@ -403,6 +403,7 @@
            orgMap.put(CmnConst.ORG_LEVEL_CODE_PARENT, fse.getString(CmnConst.ORG_LEVEL_CODE_PARENT));
            orgMap.put(CmnConst.ORG_LEVEL_UUID, fse.getString(CmnConst.ORG_LEVEL_UUID));
            orgMap.put(CmnConst.ORG_LEVEL_ALL, fse.getString(CmnConst.ORG_LEVEL_ALL));
            orgMap.put(CmnConst.ORG_LEVEL_TYPE, fse.getString(CmnConst.ORG_LEVEL_TYPE));
            orgMap.put("uuid", fse.getUUID());
            orgMap.put("parent_uuid", fse.getString("parent_uuid"));
            orgMap.put("parent_type", fse.getString("parent_type"));
@@ -411,6 +412,12 @@
        }
    }
    /**
     * 获取组织机构(公司、部门)根据uuid
     *
     * @param uuid
     * @return
     */
    public static Map<String, Object> getOrgCacheByUuid(String uuid) {
        if (!StringUtils.isEmpty(uuid) && RedisUtil.exists(ORG_UUID_CACHE_KEY + uuid)) {
            return (Map<String, Object>) RedisUtil.get(ORG_UUID_CACHE_KEY + uuid);
@@ -418,7 +425,12 @@
        return null;
    }
    /**
     * 获取组织机构(公司、部门)根据org_level_code_parent
     *
     * @param org_level_code_parent
     * @return
     */
    public static List<FieldSetEntity> getOrgCache(String org_level_code_parent) {
        if (!StringUtils.isEmpty((org_level_code_parent)) && RedisUtil.exists(ORG_CACHE_KEY + org_level_code_parent)) {
            Collection<Object> values = RedisUtil.getHash(ORG_CACHE_KEY + org_level_code_parent).values();
product-server-org-admin/src/main/java/com/product/org/admin/service/OrganizationServiceV2.java
@@ -52,7 +52,7 @@
     *
     * @param values 多种类型的值 多个逗号分隔 列: [xxx~uuid],(xxx~user_id),{xxx_post_uuid}
     * @return 返回二维数组
     * 第一个维度:固定长度 3 ,下标0 代表机构(公司、部门) 下标 1 代表岗位 下标 2 代表 用户 ,可能为空
     * 第一个维度:固定长度 4 ,下标0 代表公司 下标1 代表部门 下标 2 代表岗位 下标 3 代表 用户 ,可能为空
     * 第二个维度: 长度未知,返回一维数组中对应含义的 值,可能为空
     * @auth cheng
     * @date 2022年4月20日18:21:09
@@ -69,17 +69,26 @@
            }
            String actualValue = val.substring(1, val.length() - 1);
            int index;
            int index = -1;
            if (val.startsWith("[") && val.endsWith("]")) {
                //机构
                index = 0;
                Map<String, Object> orgCacheByUuid = this.getOrgCacheByUuid(actualValue);
                if (orgCacheByUuid != null) {
                    Object org_level_type = orgCacheByUuid.get(CmnConst.ORG_LEVEL_TYPE);
                    if (org_level_type != null) {
                        index = NumberUtil.parseInt(org_level_type.toString());
                    }
                }
            } else if (val.startsWith("{") && val.endsWith("}")) {
                //岗位
                index = 1;
                index = 2;
            } else if (val.startsWith("(") && val.endsWith(")")) {
                //人员
                index = 2;
                index = 3;
            } else {
                continue;
            }
            if (index == -1) {
                continue;
            }
            if (typeValues[index] == null) {
@@ -92,6 +101,11 @@
        return typeValues;
    }
    public static void main(String[] args) {
        String[] a = new String[1];
        System.out.println(a.length);
    }
    /**
     * 获取所有的人员
     *