diff --git a/src/main/java/com/chint/domain/aggregates/user/User.java b/src/main/java/com/chint/domain/aggregates/user/User.java index d3cc19c6..4c80897f 100644 --- a/src/main/java/com/chint/domain/aggregates/user/User.java +++ b/src/main/java/com/chint/domain/aggregates/user/User.java @@ -46,13 +46,14 @@ public class User { this.employeeNo = employeeNo; } - public User(Long userId, Long employeeNo, Integer employeeLevel, String name, String email, String phoneNumber, UserLoginParam userLoginParam) { + public User(Long userId, Long employeeNo, Integer employeeLevel, String name, String email, String phoneNumber, UserLoginParam userLoginParam, String standardLevel) { this.userId = userId; this.employeeNo = employeeNo; this.employeeLevel = employeeLevel; this.name = name; this.email = email; this.phoneNumber = phoneNumber; + this.standardLevel = standardLevel; this.userLoginParam = userLoginParam; } @@ -78,12 +79,14 @@ public class User { Claim name = claims.get(USER_NAME); Claim employeeLevel = claims.get(USER_EMPLOYEE_LEVEL); Claim loginParam = claims.get(USER_LOGIN_PARAM); + Claim standardLevel = claims.get(USER_STANDARD_LEVEL); return new User(userId.asLong(), employeeNo.asLong(), employeeLevel.asInt(), name.asString(), email.asString(), phoneNumber.asString(), - UserLoginParam.of(loginParam.asString())); + UserLoginParam.of(loginParam.asString()), + standardLevel.asString()); } } \ No newline at end of file diff --git a/src/main/java/com/chint/domain/service/auth/AuthenticateServiceImpl.java b/src/main/java/com/chint/domain/service/auth/AuthenticateServiceImpl.java index 9d74bb19..c45b08e8 100644 --- a/src/main/java/com/chint/domain/service/auth/AuthenticateServiceImpl.java +++ b/src/main/java/com/chint/domain/service/auth/AuthenticateServiceImpl.java @@ -58,6 +58,7 @@ public class AuthenticateServiceImpl implements AuthenticateService { claims.put(USER_RANK_CODE, user.getStandardLevel()); claims.put(USER_COMPANY_CODE, user.getCompanyCode()); claims.put(USER_LOGIN_PARAM, json.gson().toJson(userLoginParam)); + claims.put(USER_STANDARD_LEVEL, user.getStandardLevel()); String jwt = JWTUtil.createJWT(claims); //这里已经是完成的用户信息里, 因此将用户信息保存到threadLocal当中 diff --git a/src/main/java/com/chint/infrastructure/constant/Constant.java b/src/main/java/com/chint/infrastructure/constant/Constant.java index 36406dc4..ce920a17 100644 --- a/src/main/java/com/chint/infrastructure/constant/Constant.java +++ b/src/main/java/com/chint/infrastructure/constant/Constant.java @@ -174,6 +174,7 @@ public class Constant { public static final String USER_RANK_CODE = "rankCode"; public static final String USER_COMPANY_CODE = "companyCode"; public static final String USER_LOGIN_PARAM = "userLoginParam"; + public static final String USER_STANDARD_LEVEL = "standardLevel"; // JWT public static final String SECRET = "Superdandan"; // 替换为你自己的密钥 diff --git a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java index d294454e..c612bc79 100644 --- a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java +++ b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java @@ -58,8 +58,8 @@ public class UserHttpRequestImpl implements UserHttpRequest { } Ranks ranks = rankDomainService.queryRanks(rankName, user.getCompanyCode()); if (ranks != null) { -// user.setStandardLevel(ranks.getStandardLevel()); - user.setStandardLevel("测试职级"); + user.setStandardLevel(ranks.getStandardLevel()); +// user.setStandardLevel("测试职级"); } return user; }