zhoutg 6 роки тому
батько
коміт
3ea0232e2d

+ 53 - 9
user-service/src/main/java/com/diagbot/entity/User.java

@@ -62,6 +62,23 @@ public class User implements Serializable {
     private String username;
 
 
+    /**
+     * 组织机构
+     */
+    private String organization;
+
+    /**
+     * 联系人
+     */
+    private String linkman;
+
+    /**
+     * 邮箱
+     */
+    private String email;
+
+
+
     public Long getId() {
         return id;
     }
@@ -126,17 +143,44 @@ public class User implements Serializable {
         this.username = username;
     }
 
+    public String getOrganization() {
+        return organization;
+    }
+
+    public void setOrganization(String organization) {
+        this.organization = organization;
+    }
+
+    public String getLinkman() {
+        return linkman;
+    }
+
+    public void setLinkman(String linkman) {
+        this.linkman = linkman;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
     @Override
     public String toString() {
         return "User{" +
-        "id=" + id +
-        ", isDeleted=" + isDeleted +
-        ", gmtCreate=" + gmtCreate +
-        ", gmtModified=" + gmtModified +
-        ", creator=" + creator +
-        ", modifier=" + modifier +
-        ", password=" + password +
-        ", username=" + username +
-        "}";
+                "id=" + id +
+                ", isDeleted='" + isDeleted + '\'' +
+                ", gmtCreate=" + gmtCreate +
+                ", gmtModified=" + gmtModified +
+                ", creator='" + creator + '\'' +
+                ", modifier='" + modifier + '\'' +
+                ", password='" + password + '\'' +
+                ", username='" + username + '\'' +
+                ", organization='" + organization + '\'' +
+                ", linkman='" + linkman + '\'' +
+                ", email='" + email + '\'' +
+                '}';
     }
 }

+ 15 - 18
user-service/src/main/java/com/diagbot/facade/VerFacade.java

@@ -3,6 +3,7 @@ package com.diagbot.facade;
 import com.diagbot.dto.ImgVerCreatDTO;
 import com.diagbot.entity.ImgVerInfo;
 import com.diagbot.entity.SwsVerInfo;
+import com.diagbot.entity.User;
 import com.diagbot.enums.VisibleIdTypeEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
@@ -86,30 +87,29 @@ public class VerFacade {
         }
         if (!RegexValidateUtil.checkMobileNumber(smsVerCreatVO.getMobile())){
             throw new CommonException(CommonErrorCode.PARAM_IS_ERROR,
-                    "用户电话格式错误!");
+                    "请输入正确的手机号!");
         }
         //验证图片验证码
         ImgVerInfo imgVerInfo = new ImgVerInfo();
         BeanUtil.copyProperties(smsVerCreatVO, imgVerInfo);
         Boolean imgVerRes = imgVerService.verifyImgVerification(imgVerInfo);
         if (imgVerRes){
-            //todo 验证该用户是否被注册
-            Boolean isReg = false;
-            if (isReg){
+            User bean = userFacade.getUserInfo(smsVerCreatVO.getMobile());
+            if (bean != null){
                 throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "该号码已经被注册!");
             }
 
-            //验证是否超过分钟
+            //验证是否超过分钟
             SwsVerInfo swsVerInfoCheck = smsVerService.getSmsVerification(smsVerCreatVO.getMobile());
             if (null != swsVerInfoCheck){
-                if (DateUtil.after(DateUtil.addMinutes(swsVerInfoCheck.getCreateTime(), 2),
+                if (DateUtil.after(DateUtil.addMinutes(swsVerInfoCheck.getCreateTime(), 3),
                         DateUtil.now())){
                     throw new CommonException(ServiceErrorCode.SMS_SEND_ERROR,
-                            "同一用户两分钟之内不能重复发送验证短信,请两分钟之后再次发送!");
+                            "同一用户三分钟之内不能重复发送验证短信,请三分钟之后再次发送!");
                 }
             }
         } else {
-            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "图片验证码错误!");
+            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "输入图形验证码有误!");
         }
 
         //发送短信
@@ -124,7 +124,7 @@ public class VerFacade {
     }
 
     /**
-     * 验证短信码并且注册为新的用户
+     * 验证短信码
      * @param smsVerVerVO 短信验证码验证输入信息
      * @return 用户信息是否注册到数据库
      */
@@ -152,20 +152,19 @@ public class VerFacade {
         }
         if (!RegexValidateUtil.checkMobileNumber(smsVerVerVO.getMobile())){
             throw new CommonException(CommonErrorCode.PARAM_IS_ERROR,
-                    "用户电话格式错误!");
+                    "请输入正确的手机号!");
         }
         //验证图片验证码
         ImgVerInfo imgVerInfo = new ImgVerInfo();
         BeanUtil.copyProperties(smsVerVerVO, imgVerInfo);
         Boolean imgVerRes = imgVerService.verifyImgVerification(imgVerInfo);
         if (imgVerRes){
-            //todo 验证该用户是否被注册
-            Boolean isReg = false;
-            if (isReg){
+            User bean = userFacade.getUserInfo(smsVerVerVO.getMobile());
+            if (bean != null){
                 throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "该号码已经被注册!");
             }
         } else {
-            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "图片验证码错误!");
+            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "输入图形验证码有误!");
         }
         //验证用户短信信息
         SwsVerInfo swsVerInfo = new SwsVerInfo();
@@ -173,11 +172,9 @@ public class VerFacade {
         swsVerInfo.setCode(smsVerVerVO.getSmsCode());
         Boolean smsVer = smsVerService.verifySmsVerification(swsVerInfo);
         if (!smsVer){
-            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "短信验证未通过!");
+            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "短信验证码输入有误,请重新输入!");
         }
-        //todo 将用户信息加入数据库
-        Boolean registSuccess = true;
-        return registSuccess;
+        return true;
     }