|
|
@ -179,19 +179,22 @@ public class AccessUserServiceImpl implements AccessUserService {
|
|
|
|
accessUserWrapper.eq(AccessUserRole::getLoginName, loginName);
|
|
|
|
accessUserWrapper.eq(AccessUserRole::getLoginName, loginName);
|
|
|
|
List<AccessUserRole> accessUserRoles = accessUserRoleMapper.selectList(accessUserWrapper);
|
|
|
|
List<AccessUserRole> accessUserRoles = accessUserRoleMapper.selectList(accessUserWrapper);
|
|
|
|
Set<String> roleCodeSet = accessUserRoles.stream().map(AccessUserRole::getRoleCode).collect(Collectors.toSet());
|
|
|
|
Set<String> roleCodeSet = accessUserRoles.stream().map(AccessUserRole::getRoleCode).collect(Collectors.toSet());
|
|
|
|
|
|
|
|
if (roleCodeSet.size() < 1) {
|
|
|
|
LambdaQueryWrapper<AccessRoleAuthority> accessRoleAuthorityWrapper = Wrappers.lambdaQuery();
|
|
|
|
gaeaUser.setAuthorities(new ArrayList<>());
|
|
|
|
accessRoleAuthorityWrapper.select(AccessRoleAuthority::getTarget, AccessRoleAuthority::getAction);
|
|
|
|
}else {
|
|
|
|
accessRoleAuthorityWrapper.in(AccessRoleAuthority::getRoleCode, roleCodeSet);
|
|
|
|
LambdaQueryWrapper<AccessRoleAuthority> accessRoleAuthorityWrapper = Wrappers.lambdaQuery();
|
|
|
|
List<AccessRoleAuthority> accessRoleAuthorities = accessRoleAuthorityMapper.selectList(accessRoleAuthorityWrapper);
|
|
|
|
accessRoleAuthorityWrapper.select(AccessRoleAuthority::getTarget, AccessRoleAuthority::getAction);
|
|
|
|
List<String> authorities = accessRoleAuthorities.stream()
|
|
|
|
accessRoleAuthorityWrapper.in(AccessRoleAuthority::getRoleCode, roleCodeSet);
|
|
|
|
.map(accessRoleAuthority -> accessRoleAuthority.getTarget().concat(":").concat(accessRoleAuthority.getAction())).distinct().collect(Collectors.toList());
|
|
|
|
List<AccessRoleAuthority> accessRoleAuthorities = accessRoleAuthorityMapper.selectList(accessRoleAuthorityWrapper);
|
|
|
|
|
|
|
|
List<String> authorities = accessRoleAuthorities.stream()
|
|
|
|
|
|
|
|
.map(accessRoleAuthority -> accessRoleAuthority.getTarget().concat(":").concat(accessRoleAuthority.getAction())).distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
|
gaeaUser.setAuthorities(authorities);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
gaeaUser.setLoginName(loginName);
|
|
|
|
gaeaUser.setLoginName(loginName);
|
|
|
|
gaeaUser.setRealName(accessUser.getRealName());
|
|
|
|
gaeaUser.setRealName(accessUser.getRealName());
|
|
|
|
gaeaUser.setToken(token);
|
|
|
|
gaeaUser.setToken(token);
|
|
|
|
gaeaUser.setAuthorities(authorities);
|
|
|
|
|
|
|
|
String gaeaUserStr = JSONObject.toJSONString(gaeaUser);
|
|
|
|
String gaeaUserStr = JSONObject.toJSONString(gaeaUser);
|
|
|
|
cacheHelper.stringSetExpire(userKey, gaeaUserStr, 3600);
|
|
|
|
cacheHelper.stringSetExpire(userKey, gaeaUserStr, 3600);
|
|
|
|
|
|
|
|
|
|
|
|