Your Name
2023-09-24 be7761b892f4676d0398b0c8f1fce5132bb796c2
优化代码
2个文件已修改
33 ■■■■ 已修改文件
java110-utils/src/main/java/com/java110/utils/util/ValidatorUtil.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-user/src/main/java/com/java110/user/cmd/user/OwnerUserLoginCmd.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-utils/src/main/java/com/java110/utils/util/ValidatorUtil.java
@@ -8,6 +8,7 @@
 * @Version 1.0
 * add by wuxw 2020/2/10
 **/
import java.util.regex.Pattern;
/**
@@ -64,6 +65,9 @@
     * @return 校验通过返回true,否则返回false
     */
    public static boolean isUsername(String username) {
        if (StringUtil.isEmpty(username)) {
            return false;
        }
        return Pattern.matches(REGEX_USERNAME, username);
    }
@@ -74,6 +78,9 @@
     * @return 校验通过返回true,否则返回false
     */
    public static boolean isPassword(String password) {
        if (StringUtil.isEmpty(password)) {
            return false;
        }
        return Pattern.matches(REGEX_PASSWORD, password);
    }
@@ -84,6 +91,9 @@
     * @return 校验通过返回true,否则返回false
     */
    public static boolean isMobile(String mobile) {
        if (StringUtil.isEmpty(mobile)) {
            return false;
        }
        return Pattern.matches(REGEX_MOBILE, mobile);
    }
@@ -94,6 +104,9 @@
     * @return 校验通过返回true,否则返回false
     */
    public static boolean isEmail(String email) {
        if (StringUtil.isEmpty(email)) {
            return false;
        }
        return Pattern.matches(REGEX_EMAIL, email);
    }
@@ -104,6 +117,9 @@
     * @return 校验通过返回true,否则返回false
     */
    public static boolean isChinese(String chinese) {
        if (StringUtil.isEmpty(chinese)) {
            return false;
        }
        return Pattern.matches(REGEX_CHINESE, chinese);
    }
@@ -114,6 +130,9 @@
     * @return 校验通过返回true,否则返回false
     */
    public static boolean isIDCard(String idCard) {
        if (StringUtil.isEmpty(idCard)) {
            return false;
        }
        return Pattern.matches(REGEX_ID_CARD, idCard);
    }
@@ -124,6 +143,9 @@
     * @return 校验通过返回true,否则返回false
     */
    public static boolean isUrl(String url) {
        if (StringUtil.isEmpty(url)) {
            return false;
        }
        return Pattern.matches(REGEX_URL, url);
    }
@@ -134,6 +156,9 @@
     * @return
     */
    public static boolean isIPAddr(String ipAddr) {
        if (StringUtil.isEmpty(ipAddr)) {
            return false;
        }
        return Pattern.matches(REGEX_IP_ADDR, ipAddr);
    }
service-user/src/main/java/com/java110/user/cmd/user/OwnerUserLoginCmd.java
@@ -79,7 +79,7 @@
        //todo 验证码登录
        if (reqJson.containsKey("loginByPhone") && reqJson.getBoolean("loginByPhone")) {
            SmsDto smsDto = new SmsDto();
            smsDto.setTel(reqJson.getString("userName"));
            smsDto.setTel(reqJson.getString("username"));
            smsDto.setCode(reqJson.getString("password"));
            smsDto = smsInnerServiceSMOImpl.validateCode(smsDto);
            if (!smsDto.isSuccess()) {
@@ -94,10 +94,10 @@
        UserDto userDto = new UserDto();
        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 {
            userDto.setUserName(reqJson.getString("userName"));
            userDto.setUserName(reqJson.getString("username"));
        }
        // todo 不是验证码登录