类 SecurityContextService
java.lang.Object
com.elitesland.ystdms.sys.security.SecurityContextService
扩展的 Security 上下文服务
提供用户相关的扩展信息(员工、公司、组织等)的查询能力
这些信息通过 Feign 客户端调用 newsys 对应接口获取,并缓存以提高性能
-
构造器概要
构造器构造器说明SecurityContextService(SysEmployeeFeignClient employeeFeignClient, SysOrgFeignClient orgFeignClient, SysOuFeignClient ouFeignClient) -
方法概要
修饰符和类型方法说明void清除缓存voidclearUserCache(String username) 清除指定用户的缓存getAllOu()获取所有公司信息获取当前登录用户的员工信息获取当前用户所属的组织信息获取当前用户所属的公司信息getEmployee(String username) 获取指定用户的员工信息getEmployeeByUserId(UUID userId) 根据用户ID获取员工信息(支持 Feign 和本地查询复用)获取指定ID的组织信息
-
构造器详细资料
-
SecurityContextService
public SecurityContextService(@Nullable SysEmployeeFeignClient employeeFeignClient, @Nullable SysOrgFeignClient orgFeignClient, @Nullable SysOuFeignClient ouFeignClient)
-
-
方法详细资料
-
getCurrentEmployee
获取当前登录用户的员工信息- 返回:
- 员工信息,如果未登录或查询失败则返回 null
-
getEmployee
获取指定用户的员工信息- 参数:
username- 用户名- 返回:
- 员工信息,如果查询失败则返回 null
-
getEmployeeByUserId
根据用户ID获取员工信息(支持 Feign 和本地查询复用) -
getCurrentOrg
获取当前用户所属的组织信息- 返回:
- 组织信息,如果未登录或查询失败则返回 null
-
getOrg
获取指定ID的组织信息- 参数:
orgId- 组织ID- 返回:
- 组织信息,如果查询失败则返回 null
-
getCurrentOu
获取当前用户所属的公司信息- 返回:
- 公司信息列表,如果未登录或查询失败则返回 null
-
getAllOu
获取所有公司信息- 返回:
- 公司信息列表,如果查询失败则返回 null
-
clearCache
public void clearCache()清除缓存 -
clearUserCache
清除指定用户的缓存- 参数:
username- 用户名
-