Commit 9def8aee authored by fangxinjiang's avatar fangxinjiang

全局异常处理

parent 3e371650
......@@ -16,6 +16,7 @@
package com.yifu.cloud.plus.v1.yifu.common.security.service;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;
......@@ -40,19 +41,26 @@ public class YifuUser extends User {
@Getter
private final Long deptId;
/**
* 用户名称
*/
@Schema(title = "用户名称")
private String nickname;
/**
* 手机号
*/
@Getter
private final String phone;
public YifuUser(String id, Long deptId, String username, String password, String phone, boolean enabled,
public YifuUser(String id, Long deptId, String username, String nickname, String password, String phone, boolean enabled,
boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked,
Collection<? extends GrantedAuthority> authorities) {
super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
this.id = id;
this.deptId = deptId;
this.phone = phone;
this.nickname = nickname;
}
}
......@@ -68,7 +68,7 @@ public interface YifuUserDetailsService extends UserDetailsService, Ordered {
SysUser user = info.getSysUser();
// 构造security用户
return new YifuUser(user.getUserId(), user.getDeptId(), user.getUsername(),
return new YifuUser(user.getUserId(), user.getDeptId(), user.getUsername(),user.getNickname(),
SecurityConstants.BCRYPT + user.getPassword(), user.getPhone(), true, true, true,
StrUtil.equals(user.getLockFlag(), CommonConstants.STATUS_NORMAL), authorities);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment