|
@@ -11,6 +11,7 @@ import com.qmth.sop.business.bean.result.MenuResult;
|
|
|
import com.qmth.sop.business.cache.CommonCacheService;
|
|
|
import com.qmth.sop.business.entity.*;
|
|
|
import com.qmth.sop.business.service.*;
|
|
|
+import com.qmth.sop.business.util.CacheUtil;
|
|
|
import com.qmth.sop.common.contant.SystemConstant;
|
|
|
import com.qmth.sop.common.enums.ExceptionResultEnum;
|
|
|
import com.qmth.sop.common.enums.PrivilegeEnum;
|
|
@@ -37,6 +38,7 @@ import java.util.stream.Collectors;
|
|
|
*/
|
|
|
@Service
|
|
|
public class CommonCacheServiceImpl implements CommonCacheService {
|
|
|
+
|
|
|
private final static Logger log = LoggerFactory.getLogger(CommonCacheServiceImpl.class);
|
|
|
|
|
|
@Resource
|
|
@@ -79,7 +81,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
-// @Cacheable(value = SystemConstant.USER_ACCOUNT_CACHE, key = "#p0", unless = "#result == null")
|
|
|
+ // @Cacheable(value = SystemConstant.USER_ACCOUNT_CACHE, key = "#p0", unless = "#result == null")
|
|
|
public SysUser userCache(Long userId) {
|
|
|
return userCacheCommon(userId);
|
|
|
}
|
|
@@ -91,7 +93,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
-// @CachePut(value = SystemConstant.USER_ACCOUNT_CACHE, key = "#p0", condition = "#result != null")
|
|
|
+ // @CachePut(value = SystemConstant.USER_ACCOUNT_CACHE, key = "#p0", condition = "#result != null")
|
|
|
public SysUser updateUserCache(Long userId) {
|
|
|
cacheService.evict(SystemConstant.USER_ACCOUNT_CACHE, String.valueOf(userId));
|
|
|
return userCacheCommon(userId);
|
|
@@ -122,7 +124,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
|
|
|
* @param userId
|
|
|
*/
|
|
|
@Override
|
|
|
-// @CacheEvict(value = SystemConstant.USER_ACCOUNT_CACHE, key = "#p0")
|
|
|
+ // @CacheEvict(value = SystemConstant.USER_ACCOUNT_CACHE, key = "#p0")
|
|
|
public void removeUserCache(Long userId) {
|
|
|
cacheService.evict(SystemConstant.USER_ACCOUNT_CACHE, String.valueOf(userId));
|
|
|
}
|
|
@@ -136,7 +138,8 @@ public class CommonCacheServiceImpl implements CommonCacheService {
|
|
|
private SysConfig sysConfigCacheCommon(String key) {
|
|
|
SysConfig sysConfig = (SysConfig) cacheService.get(SystemConstant.SYS_CONFIG_CACHE, key);
|
|
|
if (Objects.isNull(sysConfig)) {
|
|
|
- sysConfig = sysConfigService.getOne(new QueryWrapper<SysConfig>().lambda().eq(SysConfig::getConfigKey, key));
|
|
|
+ sysConfig = sysConfigService.getOne(
|
|
|
+ new QueryWrapper<SysConfig>().lambda().eq(SysConfig::getConfigKey, key));
|
|
|
if (Objects.nonNull(sysConfig)) {
|
|
|
cacheService.put(SystemConstant.SYS_CONFIG_CACHE, key, sysConfig);
|
|
|
}
|
|
@@ -151,7 +154,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
-// @Cacheable(value = SystemConstant.SYS_CONFIG_CACHE, key = "#p0", unless = "#result == null")
|
|
|
+ // @Cacheable(value = SystemConstant.SYS_CONFIG_CACHE, key = "#p0", unless = "#result == null")
|
|
|
public SysConfig addSysConfigCache(String key) {
|
|
|
return sysConfigCacheCommon(key);
|
|
|
}
|
|
@@ -163,7 +166,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
-// @CachePut(value = SystemConstant.SYS_CONFIG_CACHE, key = "#p0", condition = "#result != null")
|
|
|
+ // @CachePut(value = SystemConstant.SYS_CONFIG_CACHE, key = "#p0", condition = "#result != null")
|
|
|
public SysConfig updateSysConfigCache(String key) {
|
|
|
cacheService.evict(SystemConstant.SYS_CONFIG_CACHE, key);
|
|
|
return sysConfigCacheCommon(key);
|
|
@@ -175,7 +178,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
|
|
|
* @param key
|
|
|
*/
|
|
|
@Override
|
|
|
-// @CacheEvict(value = SystemConstant.SYS_CONFIG_CACHE, key = "#p0")
|
|
|
+ // @CacheEvict(value = SystemConstant.SYS_CONFIG_CACHE, key = "#p0")
|
|
|
public void removeSysConfigCache(String key) {
|
|
|
cacheService.evict(SystemConstant.SYS_CONFIG_CACHE, key);
|
|
|
}
|
|
@@ -188,7 +191,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
|
|
|
*/
|
|
|
@Override
|
|
|
public void updateSysConfigCacheForDb(String key, SysConfig sysConfig) {
|
|
|
-// cacheManager.getCache(SystemConstant.SYS_CONFIG_CACHE).put(key, sysConfig);
|
|
|
+ // cacheManager.getCache(SystemConstant.SYS_CONFIG_CACHE).put(key, sysConfig);
|
|
|
cacheService.put(SystemConstant.SYS_CONFIG_CACHE, key, sysConfig);
|
|
|
}
|
|
|
|
|
@@ -202,7 +205,8 @@ public class CommonCacheServiceImpl implements CommonCacheService {
|
|
|
private SysConfig sysConfigCacheCommon(Long orgId, String key) {
|
|
|
SysConfig sysConfig = (SysConfig) cacheService.get(SystemConstant.SYS_CONFIG_CACHE, orgId + "_" + key);
|
|
|
if (Objects.isNull(sysConfig)) {
|
|
|
- sysConfig = sysConfigService.getOne(new QueryWrapper<SysConfig>().lambda().eq(SysConfig::getOrgId, orgId).eq(SysConfig::getConfigKey, key));
|
|
|
+ sysConfig = sysConfigService.getOne(new QueryWrapper<SysConfig>().lambda().eq(SysConfig::getOrgId, orgId)
|
|
|
+ .eq(SysConfig::getConfigKey, key));
|
|
|
if (Objects.nonNull(sysConfig)) {
|
|
|
cacheService.put(SystemConstant.SYS_CONFIG_CACHE, orgId + "_" + key, sysConfig);
|
|
|
}
|
|
@@ -218,7 +222,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
-// @Cacheable(value = SystemConstant.SYS_CONFIG_CACHE, key = "#p0 + '-' + #p1", unless = "#result == null")
|
|
|
+ // @Cacheable(value = SystemConstant.SYS_CONFIG_CACHE, key = "#p0 + '-' + #p1", unless = "#result == null")
|
|
|
public SysConfig addSysConfigCache(Long orgId, String key) {
|
|
|
return sysConfigCacheCommon(orgId, key);
|
|
|
}
|
|
@@ -231,7 +235,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
-// @CachePut(value = SystemConstant.SYS_CONFIG_CACHE, key = "#p0 + '-' + #p1", condition = "#result != null")
|
|
|
+ // @CachePut(value = SystemConstant.SYS_CONFIG_CACHE, key = "#p0 + '-' + #p1", condition = "#result != null")
|
|
|
public SysConfig updateSysConfigCache(Long orgId, String key) {
|
|
|
cacheService.evict(SystemConstant.SYS_CONFIG_CACHE, orgId + "_" + key);
|
|
|
return sysConfigCacheCommon(orgId, key);
|
|
@@ -244,7 +248,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
|
|
|
* @param key
|
|
|
*/
|
|
|
@Override
|
|
|
-// @CacheEvict(value = SystemConstant.SYS_CONFIG_CACHE, key = "#p0 + '-' + #p1")
|
|
|
+ // @CacheEvict(value = SystemConstant.SYS_CONFIG_CACHE, key = "#p0 + '-' + #p1")
|
|
|
public void removeSysConfigCache(Long orgId, String key) {
|
|
|
cacheService.evict(SystemConstant.SYS_CONFIG_CACHE, orgId + "_" + key);
|
|
|
}
|
|
@@ -257,7 +261,8 @@ public class CommonCacheServiceImpl implements CommonCacheService {
|
|
|
*/
|
|
|
@Override
|
|
|
public void setUserSession(String sessionId, Object o) {
|
|
|
- cacheService.put(SystemConstant.SESSION, sessionId, o);
|
|
|
+ CacheUtil.set(SystemConstant.SESSION + sessionId, o, 60 * 24);
|
|
|
+ // cacheService.put(SystemConstant.SESSION, sessionId, o);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -268,7 +273,8 @@ public class CommonCacheServiceImpl implements CommonCacheService {
|
|
|
*/
|
|
|
@Override
|
|
|
public Object getUserSession(String sessionId) {
|
|
|
- return cacheService.get(SystemConstant.SESSION, sessionId);
|
|
|
+ return CacheUtil.get(SystemConstant.SESSION + sessionId);
|
|
|
+ // return cacheService.get(SystemConstant.SESSION, sessionId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -278,7 +284,8 @@ public class CommonCacheServiceImpl implements CommonCacheService {
|
|
|
*/
|
|
|
@Override
|
|
|
public void deleteUserSession(String sessionId) {
|
|
|
- cacheService.evict(SystemConstant.SESSION, sessionId);
|
|
|
+ CacheUtil.delete(SystemConstant.SESSION + sessionId);
|
|
|
+ // cacheService.evict(SystemConstant.SESSION, sessionId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -302,22 +309,33 @@ public class CommonCacheServiceImpl implements CommonCacheService {
|
|
|
for (Long l : roleIds) {
|
|
|
sysRolePrivilegeList.addAll(this.rolePrivilegeCache(l));
|
|
|
}
|
|
|
- Set<Long> privilegeIds = sysRolePrivilegeList.stream().map(s -> s.getPrivilegeId()).collect(Collectors.toSet());
|
|
|
- List<SysRole> sysRoleList = sysRoleService.list(new QueryWrapper<SysRole>().lambda().in(SysRole::getId, roleIds).eq(SysRole::getEnable, true));
|
|
|
- int count = Objects.nonNull(sysRoleList) && sysRoleList.size() > 0 ? (int) sysRoleList.stream().filter(s -> Objects.equals(s.getName(), RoleTypeEnum.ADMIN.getDesc())).count() : 0;
|
|
|
+ Set<Long> privilegeIds = sysRolePrivilegeList.stream().map(s -> s.getPrivilegeId())
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ List<SysRole> sysRoleList = sysRoleService.list(
|
|
|
+ new QueryWrapper<SysRole>().lambda().in(SysRole::getId, roleIds)
|
|
|
+ .eq(SysRole::getEnable, true));
|
|
|
+ int count = Objects.nonNull(sysRoleList) && sysRoleList.size() > 0 ?
|
|
|
+ (int) sysRoleList.stream()
|
|
|
+ .filter(s -> Objects.equals(s.getName(), RoleTypeEnum.ADMIN.getDesc())).count() :
|
|
|
+ 0;
|
|
|
QueryWrapper<SysPrivilege> sysPrivilegeQueryWrapper = new QueryWrapper<>();
|
|
|
if (count > 0) {//超级系统管理员
|
|
|
- sysPrivilegeQueryWrapper.lambda().eq(SysPrivilege::getType, PrivilegeEnum.URL).eq(SysPrivilege::getProperty, PrivilegePropertyEnum.AUTH);
|
|
|
+ sysPrivilegeQueryWrapper.lambda().eq(SysPrivilege::getType, PrivilegeEnum.URL)
|
|
|
+ .eq(SysPrivilege::getProperty, PrivilegePropertyEnum.AUTH);
|
|
|
List<SysPrivilege> sysPrivilegeList = sysPrivilegeService.list(sysPrivilegeQueryWrapper);
|
|
|
- authBean = new AuthBean(sysRoleList, sysPrivilegeList.stream().map(s -> s.getUrl()).collect(Collectors.toSet()));
|
|
|
+ authBean = new AuthBean(sysRoleList,
|
|
|
+ sysPrivilegeList.stream().map(s -> s.getUrl()).collect(Collectors.toSet()));
|
|
|
} else {
|
|
|
SysOrg org = Objects.nonNull(user.getOrgId()) ? this.orgCache(user.getOrgId()) : null;
|
|
|
List<SysPrivilege> sysPrivilegeList = new ArrayList<>();
|
|
|
if (privilegeIds.size() > 0) {
|
|
|
- sysPrivilegeQueryWrapper.lambda().in(SysPrivilege::getId, privilegeIds).eq(SysPrivilege::getType, PrivilegeEnum.URL).eq(SysPrivilege::getProperty, PrivilegePropertyEnum.AUTH);
|
|
|
+ sysPrivilegeQueryWrapper.lambda().in(SysPrivilege::getId, privilegeIds)
|
|
|
+ .eq(SysPrivilege::getType, PrivilegeEnum.URL)
|
|
|
+ .eq(SysPrivilege::getProperty, PrivilegePropertyEnum.AUTH);
|
|
|
sysPrivilegeList = sysPrivilegeService.list(sysPrivilegeQueryWrapper);
|
|
|
}
|
|
|
- authBean = new AuthBean(sysRoleList, sysPrivilegeList.stream().map(s -> s.getUrl()).collect(Collectors.toSet()), org);
|
|
|
+ authBean = new AuthBean(sysRoleList,
|
|
|
+ sysPrivilegeList.stream().map(s -> s.getUrl()).collect(Collectors.toSet()), org);
|
|
|
}
|
|
|
}
|
|
|
if (Objects.nonNull(authBean)) {
|
|
@@ -754,7 +772,8 @@ public class CommonCacheServiceImpl implements CommonCacheService {
|
|
|
protected BasicSchool schoolCacheCommon(String code) {
|
|
|
BasicSchool basicSchool = (BasicSchool) cacheService.get(SystemConstant.SCHOOL_CODE_CACHE, code);
|
|
|
if (Objects.isNull(basicSchool)) {
|
|
|
- basicSchool = basicSchoolService.getOne(new QueryWrapper<BasicSchool>().lambda().eq(BasicSchool::getCode, code));
|
|
|
+ basicSchool = basicSchoolService.getOne(
|
|
|
+ new QueryWrapper<BasicSchool>().lambda().eq(BasicSchool::getCode, code));
|
|
|
if (Objects.nonNull(basicSchool)) {
|
|
|
cacheService.put(SystemConstant.SCHOOL_CODE_CACHE, code, basicSchool);
|
|
|
}
|
|
@@ -796,18 +815,20 @@ public class CommonCacheServiceImpl implements CommonCacheService {
|
|
|
sysRolePrivilegeList.addAll(this.rolePrivilegeCache(s.getRoleId()));
|
|
|
}
|
|
|
}
|
|
|
- Set<Long> privilegeIds = sysRolePrivilegeList.stream().map(s -> s.getPrivilegeId()).collect(Collectors.toSet());
|
|
|
+ Set<Long> privilegeIds = sysRolePrivilegeList.stream().map(s -> s.getPrivilegeId())
|
|
|
+ .collect(Collectors.toSet());
|
|
|
QueryWrapper<SysPrivilege> sysPrivilegeQueryWrapper = new QueryWrapper<>();
|
|
|
- sysPrivilegeQueryWrapper.lambda()
|
|
|
- .eq(SysPrivilege::getEnable, true).eq(SysPrivilege::getFrontDisplay, true)
|
|
|
+ sysPrivilegeQueryWrapper.lambda().eq(SysPrivilege::getEnable, true).eq(SysPrivilege::getFrontDisplay, true)
|
|
|
.orderByAsc(SysPrivilege::getSequence);
|
|
|
|
|
|
if (!privilegeIds.isEmpty()) {
|
|
|
sysPrivilegeQueryWrapper.lambda().in(SysPrivilege::getId, privilegeIds);
|
|
|
}
|
|
|
List<SysPrivilege> sysPrivilegeList = sysPrivilegeService.list(sysPrivilegeQueryWrapper);
|
|
|
- List<MenuDto> menuDtoList = GsonUtil.fromJson(JacksonUtil.parseJson(sysPrivilegeList), new TypeToken<List<MenuDto>>() {
|
|
|
- }.getType());
|
|
|
+ List<MenuDto> menuDtoList = GsonUtil.fromJson(JacksonUtil.parseJson(sysPrivilegeList),
|
|
|
+ new TypeToken<List<MenuDto>>() {
|
|
|
+
|
|
|
+ }.getType());
|
|
|
LinkedMultiValueMap<Long, MenuDto> linkedMultiValueMap = new LinkedMultiValueMap<>();
|
|
|
List<MenuPrivilegeDto> menuPrivilegeDtoList = new ArrayList<>();
|
|
|
for (MenuDto m : menuDtoList) {
|
|
@@ -864,9 +885,11 @@ public class CommonCacheServiceImpl implements CommonCacheService {
|
|
|
* @return
|
|
|
*/
|
|
|
protected List<TDTableProp> tablePropCacheCommon(Long widgetId) {
|
|
|
- List<TDTableProp> tablePropList = (List<TDTableProp>) cacheService.get(SystemConstant.TABLE_PROP_CACHE, String.valueOf(widgetId));
|
|
|
+ List<TDTableProp> tablePropList = (List<TDTableProp>) cacheService.get(SystemConstant.TABLE_PROP_CACHE,
|
|
|
+ String.valueOf(widgetId));
|
|
|
if (CollectionUtils.isEmpty(tablePropList)) {
|
|
|
- tablePropList = tdTablePropService.list(new QueryWrapper<TDTableProp>().lambda().eq(TDTableProp::getWidgetId, widgetId));
|
|
|
+ tablePropList = tdTablePropService.list(
|
|
|
+ new QueryWrapper<TDTableProp>().lambda().eq(TDTableProp::getWidgetId, widgetId));
|
|
|
if (!CollectionUtils.isEmpty(tablePropList)) {
|
|
|
cacheService.put(SystemConstant.TABLE_PROP_CACHE, String.valueOf(widgetId), tablePropList);
|
|
|
}
|
|
@@ -881,7 +904,8 @@ public class CommonCacheServiceImpl implements CommonCacheService {
|
|
|
* @return
|
|
|
*/
|
|
|
protected TDFormWidget formWidgetCacheCommon(Long id) {
|
|
|
- TDFormWidget tdFormWidget = (TDFormWidget) cacheService.get(SystemConstant.FORM_WIDGET_CACHE, String.valueOf(id));
|
|
|
+ TDFormWidget tdFormWidget = (TDFormWidget) cacheService.get(SystemConstant.FORM_WIDGET_CACHE,
|
|
|
+ String.valueOf(id));
|
|
|
if (Objects.isNull(tdFormWidget)) {
|
|
|
tdFormWidget = tdFormWidgetService.getById(id);
|
|
|
if (Objects.nonNull(tdFormWidget)) {
|
|
@@ -897,13 +921,18 @@ public class CommonCacheServiceImpl implements CommonCacheService {
|
|
|
* @return
|
|
|
*/
|
|
|
protected List<FormWidgetResult> formWidgetCacheCommon() {
|
|
|
- List<FormWidgetResult> formWidgetResultList = (List<FormWidgetResult>) cacheService.get(SystemConstant.FORM_WIDGET_CACHE, SystemConstant.FORM_WIDGET_CACHE);
|
|
|
+ List<FormWidgetResult> formWidgetResultList = (List<FormWidgetResult>) cacheService.get(
|
|
|
+ SystemConstant.FORM_WIDGET_CACHE, SystemConstant.FORM_WIDGET_CACHE);
|
|
|
if (CollectionUtils.isEmpty(formWidgetResultList)) {
|
|
|
- List<TDFormWidget> tdFormWidgetList = tdFormWidgetService.list(new QueryWrapper<TDFormWidget>().select(" DISTINCT code "));
|
|
|
+ List<TDFormWidget> tdFormWidgetList = tdFormWidgetService.list(
|
|
|
+ new QueryWrapper<TDFormWidget>().select(" DISTINCT code "));
|
|
|
if (!CollectionUtils.isEmpty(tdFormWidgetList)) {
|
|
|
- formWidgetResultList = GsonUtil.fromJson(JacksonUtil.parseJson(tdFormWidgetList), new TypeToken<List<FormWidgetResult>>() {
|
|
|
- }.getType());
|
|
|
- cacheService.put(SystemConstant.FORM_WIDGET_CACHE, SystemConstant.FORM_WIDGET_CACHE, formWidgetResultList);
|
|
|
+ formWidgetResultList = GsonUtil.fromJson(JacksonUtil.parseJson(tdFormWidgetList),
|
|
|
+ new TypeToken<List<FormWidgetResult>>() {
|
|
|
+
|
|
|
+ }.getType());
|
|
|
+ cacheService.put(SystemConstant.FORM_WIDGET_CACHE, SystemConstant.FORM_WIDGET_CACHE,
|
|
|
+ formWidgetResultList);
|
|
|
}
|
|
|
}
|
|
|
return formWidgetResultList;
|
|
@@ -916,9 +945,12 @@ public class CommonCacheServiceImpl implements CommonCacheService {
|
|
|
* @return
|
|
|
*/
|
|
|
protected Set<String> privilegeUrlCacheCommon(PrivilegePropertyEnum privilegePropertyEnum) {
|
|
|
- Set<String> privilegeUrlSet = (Set<String>) cacheService.get(SystemConstant.PRIVILEGE_URL_CACHE, privilegePropertyEnum.name());
|
|
|
+ Set<String> privilegeUrlSet = (Set<String>) cacheService.get(SystemConstant.PRIVILEGE_URL_CACHE,
|
|
|
+ privilegePropertyEnum.name());
|
|
|
if (CollectionUtils.isEmpty(privilegeUrlSet)) {
|
|
|
- List<SysPrivilege> sysPrivilegeList = sysPrivilegeService.list(new QueryWrapper<SysPrivilege>().lambda().eq(SysPrivilege::getType, PrivilegeEnum.URL).eq(SysPrivilege::getProperty, privilegePropertyEnum).eq(SysPrivilege::getEnable, true));
|
|
|
+ List<SysPrivilege> sysPrivilegeList = sysPrivilegeService.list(
|
|
|
+ new QueryWrapper<SysPrivilege>().lambda().eq(SysPrivilege::getType, PrivilegeEnum.URL)
|
|
|
+ .eq(SysPrivilege::getProperty, privilegePropertyEnum).eq(SysPrivilege::getEnable, true));
|
|
|
if (!CollectionUtils.isEmpty(sysPrivilegeList)) {
|
|
|
privilegeUrlSet = sysPrivilegeList.stream().map(s -> s.getUrl()).collect(Collectors.toSet());
|
|
|
cacheService.put(SystemConstant.PRIVILEGE_URL_CACHE, privilegePropertyEnum.name(), privilegeUrlSet);
|
|
@@ -951,9 +983,12 @@ public class CommonCacheServiceImpl implements CommonCacheService {
|
|
|
* @return
|
|
|
*/
|
|
|
protected List<SysUserRole> userRoleCacheCommon(Long userId) {
|
|
|
- List<SysUserRole> sysUserRoleList = (List<SysUserRole>) cacheService.get(SystemConstant.USER_ROLE_PRIVILEGE_CACHE, String.valueOf(userId));
|
|
|
+ List<SysUserRole> sysUserRoleList = (List<SysUserRole>) cacheService.get(
|
|
|
+ SystemConstant.USER_ROLE_PRIVILEGE_CACHE, String.valueOf(userId));
|
|
|
if (CollectionUtils.isEmpty(sysUserRoleList)) {
|
|
|
- sysUserRoleList = sysUserRoleService.list(new QueryWrapper<SysUserRole>().lambda().eq(SysUserRole::getUserId, userId).eq(SysUserRole::getEnable, true));
|
|
|
+ sysUserRoleList = sysUserRoleService.list(
|
|
|
+ new QueryWrapper<SysUserRole>().lambda().eq(SysUserRole::getUserId, userId)
|
|
|
+ .eq(SysUserRole::getEnable, true));
|
|
|
if (!CollectionUtils.isEmpty(sysUserRoleList)) {
|
|
|
cacheService.put(SystemConstant.USER_ROLE_PRIVILEGE_CACHE, String.valueOf(userId), sysUserRoleList);
|
|
|
}
|
|
@@ -968,9 +1003,11 @@ public class CommonCacheServiceImpl implements CommonCacheService {
|
|
|
* @return
|
|
|
*/
|
|
|
protected List<SysRolePrivilege> rolePrivilegeCacheCommon(Long roleId) {
|
|
|
- List<SysRolePrivilege> sysRolePrivilegeList = (List<SysRolePrivilege>) cacheService.get(SystemConstant.ROLE_PRIVILEGE_CACHE, String.valueOf(roleId));
|
|
|
+ List<SysRolePrivilege> sysRolePrivilegeList = (List<SysRolePrivilege>) cacheService.get(
|
|
|
+ SystemConstant.ROLE_PRIVILEGE_CACHE, String.valueOf(roleId));
|
|
|
if (CollectionUtils.isEmpty(sysRolePrivilegeList)) {
|
|
|
- sysRolePrivilegeList = sysRolePrivilegeService.list(new QueryWrapper<SysRolePrivilege>().lambda().eq(SysRolePrivilege::getRoleId, roleId));
|
|
|
+ sysRolePrivilegeList = sysRolePrivilegeService.list(
|
|
|
+ new QueryWrapper<SysRolePrivilege>().lambda().eq(SysRolePrivilege::getRoleId, roleId));
|
|
|
if (!CollectionUtils.isEmpty(sysRolePrivilegeList)) {
|
|
|
cacheService.put(SystemConstant.ROLE_PRIVILEGE_CACHE, String.valueOf(roleId), sysRolePrivilegeList);
|
|
|
}
|