fix: 刷新模式反序列化字段缺失报错问题修复

This commit is contained in:
Ray Hao 2024-03-05 10:12:39 +08:00
parent 4d3aff73e7
commit 38ad79b1d7
2 changed files with 7 additions and 1 deletions

View File

@ -80,6 +80,8 @@ public class SysUserDetails implements UserDetails, CredentialsContainer {
Long userId,
String username,
String password,
Integer dataScope,
Long deptId,
boolean enabled,
boolean accountNonExpired,
boolean credentialsNonExpired,
@ -91,6 +93,8 @@ public class SysUserDetails implements UserDetails, CredentialsContainer {
this.userId = userId;
this.username = username;
this.password = password;
this.dataScope = dataScope;
this.deptId = deptId;
this.enabled = enabled;
this.accountNonExpired = accountNonExpired;
this.credentialsNonExpired = credentialsNonExpired;

View File

@ -49,11 +49,13 @@ class SysUserDeserializer extends JsonDeserializer<SysUserDetails> {
Long userId = readJsonNode(jsonNode, "userId").asLong();
String username = readJsonNode(jsonNode, "username").asText();
String password = passwordNode.asText("");
Integer dataScope = readJsonNode(jsonNode, "dataScope").asInt();
Long deptId = readJsonNode(jsonNode, "deptId").asLong();
boolean enabled = readJsonNode(jsonNode, "enabled").asBoolean();
boolean accountNonExpired = readJsonNode(jsonNode, "accountNonExpired").asBoolean();
boolean credentialsNonExpired = readJsonNode(jsonNode, "credentialsNonExpired").asBoolean();
boolean accountNonLocked = readJsonNode(jsonNode, "accountNonLocked").asBoolean();
SysUserDetails result = new SysUserDetails(userId, username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked,
SysUserDetails result = new SysUserDetails(userId, username, password, dataScope, deptId, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked,
authorities);
if (passwordNode.asText(null) == null) {
result.eraseCredentials();