Browse Source

Merge branch 'feature/1.0.0' of github.com:ab-inbev-apac/abi-cloud-qr-platform into feature/1.0.0

tanzhongran 3 years ago
parent
commit
7194033cab

+ 9 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/service/impl/FactoryServiceImpl.java

@@ -44,6 +44,7 @@ import org.springframework.transaction.annotation.Transactional;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
+import java.util.regex.Pattern;
 
 /**
  * <p>
@@ -373,9 +374,17 @@ public class FactoryServiceImpl implements FactoryService {
         if (StringUtils.isBlank(factoryProperty.getKeymanMobile())) {
             errorMessage.append("联系人手机号").append("为空,");
         }
+        Pattern patternPhone = Pattern.compile("^[1]\\d{10}$");
+        if(!patternPhone.matcher(factoryProperty.getKeymanMobile()).matches()){
+            errorMessage.append("联系人手机号").append("格式不正确,");
+        }
         if (StringUtils.isBlank(factoryProperty.getEmail())) {
             errorMessage.append("邮箱").append("为空,");
         }
+        Pattern patternEmail = Pattern.compile("^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$");
+        if(!patternEmail.matcher(factoryProperty.getEmail()).matches()){
+            errorMessage.append("邮箱").append("格式不正确,");
+        }
 
         return errorMessage.toString();
     }

+ 1 - 1
abi-cloud-qr-platform-server/src/test/java/com/abi/qms/platform/EncryptionTest.java

@@ -97,7 +97,7 @@ public class EncryptionTest {
             try {
                 in.close();
             } catch (IOException e) {
-                throw new BusinessException(404,"io流关闭异常");
+                throw new BusinessException(404 , "io流关闭异常");
             }
         }