权限优化

This commit is contained in:
暮光:城中城
2019-06-01 09:36:55 +08:00
parent 7f4f3fd432
commit 48f81dc547
22 changed files with 228 additions and 38 deletions

View File

@@ -57,7 +57,11 @@ public class LoginController {
if (userAuthList != null && userAuthList.size() > 0) {
List<Long> authIdList = userAuthList.stream().map(UserAuth::getAuthId).collect(Collectors.toList());
Collection<AuthInfo> authInfoList = authInfoService.listByIds(authIdList);
userAuthSet = authInfoList.stream().map(AuthInfo::getAuthName).collect(Collectors.toSet());
Map<Long, String> authNameMap = authInfoList.stream().collect(Collectors.toMap(AuthInfo::getId, AuthInfo::getAuthName));
userAuthSet = userAuthList.stream().map(val -> {
String authName = Optional.ofNullable(authNameMap.get(val.getAuthId())).orElse("");
return authName + val.getAuthCustomSuffix();
}).collect(Collectors.toSet());
}
String accessToken = RandomUtil.simpleUUID();
DocUserDetails userDetails = new DocUserDetails(userInfo.getId(), userInfo.getUserName(), userInfo.getPassword(), true, userAuthSet);