zrj
2024-06-05 4ac064d42140a32169745e2498387a9413b105b6
基层信息及缓存调整
19 files modified
2 files renamed
7 files added
890 ■■■■ changed files
blade-auth/src/main/java/org/springblade/auth/config/SecurityConfiguration.java 2 ●●● patch | view | raw | blame | history
blade-auth/src/main/java/org/springblade/auth/endpoint/BladeTokenEndPoint.java 44 ●●●● patch | view | raw | blame | history
blade-auth/src/main/java/org/springblade/auth/handle/TokenFilterHandle.java 3 ●●●●● patch | view | raw | blame | history
blade-auth/src/main/java/org/springblade/auth/service/BladeUserDetailsServiceImpl.java 3 ●●●●● patch | view | raw | blame | history
blade-auth/src/main/java/org/springblade/common/cache/CacheNames.java 61 ●●●●● patch | view | raw | blame | history
blade-auth/src/main/java/org/springblade/common/cache/DictBizCache.java 34 ●●●● patch | view | raw | blame | history
blade-auth/src/main/java/org/springblade/common/cache/DictCache.java 35 ●●●● patch | view | raw | blame | history
blade-auth/src/main/java/org/springblade/common/cache/ParamCache.java 62 ●●●●● patch | view | raw | blame | history
blade-auth/src/main/java/org/springblade/common/cache/RegionCache.java 56 ●●●●● patch | view | raw | blame | history
blade-auth/src/main/java/org/springblade/common/cache/SysCache.java 317 ●●●●● patch | view | raw | blame | history
blade-auth/src/main/java/org/springblade/common/cache/UserCache.java 77 ●●●●● patch | view | raw | blame | history
blade-auth/src/main/java/org/springblade/common/enums/DictBizEnum.java 39 ●●●●● patch | view | raw | blame | history
blade-auth/src/main/java/org/springblade/common/enums/DictEnum.java 95 ●●●●● patch | view | raw | blame | history
blade-auth/src/main/java/org/springblade/system/controller/DeptController.java 4 ●●●● patch | view | raw | blame | history
blade-auth/src/main/java/org/springblade/system/controller/MenuController.java 2 ●●●●● patch | view | raw | blame | history
blade-auth/src/main/java/org/springblade/system/service/impl/DictBizServiceImpl.java 2 ●●● patch | view | raw | blame | history
blade-auth/src/main/java/org/springblade/system/service/impl/DictServiceImpl.java 2 ●●● patch | view | raw | blame | history
blade-auth/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java 6 ●●●● patch | view | raw | blame | history
blade-auth/src/main/java/org/springblade/system/user/wrapper/UserWrapper.java 6 ●●●● patch | view | raw | blame | history
blade-auth/src/main/java/org/springblade/system/wrapper/ApiScopeWrapper.java 4 ●●●● patch | view | raw | blame | history
blade-auth/src/main/java/org/springblade/system/wrapper/DataScopeWrapper.java 4 ●●●● patch | view | raw | blame | history
blade-auth/src/main/java/org/springblade/system/wrapper/DeptWrapper.java 8 ●●●● patch | view | raw | blame | history
blade-auth/src/main/java/org/springblade/system/wrapper/DictBizWrapper.java 2 ●●● patch | view | raw | blame | history
blade-auth/src/main/java/org/springblade/system/wrapper/DictWrapper.java 2 ●●● patch | view | raw | blame | history
blade-auth/src/main/java/org/springblade/system/wrapper/MenuWrapper.java 8 ●●●● patch | view | raw | blame | history
blade-auth/src/main/java/org/springblade/system/wrapper/PostWrapper.java 4 ●●●● patch | view | raw | blame | history
blade-auth/src/main/resources/application-dev.yml 2 ●●●●● patch | view | raw | blame | history
blade-auth/src/main/resources/application.yml 6 ●●●●● patch | view | raw | blame | history
blade-auth/src/main/java/org/springblade/auth/config/SecurityConfiguration.java
@@ -41,11 +41,11 @@
    @Bean
    public SecureRegistry secureRegistry() {
        SecureRegistry secureRegistry = new SecureRegistry();
//        secureRegistry.setEnabled(false);
        secureRegistry.setEnabled(true);
        secureRegistry.excludePathPatterns("/oauth/login");
        secureRegistry.excludePathPatterns("/oauth/authorize");
        secureRegistry.excludePathPatterns("/oauth/form");
        secureRegistry.excludePathPatterns("/oauth/token");
        secureRegistry.excludePathPatterns("/blade-system/menu/routes");
        secureRegistry.excludePathPatterns("/blade-system/menu/auth-routes");
        secureRegistry.excludePathPatterns("/blade-system/menu/top-menu");
blade-auth/src/main/java/org/springblade/auth/endpoint/BladeTokenEndPoint.java
@@ -16,10 +16,13 @@
 */
package org.springblade.auth.endpoint;
import com.alibaba.fastjson.JSON;
import com.wf.captcha.SpecCaptcha;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.cache.CacheNames;
import org.springblade.common.utils.HttpClientUtils;
import org.springblade.core.cache.utils.CacheUtil;
import org.springblade.core.jwt.JwtUtil;
import org.springblade.core.jwt.props.JwtProperties;
@@ -32,6 +35,8 @@
import org.springblade.core.tool.support.Kv;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.core.tool.utils.WebUtil;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
@@ -42,8 +47,14 @@
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.time.Duration;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
import static org.springblade.core.cache.constant.CacheConstant.*;
/**
@@ -71,14 +82,31 @@
        return model;
    }
//    /**
//     * 登录页面
//     */
//    @SneakyThrows
//    @GetMapping("/oauth/login")
//    public void require(HttpServletResponse response) {
//        response.sendRedirect("http://localhost:1888/");
//    }
    /**
     * 通过 code 获取 token
     */
    @SneakyThrows
    @GetMapping("/oauth/getTokenByCode")
    public R require(HttpServletResponse response,String code) {
        // 设置请求头
        Map<String, String> headerMap = new HashMap<>();
        HttpHeaders headers = new HttpHeaders();
        headers.setContentType(MediaType.APPLICATION_JSON);
        String clientStr = "sword:sword_secret";
        String encodedString = Base64.getEncoder().encodeToString(clientStr.getBytes());
        headerMap.put("Authorization", "Basic " + encodedString);
        // url
        String url = "http://localhost:8100/oauth/token";
        // 参数
        Map<String, String> param = new HashMap<>();
        param.put("code", code);
        param.put("grant_type", "authorization_code");
        param.put("redirect_uri", "http://192.168.1.50:1888");
        String accessToken = HttpClientUtils.doPost(url,headerMap ,param);
        System.out.println("accessToken = " + accessToken);
        Map<String, String> maps = (Map<String, String>) JSON.parse(accessToken);
        return R.data(maps);
    }
    /**
     * 授权页面
blade-auth/src/main/java/org/springblade/auth/handle/TokenFilterHandle.java
@@ -2,10 +2,12 @@
import com.alibaba.nacos.common.utils.StringUtils;
import io.jsonwebtoken.Claims;
import org.springblade.auth.utils.TokenUtil;
import org.springblade.core.jwt.JwtUtil;
import org.springblade.core.launch.constant.TokenConstant;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
import org.springframework.web.filter.OncePerRequestFilter;
@@ -30,6 +32,7 @@
            String token = JwtUtil.getToken(auth);
            Claims claims = JwtUtil.parseJWT(token);
            if (!StringUtils.isBlank(token) && null!=claims) {
                SecurityContext context = SecurityContextHolder.getContext();
                //判断 Token 状态
                String tenantId = String.valueOf(claims.get(TokenConstant.TENANT_ID));
                String userId = String.valueOf(claims.get(TokenConstant.USER_ID));
blade-auth/src/main/java/org/springblade/auth/service/BladeUserDetailsServiceImpl.java
@@ -26,17 +26,14 @@
import org.springblade.core.jwt.JwtUtil;
import org.springblade.core.jwt.props.JwtProperties;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.*;
import org.springblade.system.cache.ParamCache;
import org.springblade.system.entity.Tenant;
import org.springblade.system.feign.ISysClient;
import org.springblade.system.service.IRoleService;
import org.springblade.system.service.ITenantService;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.entity.UserInfo;
import org.springblade.system.user.enums.UserEnum;
import org.springblade.system.user.feign.IUserClient;
import org.springblade.system.user.service.IUserService;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.userdetails.UserDetailsService;
blade-auth/src/main/java/org/springblade/common/cache/CacheNames.java
New file
@@ -0,0 +1,61 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.common.cache;
import org.springblade.core.tool.utils.StringPool;
/**
 * 缓存名
 *
 * @author Chill
 */
public interface CacheNames {
    /**
     * 返回拼接后的key
     *
     * @param cacheKey      缓存key
     * @param cacheKeyValue 缓存key值
     * @return tenantKey
     */
    static String cacheKey(String cacheKey, String cacheKeyValue) {
        return cacheKey.concat(cacheKeyValue);
    }
    /**
     * 返回租户格式的key
     *
     * @param tenantId      租户编号
     * @param cacheKey      缓存key
     * @param cacheKeyValue 缓存key值
     * @return tenantKey
     */
    static String tenantKey(String tenantId, String cacheKey, String cacheKeyValue) {
        return tenantId.concat(StringPool.COLON).concat(cacheKey).concat(cacheKeyValue);
    }
    /**
     * 验证码key
     */
    String CAPTCHA_KEY = "blade:auth::blade:captcha:";
    /**
     * 登录失败key
     */
    String USER_FAIL_KEY = "blade:user::blade:fail:";
}
blade-auth/src/main/java/org/springblade/common/cache/DictBizCache.java
File was renamed from blade-auth/src/main/java/org/springblade/system/cache/DictBizCache.java
@@ -14,14 +14,14 @@
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.system.cache;
package org.springblade.common.cache;
import org.springblade.common.enums.DictBizEnum;
import org.springblade.core.cache.utils.CacheUtil;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.SpringUtil;
import org.springblade.core.tool.utils.StringPool;
import org.springblade.system.entity.DictBiz;
import org.springblade.system.enums.DictBizEnum;
import org.springblade.system.service.IDictBizService;
import java.util.List;
@@ -39,13 +39,10 @@
    private static final String DICT_VALUE = "dictBiz:value";
    private static final String DICT_LIST = "dictBiz:list";
    private static IDictBizService dictClient;
    private static final IDictBizService dictService;
    private static IDictBizService getDictClient() {
        if (dictClient == null) {
            dictClient = SpringUtil.getBean(IDictBizService.class);
        }
        return dictClient;
    static {
        dictService = SpringUtil.getBean(IDictBizService.class);
    }
    /**
@@ -56,10 +53,7 @@
     */
    public static DictBiz getById(Long id) {
        String keyPrefix = DICT_ID.concat(StringPool.DASH).concat(AuthUtil.getTenantId()).concat(StringPool.COLON);
        return CacheUtil.get(DICT_CACHE, keyPrefix, id, () -> {
            DictBiz result = getDictClient().getById(id);
            return result;
        });
        return CacheUtil.get(DICT_CACHE, keyPrefix, id, () -> dictService.getById(id));
    }
    /**
@@ -73,7 +67,6 @@
        return getValue(code.getName(), dictKey);
    }
    /**
     * 获取字典值
     *
@@ -83,10 +76,7 @@
     */
    public static String getValue(String code, Integer dictKey) {
        String keyPrefix = DICT_VALUE.concat(StringPool.DASH).concat(AuthUtil.getTenantId()).concat(StringPool.COLON);
        return CacheUtil.get(DICT_CACHE, keyPrefix + code + StringPool.COLON, String.valueOf(dictKey), () -> {
            String result = getDictClient().getValue(code, String.valueOf(dictKey));
            return result;
        });
        return CacheUtil.get(DICT_CACHE, keyPrefix + code + StringPool.COLON, String.valueOf(dictKey), () -> dictService.getValue(code, String.valueOf(dictKey)));
    }
    /**
@@ -109,10 +99,7 @@
     */
    public static String getValue(String code, String dictKey) {
        String keyPrefix = DICT_VALUE.concat(StringPool.DASH).concat(AuthUtil.getTenantId()).concat(StringPool.COLON);
        return CacheUtil.get(DICT_CACHE, keyPrefix + code + StringPool.COLON, dictKey, () -> {
            String result = getDictClient().getValue(code, dictKey);
            return result;
        });
        return CacheUtil.get(DICT_CACHE, keyPrefix + code + StringPool.COLON, dictKey, () -> dictService.getValue(code, dictKey));
    }
    /**
@@ -123,10 +110,7 @@
     */
    public static List<DictBiz> getList(String code) {
        String keyPrefix = DICT_LIST.concat(StringPool.DASH).concat(AuthUtil.getTenantId()).concat(StringPool.COLON);
        return CacheUtil.get(DICT_CACHE, keyPrefix, code, () -> {
            List<DictBiz> result = getDictClient().getList(code);
            return result;
        });
        return CacheUtil.get(DICT_CACHE, keyPrefix, code, () -> dictService.getList(code));
    }
}
blade-auth/src/main/java/org/springblade/common/cache/DictCache.java
File was renamed from blade-auth/src/main/java/org/springblade/system/cache/DictCache.java
@@ -14,14 +14,13 @@
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.system.cache;
package org.springblade.common.cache;
import org.springblade.common.enums.DictEnum;
import org.springblade.core.cache.utils.CacheUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.SpringUtil;
import org.springblade.core.tool.utils.StringPool;
import org.springblade.system.entity.Dict;
import org.springblade.system.enums.DictEnum;
import org.springblade.system.service.IDictService;
import java.util.List;
@@ -43,13 +42,10 @@
    private static final Boolean TENANT_MODE = Boolean.FALSE;
    private static IDictService dictClient;
    private static final IDictService dictService;
    private static IDictService getDictClient() {
        if (dictClient == null) {
            dictClient = SpringUtil.getBean(IDictService.class);
        }
        return dictClient;
    static {
        dictService = SpringUtil.getBean(IDictService.class);
    }
    /**
@@ -59,10 +55,7 @@
     * @return Dict
     */
    public static Dict getById(Long id) {
        return CacheUtil.get(DICT_CACHE, DICT_ID, id, () -> {
            Dict result = getDictClient().getById(id);
            return result;
        }, TENANT_MODE);
        return CacheUtil.get(DICT_CACHE, DICT_ID, id, () -> dictService.getById(id), TENANT_MODE);
    }
    /**
@@ -104,7 +97,6 @@
        return getValue(code.getName(), dictKey);
    }
    /**
     * 获取字典值
     *
@@ -113,10 +105,7 @@
     * @return String
     */
    public static String getValue(String code, Integer dictKey) {
        return CacheUtil.get(DICT_CACHE, DICT_VALUE + code + StringPool.COLON, String.valueOf(dictKey), () -> {
            String result = getDictClient().getValue(code, String.valueOf(dictKey));
            return result;
        }, TENANT_MODE);
        return CacheUtil.get(DICT_CACHE, DICT_VALUE + code + StringPool.COLON, String.valueOf(dictKey), () -> dictService.getValue(code, String.valueOf(dictKey)), TENANT_MODE);
    }
    /**
@@ -138,10 +127,7 @@
     * @return String
     */
    public static String getValue(String code, String dictKey) {
        return CacheUtil.get(DICT_CACHE, DICT_VALUE + code + StringPool.COLON, dictKey, () -> {
            String result = getDictClient().getValue(code, dictKey);
            return result;
        }, TENANT_MODE);
        return CacheUtil.get(DICT_CACHE, DICT_VALUE + code + StringPool.COLON, dictKey, () -> dictService.getValue(code, dictKey), TENANT_MODE);
    }
    /**
@@ -151,10 +137,7 @@
     * @return List<Dict>
     */
    public static List<Dict> getList(String code) {
        return CacheUtil.get(DICT_CACHE, DICT_LIST, code, () -> {
            List<Dict> result = getDictClient().getList(code);
            return result;
        }, TENANT_MODE);
        return CacheUtil.get(DICT_CACHE, DICT_LIST, code, () -> dictService.getList(code), TENANT_MODE);
    }
}
blade-auth/src/main/java/org/springblade/common/cache/ParamCache.java
New file
@@ -0,0 +1,62 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.common.cache;
import org.springblade.core.cache.utils.CacheUtil;
import org.springblade.core.tool.utils.SpringUtil;
import org.springblade.system.entity.Param;
import org.springblade.system.service.IParamService;
import static org.springblade.core.cache.constant.CacheConstant.PARAM_CACHE;
/**
 * 参数缓存工具类
 *
 * @author Chill
 */
public class ParamCache {
    private static final String PARAM_ID = "param:id:";
    private static final String PARAM_VALUE = "param:value:";
    private static final IParamService paramService;
    static {
        paramService = SpringUtil.getBean(IParamService.class);
    }
    /**
     * 获取参数实体
     *
     * @param id 主键
     * @return Param
     */
    public static Param getById(Long id) {
        return CacheUtil.get(PARAM_CACHE, PARAM_ID, id, () -> paramService.getById(id));
    }
    /**
     * 获取参数配置
     *
     * @param paramKey 参数值
     * @return String
     */
    public static String getValue(String paramKey) {
        return CacheUtil.get(PARAM_CACHE, PARAM_VALUE, paramKey, () -> paramService.getValue(paramKey));
    }
}
blade-auth/src/main/java/org/springblade/common/cache/RegionCache.java
New file
@@ -0,0 +1,56 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.common.cache;
import org.springblade.core.cache.utils.CacheUtil;
import org.springblade.core.tool.utils.SpringUtil;
import org.springblade.system.entity.Region;
import org.springblade.system.service.IRegionService;
import static org.springblade.core.cache.constant.CacheConstant.SYS_CACHE;
/**
 * 行政区划缓存工具类
 *
 * @author Chill
 */
public class RegionCache {
    public static final int PROVINCE_LEVEL = 1;
    public static final int CITY_LEVEL = 2;
    public static final int DISTRICT_LEVEL = 3;
    public static final int TOWN_LEVEL = 4;
    public static final int VILLAGE_LEVEL = 5;
    private static final String REGION_CODE = "region:code:";
    private static final IRegionService regionService;
    static {
        regionService = SpringUtil.getBean(IRegionService.class);
    }
    /**
     * 获取行政区划实体
     *
     * @param code 区划编号
     * @return Param
     */
    public static Region getByCode(String code) {
        return CacheUtil.get(SYS_CACHE, REGION_CODE, code, () -> regionService.getById(code));
    }
}
blade-auth/src/main/java/org/springblade/common/cache/SysCache.java
New file
@@ -0,0 +1,317 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.common.cache;
import org.springblade.core.cache.utils.CacheUtil;
import org.springblade.core.tool.utils.SpringUtil;
import org.springblade.core.tool.utils.StringPool;
import org.springblade.system.entity.*;
import org.springblade.system.service.*;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import static org.springblade.core.cache.constant.CacheConstant.SYS_CACHE;
/**
 * 系统缓存
 *
 * @author Chill
 */
public class SysCache {
    private static final String MENU_ID = "menu:id:";
    private static final String DEPT_ID = "dept:id:";
    private static final String DEPT_NAME = "dept:name:";
    private static final String DEPT_NAME_FUZZY = "dept:nameFuzzy:";
    private static final String DEPT_NAME_ID = "deptName:id:";
    private static final String DEPT_NAMES_ID = "deptNames:id:";
    private static final String DEPT_CHILD_ID = "deptChild:id:";
    private static final String DEPT_CHILDIDS_ID = "deptChildIds:id:";
    private static final String POST_ID = "post:id:";
    private static final String POST_NAME = "post:name:";
    private static final String POST_NAME_FUZZY = "post:nameFuzzy:";
    private static final String POST_NAME_ID = "postName:id:";
    private static final String POST_NAMES_ID = "postNames:id:";
    private static final String ROLE_ID = "role:id:";
    private static final String ROLE_NAME = "role:name:";
    private static final String ROLE_NAME_ID = "roleName:id:";
    private static final String ROLE_NAMES_ID = "roleNames:id:";
    private static final String ROLE_ALIAS_ID = "roleAlias:id:";
    private static final String ROLE_ALIASES_ID = "roleAliases:id:";
    public static final String TENANT_ID = "tenant:id:";
    public static final String TENANT_TENANT_ID = "tenant:tenantId:";
    public static final String TENANT_PACKAGE_ID = "tenant:packageId:";
    private static final IMenuService menuService;
    private static final IDeptService deptService;
    private static final IPostService postService;
    private static final IRoleService roleService;
    private static final ITenantService tenantService;
    private static final ITenantPackageService tenantPackageService;
    static {
        menuService = SpringUtil.getBean(IMenuService.class);
        deptService = SpringUtil.getBean(IDeptService.class);
        postService = SpringUtil.getBean(IPostService.class);
        roleService = SpringUtil.getBean(IRoleService.class);
        tenantService = SpringUtil.getBean(ITenantService.class);
        tenantPackageService = SpringUtil.getBean(ITenantPackageService.class);
    }
    /**
     * 获取菜单
     *
     * @param id 主键
     * @return 菜单
     */
    public static Menu getMenu(Long id) {
        return CacheUtil.get(SYS_CACHE, MENU_ID, id, () -> menuService.getById(id));
    }
    /**
     * 获取部门
     *
     * @param id 主键
     * @return 部门
     */
    public static Dept getDept(Long id) {
        return CacheUtil.get(SYS_CACHE, DEPT_ID, id, () -> deptService.getById(id));
    }
    /**
     * 获取部门id
     *
     * @param tenantId  租户id
     * @param deptNames 部门名
     * @return 部门id
     */
    public static String getDeptIds(String tenantId, String deptNames) {
        return CacheUtil.get(SYS_CACHE, DEPT_NAME, tenantId + StringPool.DASH + deptNames, () -> deptService.getDeptIds(tenantId, deptNames));
    }
    /**
     * 获取部门id
     *
     * @param tenantId  租户id
     * @param deptNames 部门名模糊查询
     * @return 部门id
     */
    public static String getDeptIdsByFuzzy(String tenantId, String deptNames) {
        return CacheUtil.get(SYS_CACHE, DEPT_NAME_FUZZY, tenantId + StringPool.DASH + deptNames, () -> deptService.getDeptIdsByFuzzy(tenantId, deptNames));
    }
    /**
     * 获取部门名
     *
     * @param id 主键
     * @return 部门名
     */
    public static String getDeptName(Long id) {
        return CacheUtil.get(SYS_CACHE, DEPT_NAME_ID, id, () -> deptService.getById(id).getDeptName());
    }
    /**
     * 获取部门名集合
     *
     * @param deptIds 主键集合
     * @return 部门名
     */
    public static List<String> getDeptNames(String deptIds) {
        return CacheUtil.get(SYS_CACHE, DEPT_NAMES_ID, deptIds, () -> deptService.getDeptNames(deptIds));
    }
    /**
     * 获取子部门集合
     *
     * @param deptId 主键
     * @return 子部门
     */
    public static List<Dept> getDeptChild(Long deptId) {
        return CacheUtil.get(SYS_CACHE, DEPT_CHILD_ID, deptId, () -> deptService.getDeptChild(deptId));
    }
    /**
     * 获取子部门ID集合
     *
     * @param deptId 主键
     * @return 子部门ID
     */
    public static List<Long> getDeptChildIds(Long deptId) {
        if (deptId == null) {
            return null;
        }
        List<Long> deptIdList = CacheUtil.get(SYS_CACHE, DEPT_CHILDIDS_ID, deptId, List.class);
        if (deptIdList == null) {
            deptIdList = new ArrayList<>();
            List<Dept> deptChild = getDeptChild(deptId);
            if (deptChild != null) {
                List<Long> collect = deptChild.stream().map(Dept::getId).collect(Collectors.toList());
                deptIdList.addAll(collect);
            }
            deptIdList.add(deptId);
            CacheUtil.put(SYS_CACHE, DEPT_CHILDIDS_ID, deptId, deptIdList);
        }
        return deptIdList;
    }
    /**
     * 获取岗位
     *
     * @param id 主键
     * @return
     */
    public static Post getPost(Long id) {
        return CacheUtil.get(SYS_CACHE, POST_ID, id, () -> postService.getById(id));
    }
    /**
     * 获取岗位id
     *
     * @param tenantId  租户id
     * @param postNames 岗位名
     * @return
     */
    public static String getPostIds(String tenantId, String postNames) {
        return CacheUtil.get(SYS_CACHE, POST_NAME, tenantId + StringPool.DASH + postNames, () -> postService.getPostIds(tenantId, postNames));
    }
    /**
     * 获取岗位id
     *
     * @param tenantId  租户id
     * @param postNames 岗位名模糊查询
     * @return
     */
    public static String getPostIdsByFuzzy(String tenantId, String postNames) {
        return CacheUtil.get(SYS_CACHE, POST_NAME_FUZZY, tenantId + StringPool.DASH + postNames, () -> postService.getPostIdsByFuzzy(tenantId, postNames));
    }
    /**
     * 获取岗位名
     *
     * @param id 主键
     * @return 岗位名
     */
    public static String getPostName(Long id) {
        return CacheUtil.get(SYS_CACHE, POST_NAME_ID, id, () -> postService.getById(id).getPostName());
    }
    /**
     * 获取岗位名集合
     *
     * @param postIds 主键集合
     * @return 岗位名
     */
    public static List<String> getPostNames(String postIds) {
        return CacheUtil.get(SYS_CACHE, POST_NAMES_ID, postIds, () -> postService.getPostNames(postIds));
    }
    /**
     * 获取角色
     *
     * @param id 主键
     * @return Role
     */
    public static Role getRole(Long id) {
        return CacheUtil.get(SYS_CACHE, ROLE_ID, id, () -> roleService.getById(id));
    }
    /**
     * 获取角色id
     *
     * @param tenantId  租户id
     * @param roleNames 角色名
     * @return
     */
    public static String getRoleIds(String tenantId, String roleNames) {
        return CacheUtil.get(SYS_CACHE, ROLE_NAME, tenantId + StringPool.DASH + roleNames, () -> roleService.getRoleIds(tenantId, roleNames));
    }
    /**
     * 获取角色名
     *
     * @param id 主键
     * @return 角色名
     */
    public static String getRoleName(Long id) {
        return CacheUtil.get(SYS_CACHE, ROLE_NAME_ID, id, () -> roleService.getById(id).getRoleName());
    }
    /**
     * 获取角色名集合
     *
     * @param roleIds 主键集合
     * @return 角色名
     */
    public static List<String> getRoleNames(String roleIds) {
        return CacheUtil.get(SYS_CACHE, ROLE_NAMES_ID, roleIds, () -> roleService.getRoleNames(roleIds));
    }
    /**
     * 获取角色别名
     *
     * @param id 主键
     * @return 角色别名
     */
    public static String getRoleAlias(Long id) {
        return CacheUtil.get(SYS_CACHE, ROLE_ALIAS_ID, id, () -> roleService.getById(id).getRoleAlias());
    }
    /**
     * 获取角色别名集合
     *
     * @param roleIds 主键集合
     * @return 角色别名
     */
    public static List<String> getRoleAliases(String roleIds) {
        return CacheUtil.get(SYS_CACHE, ROLE_ALIASES_ID, roleIds, () -> roleService.getRoleAliases(roleIds));
    }
    /**
     * 获取租户
     *
     * @param id 主键
     * @return Tenant
     */
    public static Tenant getTenant(Long id) {
        return CacheUtil.get(SYS_CACHE, TENANT_ID, id, () -> tenantService.getById(id), Boolean.FALSE);
    }
    /**
     * 获取租户
     *
     * @param tenantId 租户id
     * @return Tenant
     */
    public static Tenant getTenant(String tenantId) {
        return CacheUtil.get(SYS_CACHE, TENANT_TENANT_ID, tenantId, () -> tenantService.getByTenantId(tenantId), Boolean.FALSE);
    }
    /**
     * 获取租户产品包
     *
     * @param tenantId 租户id
     * @return Tenant
     */
    public static TenantPackage getTenantPackage(String tenantId) {
        Tenant tenant = getTenant(tenantId);
        return CacheUtil.get(SYS_CACHE, TENANT_PACKAGE_ID, tenantId, () -> tenantPackageService.getById(tenant.getPackageId()), Boolean.FALSE);
    }
}
blade-auth/src/main/java/org/springblade/common/cache/UserCache.java
New file
@@ -0,0 +1,77 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.common.cache;
import org.springblade.core.cache.utils.CacheUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.SpringUtil;
import org.springblade.core.tool.utils.StringPool;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.service.IUserService;
import static org.springblade.core.cache.constant.CacheConstant.USER_CACHE;
import static org.springblade.core.launch.constant.FlowConstant.TASK_USR_PREFIX;
/**
 * 系统缓存
 *
 * @author Chill
 */
public class UserCache {
    private static final String USER_CACHE_ID = "user:id:";
    private static final String USER_CACHE_ACCOUNT = "user:account:";
    private static final IUserService userService;
    static {
        userService = SpringUtil.getBean(IUserService.class);
    }
    /**
     * 根据任务用户id获取用户信息
     *
     * @param taskUserId 任务用户id
     * @return
     */
    public static User getUserByTaskUser(String taskUserId) {
        Long userId = Func.toLong(StringUtil.removePrefix(taskUserId, TASK_USR_PREFIX));
        return getUser(userId);
    }
    /**
     * 获取用户
     *
     * @param userId 用户id
     * @return
     */
    public static User getUser(Long userId) {
        return CacheUtil.get(USER_CACHE, USER_CACHE_ID, userId, () -> userService.getById(userId));
    }
    /**
     * 获取用户
     *
     * @param tenantId 租户id
     * @param account  账号名
     * @return
     */
    public static User getUser(String tenantId, String account) {
        return CacheUtil.get(USER_CACHE, USER_CACHE_ACCOUNT, tenantId + StringPool.DASH + account, () -> userService.userByAccount(tenantId, account));
    }
}
blade-auth/src/main/java/org/springblade/common/enums/DictBizEnum.java
New file
@@ -0,0 +1,39 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
 * 业务字典枚举类
 *
 * @author Chill
 */
@Getter
@AllArgsConstructor
public enum DictBizEnum {
    /**
     * 测试
     */
    TEST("test"),
    ;
    final String name;
}
blade-auth/src/main/java/org/springblade/common/enums/DictEnum.java
New file
@@ -0,0 +1,95 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
 * 系统字典枚举类
 *
 * @author Chill
 */
@Getter
@AllArgsConstructor
public enum DictEnum {
    /**
     * 性别
     */
    SEX("sex"),
    /**
     * 通知类型
     */
    NOTICE("notice"),
    /**
     * 菜单类型
     */
    MENU_CATEGORY("menu_category"),
    /**
     * 按钮功能
     */
    BUTTON_FUNC("button_func"),
    /**
     * 是否
     */
    YES_NO("yes_no"),
    /**
     * 流程类型
     */
    FLOW("flow"),
    /**
     * 机构类型
     */
    ORG_CATEGORY("org_category"),
    /**
     * 数据权限
     */
    DATA_SCOPE_TYPE("data_scope_type"),
    /**
     * 接口权限
     */
    API_SCOPE_TYPE("api_scope_type"),
    /**
     * 权限类型
     */
    SCOPE_CATEGORY("scope_category"),
    /**
     * 对象存储类型
     */
    OSS("oss"),
    /**
     * 短信服务类型
     */
    SMS("sms"),
    /**
     * 岗位类型
     */
    POST_CATEGORY("post_category"),
    /**
     * 行政区划
     */
    REGION("region"),
    /**
     * 用户平台
     */
    USER_TYPE("user_type"),
    ;
    final String name;
}
blade-auth/src/main/java/org/springblade/system/controller/DeptController.java
@@ -5,6 +5,7 @@
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.*;
import lombok.AllArgsConstructor;
import org.springblade.common.cache.DictCache;
import org.springblade.core.cache.utils.CacheUtil;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.secure.BladeUser;
@@ -14,7 +15,6 @@
import org.springblade.core.tool.constant.RoleConstant;
import org.springblade.core.tool.support.Kv;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.DictCache;
import org.springblade.system.entity.Dept;
import org.springblade.system.enums.DictEnum;
import org.springblade.system.service.IDeptService;
@@ -123,7 +123,7 @@
            CacheUtil.clear(SYS_CACHE);
            // 返回懒加载树更新节点所需字段
            Kv kv = Kv.create().set("id", String.valueOf(dept.getId())).set("tenantId", dept.getTenantId())
                .set("deptCategoryName", DictCache.getValue(DictEnum.ORG_CATEGORY, dept.getDeptCategory()));
                .set("deptCategoryName", DictCache.getValue(DictEnum.ORG_CATEGORY.getName(), dept.getDeptCategory()));
            return R.data(kv);
        }
        return R.fail("操作失败");
