Your Name лет назад: 2
Родитель
Сommit
be7761b892

+ 25 - 0
java110-utils/src/main/java/com/java110/utils/util/ValidatorUtil.java

@@ -8,6 +8,7 @@ package com.java110.utils.util;
  * @Version 1.0
  * @Version 1.0
  * add by wuxw 2020/2/10
  * add by wuxw 2020/2/10
  **/
  **/
+
 import java.util.regex.Pattern;
 import java.util.regex.Pattern;
 
 
 /**
 /**
@@ -64,6 +65,9 @@ public class ValidatorUtil {
      * @return 校验通过返回true,否则返回false
      * @return 校验通过返回true,否则返回false
      */
      */
     public static boolean isUsername(String username) {
     public static boolean isUsername(String username) {
+        if (StringUtil.isEmpty(username)) {
+            return false;
+        }
         return Pattern.matches(REGEX_USERNAME, username);
         return Pattern.matches(REGEX_USERNAME, username);
     }
     }
 
 
@@ -74,6 +78,9 @@ public class ValidatorUtil {
      * @return 校验通过返回true,否则返回false
      * @return 校验通过返回true,否则返回false
      */
      */
     public static boolean isPassword(String password) {
     public static boolean isPassword(String password) {
+        if (StringUtil.isEmpty(password)) {
+            return false;
+        }
         return Pattern.matches(REGEX_PASSWORD, password);
         return Pattern.matches(REGEX_PASSWORD, password);
     }
     }
 
 
@@ -84,6 +91,9 @@ public class ValidatorUtil {
      * @return 校验通过返回true,否则返回false
      * @return 校验通过返回true,否则返回false
      */
      */
     public static boolean isMobile(String mobile) {
     public static boolean isMobile(String mobile) {
+        if (StringUtil.isEmpty(mobile)) {
+            return false;
+        }
         return Pattern.matches(REGEX_MOBILE, mobile);
         return Pattern.matches(REGEX_MOBILE, mobile);
     }
     }
 
 
@@ -94,6 +104,9 @@ public class ValidatorUtil {
      * @return 校验通过返回true,否则返回false
      * @return 校验通过返回true,否则返回false
      */
      */
     public static boolean isEmail(String email) {
     public static boolean isEmail(String email) {
+        if (StringUtil.isEmpty(email)) {
+            return false;
+        }
         return Pattern.matches(REGEX_EMAIL, email);
         return Pattern.matches(REGEX_EMAIL, email);
     }
     }
 
 
@@ -104,6 +117,9 @@ public class ValidatorUtil {
      * @return 校验通过返回true,否则返回false
      * @return 校验通过返回true,否则返回false
      */
      */
     public static boolean isChinese(String chinese) {
     public static boolean isChinese(String chinese) {
+        if (StringUtil.isEmpty(chinese)) {
+            return false;
+        }
         return Pattern.matches(REGEX_CHINESE, chinese);
         return Pattern.matches(REGEX_CHINESE, chinese);
     }
     }
 
 
@@ -114,6 +130,9 @@ public class ValidatorUtil {
      * @return 校验通过返回true,否则返回false
      * @return 校验通过返回true,否则返回false
      */
      */
     public static boolean isIDCard(String idCard) {
     public static boolean isIDCard(String idCard) {
+        if (StringUtil.isEmpty(idCard)) {
+            return false;
+        }
         return Pattern.matches(REGEX_ID_CARD, idCard);
         return Pattern.matches(REGEX_ID_CARD, idCard);
     }
     }
 
 
@@ -124,6 +143,9 @@ public class ValidatorUtil {
      * @return 校验通过返回true,否则返回false
      * @return 校验通过返回true,否则返回false
      */
      */
     public static boolean isUrl(String url) {
     public static boolean isUrl(String url) {
+        if (StringUtil.isEmpty(url)) {
+            return false;
+        }
         return Pattern.matches(REGEX_URL, url);
         return Pattern.matches(REGEX_URL, url);
     }
     }
 
 
@@ -134,6 +156,9 @@ public class ValidatorUtil {
      * @return
      * @return
      */
      */
     public static boolean isIPAddr(String ipAddr) {
     public static boolean isIPAddr(String ipAddr) {
+        if (StringUtil.isEmpty(ipAddr)) {
+            return false;
+        }
         return Pattern.matches(REGEX_IP_ADDR, ipAddr);
         return Pattern.matches(REGEX_IP_ADDR, ipAddr);
     }
     }
 
 

+ 4 - 4
service-user/src/main/java/com/java110/user/cmd/user/OwnerUserLoginCmd.java

@@ -79,7 +79,7 @@ public class OwnerUserLoginCmd extends Cmd {
         //todo 验证码登录
         //todo 验证码登录
         if (reqJson.containsKey("loginByPhone") && reqJson.getBoolean("loginByPhone")) {
         if (reqJson.containsKey("loginByPhone") && reqJson.getBoolean("loginByPhone")) {
             SmsDto smsDto = new SmsDto();
             SmsDto smsDto = new SmsDto();
-            smsDto.setTel(reqJson.getString("userName"));
+            smsDto.setTel(reqJson.getString("username"));
             smsDto.setCode(reqJson.getString("password"));
             smsDto.setCode(reqJson.getString("password"));
             smsDto = smsInnerServiceSMOImpl.validateCode(smsDto);
             smsDto = smsInnerServiceSMOImpl.validateCode(smsDto);
             if (!smsDto.isSuccess()) {
             if (!smsDto.isSuccess()) {
@@ -94,10 +94,10 @@ public class OwnerUserLoginCmd extends Cmd {
 
 
         UserDto userDto = new UserDto();
         UserDto userDto = new UserDto();
         userDto.setLevelCd(UserDto.LEVEL_CD_USER);
         userDto.setLevelCd(UserDto.LEVEL_CD_USER);
-        if (ValidatorUtil.isMobile(reqJson.getString("userName"))) {//用户临时秘钥登录
-            userDto.setTel(reqJson.getString("userName"));
+        if (ValidatorUtil.isMobile(reqJson.getString("username"))) {//用户临时秘钥登录
+            userDto.setTel(reqJson.getString("username"));
         } else {
         } else {
-            userDto.setUserName(reqJson.getString("userName"));
+            userDto.setUserName(reqJson.getString("username"));
         }
         }
 
 
         // todo 不是验证码登录
         // todo 不是验证码登录