收藏

手机号码校验

2022-07-12  本文已影响0人  AC编程
// 参数验证
            if (ReUtil.isMatch(RegConstant.REG_AREACODE_CN, vo.getGlobalCode())) {
                if (!ReUtil.isMatch(RegConstant.REG_MOBILE_CN, vo.getMobile())) {
                    throw new Exception(ResultCode.VALIDATE_FAILED, "手机号码格式不正确");
                }
            } else if (ReUtil.isMatch(RegConstant.REG_AREACODE_HK, vo.getGlobalCode())) {
                if (!ReUtil.isMatch(RegConstant.REG_MOBILE_HK, vo.getMobile())) {
                    throw new Exception(ResultCode.VALIDATE_FAILED, "手机号码格式不正确");
                }
            } else if (ReUtil.isMatch(RegConstant.REG_AREACODE_MO, vo.getGlobalCode())) {
                if (!ReUtil.isMatch(RegConstant.REG_MOBILE_MO, vo.getMobile())) {
                    throw new Exception(ResultCode.VALIDATE_FAILED, "手机号码格式不正确");
                }
            } else if (ReUtil.isMatch(RegConstant.REG_AREACODE_TW, vo.getGlobalCode())) {
                if (!ReUtil.isMatch(RegConstant.REG_MOBILE_TW, vo.getMobile())) {
                    throw new Exception(ResultCode.VALIDATE_FAILED, "手机号码格式不正确");
                }
            }
上一篇 下一篇

猜你喜欢

热点阅读