|
@@ -151,20 +151,12 @@ public class UserAuthenticationFacade extends UserAuthenticationServiceImpl {
|
|
|
* @return
|
|
|
*/
|
|
|
public AuthStatusDTO getUserAuthenticationStatus() {
|
|
|
- Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
|
|
|
- QueryWrapper<UserAuthentication> qw = new QueryWrapper<>();
|
|
|
- qw.eq("user_id", userId).
|
|
|
- eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
- UserAuthentication userAuthentication = this.getOne(qw);
|
|
|
+ UserAuthentication userAuthentication = this.getUserAuthentication();
|
|
|
AuthStatusDTO authStatusDTO = new AuthStatusDTO();
|
|
|
- if (userAuthentication == null) {
|
|
|
- throw new CommonException(CommonErrorCode.NOT_EXISTS, "当前用户没有认证信息");
|
|
|
- } else {
|
|
|
- Integer status = userAuthentication.getStatus();
|
|
|
- String statusName = AuthStatusEnum.getName(status);
|
|
|
- authStatusDTO.setAuthStatus(status);
|
|
|
- authStatusDTO.setAuthStatusName(statusName);
|
|
|
- }
|
|
|
+ Integer status = userAuthentication.getStatus();
|
|
|
+ String statusName = AuthStatusEnum.getName(status);
|
|
|
+ authStatusDTO.setAuthStatus(status);
|
|
|
+ authStatusDTO.setAuthStatusName(statusName);
|
|
|
return authStatusDTO;
|
|
|
}
|
|
|
|
|
@@ -174,11 +166,7 @@ public class UserAuthenticationFacade extends UserAuthenticationServiceImpl {
|
|
|
* @return 包含当前账号的认证状态
|
|
|
*/
|
|
|
public QueryAuthProgressDTO queryAuthProgress() {
|
|
|
- Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
|
|
|
- QueryWrapper<UserAuthentication> qw = new QueryWrapper<>();
|
|
|
- qw.eq("user_id", userId).
|
|
|
- eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
- UserAuthentication userAuthentication = this.getOne(qw);
|
|
|
+ UserAuthentication userAuthentication = this.getUserAuthentication();
|
|
|
|
|
|
QueryAuthProgressDTO queryAuthProgressDTO = new QueryAuthProgressDTO();
|
|
|
queryAuthProgressDTO.setUserStatus(userAuthentication.getStatus());
|
|
@@ -188,6 +176,23 @@ public class UserAuthenticationFacade extends UserAuthenticationServiceImpl {
|
|
|
return queryAuthProgressDTO;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取用户认证信息
|
|
|
+ *
|
|
|
+ * @return 用户认证信息
|
|
|
+ */
|
|
|
+ private UserAuthentication getUserAuthentication() {
|
|
|
+ Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
|
|
|
+ QueryWrapper<UserAuthentication> qw = new QueryWrapper<>();
|
|
|
+ qw.eq("user_id", userId).
|
|
|
+ eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
+ UserAuthentication userAuthentication = this.getOne(qw);
|
|
|
+ if (userAuthentication == null) {
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "当前用户没有认证信息");
|
|
|
+ }
|
|
|
+ return userAuthentication;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 控制台-获取待认证的账号数量
|
|
|
*
|