Quellcode durchsuchen

重构用户校验

魏熙美 vor 6 Jahren
Ursprung
Commit
4ab4605fa8

+ 10
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/ITaUserService.java Datei anzeigen

@@ -1,7 +1,9 @@
1 1
 package com.community.huiju.service;
2 2
 
3
+import com.community.commom.constant.Constant;
3 4
 import com.community.commom.mode.ResponseBean;
4 5
 import com.community.commom.session.UserElement;
6
+import com.community.huiju.exception.WisdomException;
5 7
 import com.community.huiju.model.TaUser;
6 8
 import org.springframework.web.multipart.MultipartFile;
7 9
 
@@ -13,8 +15,15 @@ import java.util.List;
13 15
  */
14 16
 public interface ITaUserService {
15 17
 
16
-    default void checkUser(TaUser user) {
17 18
 
19
+    /**
20
+     * 校验 用户认证状态
21
+     * @param user
22
+     */
23
+    default void checkVerifyStatusUser(TaUser user) {
24
+        if (Constant.INVALID_VERIFY_STATUS.equals(user.getVerifyStatus())) {
25
+            throw new WisdomException("关联账户违反社区规定,无法使用");
26
+        }
18 27
     }
19 28
 
20 29
     /**

+ 11
- 2
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserServiceImpl.java Datei anzeigen

@@ -100,15 +100,24 @@ public class TaUserServiceImpl implements ITaUserService {
100 100
     public ResponseBean login(String loginName,String code) {
101 101
         ResponseBean response = new ResponseBean();
102 102
 
103
-        // 校验
103
+        // 校验手机号和验证码
104 104
         iCode.checkPhoneAndCode(loginName, code);
105 105
 
106 106
         Map<String,Object> map = Maps.newHashMap();
107 107
         map.put("loginName",loginName);
108 108
         TaUser currentUser = taUserMapper.selectByLoginName(map);
109
+        if (null == currentUser) {
110
+            response.addError("未注册,请先注册");
111
+            return response;
112
+        }
109 113
 
110
-        TaUserVO taUserVO = new TaUserVO();
114
+        // 校验用户
115
+        checkVerifyStatusUser(currentUser);
111 116
 
117
+        // 查询房产
118
+        
119
+
120
+        TaUserVO taUserVO = new TaUserVO();
112 121
         BeanUtils.copyProperties(currentUser, taUserVO);
113 122
         response.addSuccess(taUserVO);
114 123
         return response;

+ 7
- 0
CODE/smart-community/community-common/src/main/java/com/community/commom/constant/Constant.java Datei anzeigen

@@ -17,9 +17,11 @@ public class Constant {
17 17
     public static final String WEB_USER_SESSION = "webUser";
18 18
 
19 19
     /** WEB运营端session **/
20
+    @Deprecated
20 21
     public static final String WEB_OPERATE_USER_SESSION = "webOperateUser";
21 22
 
22 23
     /** WEB物业端session **/
24
+    @Deprecated
23 25
     public static final String WEB_PROPERTY_USER_SESSION = "webPropertyUser";
24 26
 
25 27
     /** 不需要权限的URL身份 **/
@@ -197,4 +199,9 @@ public class Constant {
197 199
      * 已认证
198 200
      */
199 201
     public static final String VERIFY_STATUS = "1";
202
+
203
+    /**
204
+     * 认证作废
205
+     */
206
+    public static final String INVALID_VERIFY_STATUS = "3";
200 207
 }