【fix】用户无角色问题

This commit is contained in:
nixj 2024-07-01 14:06:44 +08:00
parent 8ff534ca1e
commit c59c3be345
1 changed files with 8 additions and 6 deletions

View File

@ -7,7 +7,9 @@ import com.chint.domain.aggregates.system.AccountCompany;
import com.chint.domain.aggregates.system.SystemCode; import com.chint.domain.aggregates.system.SystemCode;
import com.chint.domain.aggregates.system.SystemOrganization; import com.chint.domain.aggregates.system.SystemOrganization;
import com.chint.domain.aggregates.system.SystemOrganizationExtension; import com.chint.domain.aggregates.system.SystemOrganizationExtension;
import com.chint.domain.aggregates.user.Role;
import com.chint.domain.aggregates.user.RoleOrganization; import com.chint.domain.aggregates.user.RoleOrganization;
import com.chint.domain.aggregates.user.RoleUser;
import com.chint.domain.aggregates.user.User; import com.chint.domain.aggregates.user.User;
import com.chint.domain.exceptions.NotFoundException; import com.chint.domain.exceptions.NotFoundException;
import com.chint.domain.repository.*; import com.chint.domain.repository.*;
@ -163,12 +165,12 @@ public class SystemDomainService {
@ListenTo(command = "UserRoleCommand", order = 0) @ListenTo(command = "UserRoleCommand", order = 0)
public void loadUserRole(UserRoleCommand command) { public void loadUserRole(UserRoleCommand command) {
User user = command.getUser(); User user = command.getUser();
// List<RoleUser> byUserId = roleUserRepository.findByUserId(user.getUserId()); List<RoleUser> byUserId = roleUserRepository.findByUserId(user.getUserId());
// List<Role> roleList = byUserId.stream().flatMap(it -> roleRepository List<Role> roleList = byUserId.stream().flatMap(it -> roleRepository
// .findById(it.getRoleId()) .findById(it.getRoleId())
// .stream()) .stream())
// .toList(); .toList();
// user.setRoleList(roleList); user.setRoleList(roleList);
roleRepository.loadUserRole(user); roleRepository.loadUserRole(user);
} }