Commit 9def8aee authored by fangxinjiang's avatar fangxinjiang

全局异常处理

parent 3e371650
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
package com.yifu.cloud.plus.v1.yifu.common.security.service; package com.yifu.cloud.plus.v1.yifu.common.security.service;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter; import lombok.Getter;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.User;
...@@ -40,19 +41,26 @@ public class YifuUser extends User { ...@@ -40,19 +41,26 @@ public class YifuUser extends User {
@Getter @Getter
private final Long deptId; private final Long deptId;
/**
* 用户名称
*/
@Schema(title = "用户名称")
private String nickname;
/** /**
* 手机号 * 手机号
*/ */
@Getter @Getter
private final String phone; 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, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked,
Collection<? extends GrantedAuthority> authorities) { Collection<? extends GrantedAuthority> authorities) {
super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities); super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
this.id = id; this.id = id;
this.deptId = deptId; this.deptId = deptId;
this.phone = phone; this.phone = phone;
this.nickname = nickname;
} }
} }
...@@ -68,7 +68,7 @@ public interface YifuUserDetailsService extends UserDetailsService, Ordered { ...@@ -68,7 +68,7 @@ public interface YifuUserDetailsService extends UserDetailsService, Ordered {
SysUser user = info.getSysUser(); SysUser user = info.getSysUser();
// 构造security用户 // 构造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, SecurityConstants.BCRYPT + user.getPassword(), user.getPhone(), true, true, true,
StrUtil.equals(user.getLockFlag(), CommonConstants.STATUS_NORMAL), authorities); 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