瀏覽代碼

用户认证状态

gaodm 6 年之前
父節點
當前提交
1f7581892c

+ 16 - 0
user-service/src/main/java/com/diagbot/dto/AuthStatusDTO.java

@@ -0,0 +1,16 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2018/10/8 20:21
+ */
+@Getter
+@Setter
+public class AuthStatusDTO {
+    private Integer authStatus;
+    private String authStatusName;
+}

+ 6 - 4
user-service/src/main/java/com/diagbot/facade/UserAuthenticationFacade.java

@@ -1,6 +1,7 @@
 package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.dto.AuthStatusDTO;
 import com.diagbot.dto.QueryAuthProgressDTO;
 import com.diagbot.dto.UserAuthenticationDTO;
 import com.diagbot.dto.WaitAuthenDTO;
@@ -149,21 +150,22 @@ public class UserAuthenticationFacade extends UserAuthenticationServiceImpl {
      *
      * @return
      */
-    public Map<Integer, Object> getUserAuthenticationStatus() {
+    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);
-        Map<Integer, Object> map = new HashMap<>();
+        AuthStatusDTO authStatusDTO = new AuthStatusDTO();
         if (userAuthentication == null) {
             throw new CommonException(CommonErrorCode.NOT_EXISTS, "当前用户没有认证信息");
         } else {
             Integer status = userAuthentication.getStatus();
             String statusName = AuthStatusEnum.getName(status);
-            map.put(status, statusName);
+            authStatusDTO.setAuthStatus(status);
+            authStatusDTO.setAuthStatusName(statusName);
         }
-        return map;
+        return authStatusDTO;
     }
 
     /**

+ 4 - 3
user-service/src/main/java/com/diagbot/web/UserAuthenticationController.java

@@ -2,6 +2,7 @@ package com.diagbot.web;
 
 
 import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.AuthStatusDTO;
 import com.diagbot.dto.QueryAuthProgressDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.UserAuthenticationDTO;
@@ -75,9 +76,9 @@ public class UserAuthenticationController {
     @ApiOperation(value = "获取当前用户认证状态[by:zhaops]")
     @PostMapping("/getUserAuthenticationStatus")
     @SysLogger("getUserAuthenticationStatus")
-    public RespDTO<Map<Integer, Object>> getUserAuthenticationStatus() {
-        Map<Integer, Object> map = userAuthenticationFacade.getUserAuthenticationStatus();
-        return RespDTO.onSuc(map);
+    public RespDTO<AuthStatusDTO> getUserAuthenticationStatus() {
+        AuthStatusDTO authStatusDTO = userAuthenticationFacade.getUserAuthenticationStatus();
+        return RespDTO.onSuc(authStatusDTO);
     }
 
     @ApiOperation(value = "控制台-账号认证进度[by:rengb]", notes = "控制台-账号认证进度")