blade-auth/src/main/java/org/springblade/system/controller/MenuController.java
@@ -7,6 +7,7 @@
import org.springblade.core.cache.utils.CacheUtil;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.RoleConstant;
@@ -161,6 +162,7 @@
    @ApiOperationSupport(order = 8)
    @ApiOperation(value = "前端菜单数据", notes = "前端菜单数据")
    public R<List<MenuVO>> routes(BladeUser user, Long topMenuId) {
        user = AuthUtil.getUser();
        List<MenuVO> list = menuService.routes((user == null) ? null : user.getRoleId(), topMenuId);
        return R.data(list);
    }
blade-auth/src/main/java/org/springblade/system/service/impl/DictBizServiceImpl.java
@@ -29,7 +29,7 @@
import org.springblade.core.tool.node.ForestNodeMerger;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringPool;
import org.springblade.system.cache.DictBizCache;
import org.springblade.common.cache.DictBizCache;
import org.springblade.system.entity.DictBiz;
import org.springblade.system.mapper.DictBizMapper;
import org.springblade.system.service.IDictBizService;
blade-auth/src/main/java/org/springblade/system/service/impl/DictServiceImpl.java
@@ -29,7 +29,7 @@
import org.springblade.core.tool.node.ForestNodeMerger;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringPool;
import org.springblade.system.cache.DictCache;
import org.springblade.common.cache.DictCache;
import org.springblade.system.entity.Dict;
import org.springblade.system.mapper.DictMapper;
import org.springblade.system.service.IDictService;
blade-auth/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java
@@ -22,6 +22,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.AllArgsConstructor;
import org.springblade.common.cache.DictCache;
import org.springblade.common.constant.CommonConstant;
import org.springblade.common.constant.TenantConstant;
import org.springblade.core.mp.base.BaseServiceImpl;
@@ -34,7 +35,6 @@
import org.springblade.core.tool.jackson.JsonUtil;
import org.springblade.core.tool.support.Kv;
import org.springblade.core.tool.utils.*;
import org.springblade.system.cache.DictCache;
import org.springblade.system.cache.ParamCache;
import org.springblade.system.cache.SysCache;
import org.springblade.system.entity.Tenant;
@@ -311,7 +311,7 @@
        data.forEach(userExcel -> {
            User user = Objects.requireNonNull(BeanUtil.copy(userExcel, User.class));
            // 设置用户平台
            user.setUserType(Func.toInt(DictCache.getKey(DictEnum.USER_TYPE, userExcel.getUserTypeName()), 1));
            user.setUserType(Func.toInt(DictCache.getKey(DictEnum.USER_TYPE.getName(), userExcel.getUserTypeName()), 1));
            // 设置部门ID
            user.setDeptId(Func.toStrWithEmpty(SysCache.getDeptIds(userExcel.getTenantId(), userExcel.getDeptName()), StringPool.EMPTY));
            // 设置岗位ID
@@ -343,7 +343,7 @@
    public List<UserExcel> exportUser(Wrapper<User> queryWrapper) {
        List<UserExcel> userList = baseMapper.exportUser(queryWrapper);
        userList.forEach(user -> {
            user.setUserTypeName(DictCache.getValue(DictEnum.USER_TYPE, user.getUserType()));
            user.setUserTypeName(DictCache.getValue(DictEnum.USER_TYPE.getName(), user.getUserType()));
            user.setRoleName(StringUtil.join(SysCache.getRoleNames(user.getRoleId())));
            user.setDeptName(StringUtil.join(SysCache.getDeptNames(user.getDeptId())));
            user.setPostName(StringUtil.join(SysCache.getPostNames(user.getPostId())));
blade-auth/src/main/java/org/springblade/system/user/wrapper/UserWrapper.java
@@ -19,7 +19,7 @@
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.DictCache;
import org.springblade.common.cache.DictCache;
import org.springblade.system.cache.SysCache;
import org.springblade.system.entity.Tenant;
import org.springblade.system.enums.DictEnum;
@@ -51,8 +51,8 @@
        userVO.setRoleName(Func.join(roleName));
        userVO.setDeptName(Func.join(deptName));
        userVO.setPostName(Func.join(postName));
        userVO.setSexName(DictCache.getValue(DictEnum.SEX, user.getSex()));
        userVO.setUserTypeName(DictCache.getValue(DictEnum.USER_TYPE, user.getUserType()));
        userVO.setSexName(DictCache.getValue(DictEnum.SEX.getName(), user.getSex()));
        userVO.setUserTypeName(DictCache.getValue(DictEnum.USER_TYPE.getName(), user.getUserType()));
        return userVO;
    }
blade-auth/src/main/java/org/springblade/system/wrapper/ApiScopeWrapper.java
@@ -18,7 +18,7 @@
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.system.cache.DictCache;
import org.springblade.common.cache.DictCache;
import org.springblade.system.entity.ApiScope;
import org.springblade.system.enums.DictEnum;
import org.springblade.system.vo.ApiScopeVO;
@@ -40,7 +40,7 @@
    @Override
    public ApiScopeVO entityVO(ApiScope dataScope) {
        ApiScopeVO apiScopeVO = Objects.requireNonNull(BeanUtil.copy(dataScope, ApiScopeVO.class));
        String scopeTypeName = DictCache.getValue(DictEnum.API_SCOPE_TYPE, dataScope.getScopeType());
        String scopeTypeName = DictCache.getValue(DictEnum.API_SCOPE_TYPE.getName(), dataScope.getScopeType());
        apiScopeVO.setScopeTypeName(scopeTypeName);
        return apiScopeVO;
    }
blade-auth/src/main/java/org/springblade/system/wrapper/DataScopeWrapper.java
@@ -18,7 +18,7 @@
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.system.cache.DictCache;
import org.springblade.common.cache.DictCache;
import org.springblade.system.entity.DataScope;
import org.springblade.system.enums.DictEnum;
import org.springblade.system.vo.DataScopeVO;
@@ -40,7 +40,7 @@
    @Override
    public DataScopeVO entityVO(DataScope dataScope) {
        DataScopeVO dataScopeVO = Objects.requireNonNull(BeanUtil.copy(dataScope, DataScopeVO.class));
        String scopeTypeName = DictCache.getValue(DictEnum.DATA_SCOPE_TYPE, dataScope.getScopeType());
        String scopeTypeName = DictCache.getValue(DictEnum.DATA_SCOPE_TYPE.getName(), dataScope.getScopeType());
        dataScopeVO.setScopeTypeName(scopeTypeName);
        return dataScopeVO;
    }
blade-auth/src/main/java/org/springblade/system/wrapper/DeptWrapper.java
@@ -21,7 +21,7 @@
import org.springblade.core.tool.node.ForestNodeMerger;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.DictCache;
import org.springblade.common.cache.DictCache;
import org.springblade.system.cache.SysCache;
import org.springblade.system.entity.Dept;
import org.springblade.system.enums.DictEnum;
@@ -51,7 +51,7 @@
            Dept parent = SysCache.getDept(dept.getParentId());
            deptVO.setParentName(parent.getDeptName());
        }
        String category = DictCache.getValue(DictEnum.ORG_CATEGORY, dept.getDeptCategory());
        String category = DictCache.getValue(DictEnum.ORG_CATEGORY.getName(), dept.getDeptCategory());
        deptVO.setDeptCategoryName(category);
        return deptVO;
    }
@@ -60,7 +60,7 @@
    public List<DeptVO> listNodeVO(List<Dept> list) {
        List<DeptVO> collect = list.stream().map(dept -> {
            DeptVO deptVO = BeanUtil.copy(dept, DeptVO.class);
            String category = DictCache.getValue(DictEnum.ORG_CATEGORY, dept.getDeptCategory());
            String category = DictCache.getValue(DictEnum.ORG_CATEGORY.getName(), dept.getDeptCategory());
            Objects.requireNonNull(deptVO).setDeptCategoryName(category);
            return deptVO;
        }).collect(Collectors.toList());
@@ -69,7 +69,7 @@
    public List<DeptVO> listNodeLazyVO(List<DeptVO> list) {
        List<DeptVO> collect = list.stream().peek(dept -> {
            String category = DictCache.getValue(DictEnum.ORG_CATEGORY, dept.getDeptCategory());
            String category = DictCache.getValue(DictEnum.ORG_CATEGORY.getName(), dept.getDeptCategory());
            Objects.requireNonNull(dept).setDeptCategoryName(category);
        }).collect(Collectors.toList());
        return ForestNodeMerger.merge(collect);
blade-auth/src/main/java/org/springblade/system/wrapper/DictBizWrapper.java
@@ -21,7 +21,7 @@
import org.springblade.core.tool.node.ForestNodeMerger;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.DictBizCache;
import org.springblade.common.cache.DictBizCache;
import org.springblade.system.entity.DictBiz;
import org.springblade.system.vo.DictBizVO;
blade-auth/src/main/java/org/springblade/system/wrapper/DictWrapper.java
@@ -21,7 +21,7 @@
import org.springblade.core.tool.node.ForestNodeMerger;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.DictCache;
import org.springblade.common.cache.DictCache;
import org.springblade.system.entity.Dict;
import org.springblade.system.vo.DictVO;
blade-auth/src/main/java/org/springblade/system/wrapper/MenuWrapper.java
@@ -21,7 +21,7 @@
import org.springblade.core.tool.node.ForestNodeMerger;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.DictCache;
import org.springblade.common.cache.DictCache;
import org.springblade.system.cache.SysCache;
import org.springblade.system.entity.Menu;
import org.springblade.system.enums.DictEnum;
@@ -51,9 +51,9 @@
            Menu parent = SysCache.getMenu(menu.getParentId());
            menuVO.setParentName(parent.getName());
        }
        String category = DictCache.getValue(DictEnum.MENU_CATEGORY, Func.toInt(menuVO.getCategory()));
        String action = DictCache.getValue(DictEnum.BUTTON_FUNC, Func.toInt(menuVO.getAction()));
        String open = DictCache.getValue(DictEnum.YES_NO, Func.toInt(menuVO.getIsOpen()));
        String category = DictCache.getValue(DictEnum.MENU_CATEGORY.getName(), Func.toInt(menuVO.getCategory()));
        String action = DictCache.getValue(DictEnum.BUTTON_FUNC.getName(), Func.toInt(menuVO.getAction()));
        String open = DictCache.getValue(DictEnum.YES_NO.getName(), Func.toInt(menuVO.getIsOpen()));
        menuVO.setCategoryName(category);
        menuVO.setActionName(action);
        menuVO.setIsOpenName(open);
blade-auth/src/main/java/org/springblade/system/wrapper/PostWrapper.java
@@ -18,7 +18,7 @@
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.system.cache.DictCache;
import org.springblade.common.cache.DictCache;
import org.springblade.system.entity.Post;
import org.springblade.system.enums.DictEnum;
import org.springblade.system.vo.PostVO;
@@ -39,7 +39,7 @@
    @Override
    public PostVO entityVO(Post post) {
        PostVO postVO = Objects.requireNonNull(BeanUtil.copy(post, PostVO.class));
        String categoryName = DictCache.getValue(DictEnum.POST_CATEGORY, post.getCategory());
        String categoryName = DictCache.getValue(DictEnum.POST_CATEGORY.getName(), post.getCategory());
        postVO.setCategoryName(categoryName);
        return postVO;
    }
blade-auth/src/main/resources/application-dev.yml
@@ -28,5 +28,7 @@
oauth2:
  base:
    authorizeUrl: http://192.168.1.50:1888/api/oauth/authorize
#    authorizeUrl: http://localhost/:8100/api/oauth/authorize
    loginPage: http://192.168.1.50:1888/#/login
#    loginPage: /oauth/login
    loginProcessingUrl: /oauth/form
blade-auth/src/main/resources/application.yml
@@ -142,12 +142,6 @@
    #接口放行
    skip-url:
      - /test/**
      - /menu/routes
      - /menu/auth-routes
      - /menu/top-menu
      - /blade-auth/**
      - /tenant/info
      - /oauth/form
    #授权认证配置
    auth:
      - method: ALL