Class SecurityContextService
java.lang.Object
com.elitesland.ystdms.sys.security.SecurityContextService
扩展的 Security 上下文服务
提供用户相关的扩展信息(员工、公司、组织等)的查询能力
这些信息通过 Feign 客户端调用 newsys 对应接口获取,并缓存以提高性能
-
Constructor Summary
ConstructorsConstructorDescriptionSecurityContextService(SysEmployeeFeignClient employeeFeignClient, SysOrgFeignClient orgFeignClient, SysOuFeignClient ouFeignClient) -
Method Summary
Modifier and TypeMethodDescriptionvoid清除缓存voidclearUserCache(String username) 清除指定用户的缓存getAllOu()获取所有公司信息获取当前登录用户的员工信息获取当前用户所属的组织信息获取当前用户所属的公司信息getEmployee(String username) 获取指定用户的员工信息获取指定ID的组织信息
-
Constructor Details
-
SecurityContextService
public SecurityContextService(@Nullable SysEmployeeFeignClient employeeFeignClient, @Nullable SysOrgFeignClient orgFeignClient, @Nullable SysOuFeignClient ouFeignClient)
-
-
Method Details
-
getCurrentEmployee
获取当前登录用户的员工信息- Returns:
- 员工信息,如果未登录或查询失败则返回 null
-
getEmployee
获取指定用户的员工信息- Parameters:
username- 用户名- Returns:
- 员工信息,如果查询失败则返回 null
-
getCurrentOrg
获取当前用户所属的组织信息- Returns:
- 组织信息,如果未登录或查询失败则返回 null
-
getOrg
获取指定ID的组织信息- Parameters:
orgId- 组织ID- Returns:
- 组织信息,如果查询失败则返回 null
-
getCurrentOu
获取当前用户所属的公司信息- Returns:
- 公司信息列表,如果未登录或查询失败则返回 null
-
getAllOu
获取所有公司信息- Returns:
- 公司信息列表,如果查询失败则返回 null
-
clearCache
public void clearCache()清除缓存 -
clearUserCache
清除指定用户的缓存- Parameters:
username- 用户名
-