anderx 1 год назад
Родитель
Сommit
597c8b6334

+ 12 - 9
src/main/java/com/goafanti/customer/service/impl/UserClueServiceImpl.java

@@ -277,17 +277,20 @@ public class UserClueServiceImpl extends BaseMybatisDao<UserMapper> implements U
         if (!contactMobile.equals("-")){
             String[] split = contactMobile.split(";");
             for (String s : split) {
-                String mobileReg="[1-9]\\d{10}";
-                String mobileReg2="^0\\d{2,3}-?\\d{7,8}$";
-                Pattern  pattern =Pattern.compile(mobileReg);
-                Matcher matcher = pattern.matcher(s);
-                if (!matcher.matches()){
-                    Pattern  pattern2 =Pattern.compile(mobileReg2);
-                    Matcher matcher2 = pattern2.matcher(s);
-                    if (!matcher2.matches()){
-                        throw new BusinessException("手机号格式不正确");
+                if (StringUtils.isNotBlank(s)){
+                    String mobileReg="[1-9]\\d{10}";
+                    String mobileReg2="^0\\d{2,3}-?\\d{7,8}$";
+                    Pattern  pattern =Pattern.compile(mobileReg);
+                    Matcher matcher = pattern.matcher(s);
+                    if (!matcher.matches()){
+                        Pattern  pattern2 =Pattern.compile(mobileReg2);
+                        Matcher matcher2 = pattern2.matcher(s);
+                        if (!matcher2.matches()){
+                            throw new BusinessException("手机号格式不正确");
+                        }
                     }
                 }
+
             }
         }