优化代码
This commit is contained in:
+1
-1
@@ -167,7 +167,7 @@ public class SysMenuController {
|
||||
if (CollectionUtil.isEmpty(roles)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<SysMenu> menus = menuService.findByRoleCodes(roles.parallelStream().map(SysRole::getCode).collect(Collectors.toSet()), CommonConstant.MENU);
|
||||
List<SysMenu> menus = menuService.findByRoleCodes(roles.stream().map(SysRole::getCode).collect(Collectors.toSet()), CommonConstant.MENU);
|
||||
return treeBuilder(menus);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -80,10 +80,10 @@ public class SysUserServiceImpl extends SuperServiceImpl<SysUserMapper, SysUser>
|
||||
loginAppUser.setRoles(sysRoles);
|
||||
|
||||
if (!CollectionUtils.isEmpty(sysRoles)) {
|
||||
Set<Long> roleIds = sysRoles.parallelStream().map(SuperEntity::getId).collect(Collectors.toSet());
|
||||
Set<Long> roleIds = sysRoles.stream().map(SuperEntity::getId).collect(Collectors.toSet());
|
||||
List<SysMenu> menus = roleMenuMapper.findMenusByRoleIds(roleIds, CommonConstant.PERMISSION);
|
||||
if (!CollectionUtils.isEmpty(menus)) {
|
||||
Set<String> permissions = menus.parallelStream().map(p -> p.getPath())
|
||||
Set<String> permissions = menus.stream().map(p -> p.getPath())
|
||||
.collect(Collectors.toSet());
|
||||
// 设置权限集合
|
||||
loginAppUser.setPermissions(permissions);
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ public class LoginAppUser extends SysUser implements SocialUserDetails {
|
||||
public Collection<? extends GrantedAuthority> getAuthorities() {
|
||||
Collection<GrantedAuthority> collection = new HashSet<>();
|
||||
if (!CollectionUtils.isEmpty(super.getRoles())) {
|
||||
super.getRoles().parallelStream().forEach(role -> collection.add(new SimpleGrantedAuthority(role.getCode())));
|
||||
super.getRoles().forEach(role -> collection.add(new SimpleGrantedAuthority(role.getCode())));
|
||||
}
|
||||
return collection;
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ public class RedisClientDetailsService extends JdbcClientDetailsService {
|
||||
return;
|
||||
}
|
||||
|
||||
list.parallelStream().forEach(client -> redisTemplate.opsForValue().set(clientRedisKey(client.getClientId()), client));
|
||||
list.forEach(client -> redisTemplate.opsForValue().set(clientRedisKey(client.getClientId()), client));
|
||||
}
|
||||
|
||||
private String clientRedisKey(String clientId) {
|
||||
|
||||
Reference in New Issue
Block a user