客户类型
This commit is contained in:
parent
ceda53a5ae
commit
afff23e17c
@ -46,7 +46,7 @@ public class AUserDetailsService implements UserDetailsService {
|
|||||||
userDto.setEnabled(true);
|
userDto.setEnabled(true);
|
||||||
userDto.setIsAdmin(false);
|
userDto.setIsAdmin(false);
|
||||||
// 创建一个 JwtCustomerDto 对象
|
// 创建一个 JwtCustomerDto 对象
|
||||||
employeeDto = new JwtUserDto(userDto, UserTypeEnum.EMPLOYEES, new ArrayList<>());
|
employeeDto = new JwtUserDto(userDto, UserTypeEnum.EMPLOYEES, new ArrayList<>(),null);
|
||||||
// 添加缓存数据
|
// 添加缓存数据
|
||||||
userCacheManager.addEmployeeCache(username, employeeDto);
|
userCacheManager.addEmployeeCache(username, employeeDto);
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ public class BUserDetailsService implements UserDetailsService {
|
|||||||
userDto.setEnabled(true);
|
userDto.setEnabled(true);
|
||||||
userDto.setIsAdmin(false);
|
userDto.setIsAdmin(false);
|
||||||
// 创建一个 JwtCustomerDto 对象
|
// 创建一个 JwtCustomerDto 对象
|
||||||
customerDto = new JwtUserDto(userDto, UserTypeEnum.CUSTOMER, new ArrayList<>());
|
customerDto = new JwtUserDto(userDto, UserTypeEnum.CUSTOMER, new ArrayList<>(), customerDto.getCustomerType());
|
||||||
// 添加缓存数据
|
// 添加缓存数据
|
||||||
userCacheManager.addCustomerCache(username, customerDto);
|
userCacheManager.addCustomerCache(username, customerDto);
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ public class UserDetailsServiceImpl implements UserDetailsService {
|
|||||||
// 获取用户的权限
|
// 获取用户的权限
|
||||||
List<AuthorityDto> authorities = roleService.buildPermissions(user);
|
List<AuthorityDto> authorities = roleService.buildPermissions(user);
|
||||||
// 初始化JwtUserDto
|
// 初始化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);
|
userCacheManager.addUserCache(username, jwtUserDto);
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,9 @@ public class JwtUserDto implements UserDetails {
|
|||||||
@ApiModelProperty(value = "角色")
|
@ApiModelProperty(value = "角色")
|
||||||
private final List<AuthorityDto> authorities;
|
private final List<AuthorityDto> authorities;
|
||||||
|
|
||||||
|
@ApiModelProperty("客户类型")
|
||||||
|
private final String customerType;
|
||||||
|
|
||||||
public Set<String> getRoles() {
|
public Set<String> getRoles() {
|
||||||
return authorities.stream().map(AuthorityDto::getAuthority).collect(Collectors.toSet());
|
return authorities.stream().map(AuthorityDto::getAuthority).collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user