Compare commits

..

2 Commits

Author SHA1 Message Date
78516474a1 Merge remote-tracking branch 'origin/master' 2025-07-25 17:40:52 +08:00
afff23e17c 客户类型 2025-07-25 17:40:44 +08:00
4 changed files with 6 additions and 3 deletions

View File

@ -46,7 +46,7 @@ public class AUserDetailsService implements UserDetailsService {
userDto.setEnabled(true);
userDto.setIsAdmin(false);
// 创建一个 JwtCustomerDto 对象
employeeDto = new JwtUserDto(userDto, UserTypeEnum.EMPLOYEES, new ArrayList<>());
employeeDto = new JwtUserDto(userDto, UserTypeEnum.EMPLOYEES, new ArrayList<>(),null);
// 添加缓存数据
userCacheManager.addEmployeeCache(username, employeeDto);
}

View File

@ -45,7 +45,7 @@ public class BUserDetailsService implements UserDetailsService {
userDto.setEnabled(true);
userDto.setIsAdmin(false);
// 创建一个 JwtCustomerDto 对象
customerDto = new JwtUserDto(userDto, UserTypeEnum.CUSTOMER, new ArrayList<>());
customerDto = new JwtUserDto(userDto, UserTypeEnum.CUSTOMER, new ArrayList<>(), customerDto.getCustomerType());
// 添加缓存数据
userCacheManager.addCustomerCache(username, customerDto);
}

View File

@ -60,7 +60,7 @@ public class UserDetailsServiceImpl implements UserDetailsService {
// 获取用户的权限
List<AuthorityDto> authorities = roleService.buildPermissions(user);
// 初始化JwtUserDto
jwtUserDto = new JwtUserDto(BeanUtil.copyProperties(user, LoginUserDto.class), UserTypeEnum.getByValue(user.getUserType()), authorities);
jwtUserDto = new JwtUserDto(BeanUtil.copyProperties(user, LoginUserDto.class), UserTypeEnum.getByValue(user.getUserType()), authorities,null);
// 添加缓存数据
userCacheManager.addUserCache(username, jwtUserDto);
}

View File

@ -50,6 +50,9 @@ public class JwtUserDto implements UserDetails {
@ApiModelProperty(value = "角色")
private final List<AuthorityDto> authorities;
@ApiModelProperty("客户类型")
private final String customerType;
public Set<String> getRoles() {
return authorities.stream().map(AuthorityDto::getAuthority).collect(Collectors.toSet());
}