소스 검색

渠道,新增私有,领取公共客户,新增电话号码判断

anderx 1 개월 전
부모
커밋
9b2fe20424

+ 16 - 0
src/main/java/com/goafanti/common/utils/RegexUtils.java

@@ -0,0 +1,16 @@
+package com.goafanti.common.utils;
+
+import java.util.regex.Pattern;
+
+public class RegexUtils {
+    // 手机号必须是1开头,第二位是3-9的数字一共11位
+    public static final String REGEX_MOBILE = "^1[3-9]\\d{9}$";
+
+
+
+
+    public static boolean isMobile(CharSequence input) {
+        return input != null && input.length() == 11 && Pattern.matches(REGEX_MOBILE, input);
+    }
+
+}

+ 17 - 0
src/main/java/com/goafanti/customer/controller/AdminCustomerApiController.java

@@ -333,6 +333,11 @@ public class AdminCustomerApiController extends BaseApiController{
 			res.getError().add(buildError("","创建客户参数不全"));
 			return res;
 		}
+		//判断电话号码
+		if (!RegexUtils.isMobile(in.getContactMobile())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "联系人电话格式错误", "联系人电话"));
+			return res;
+		}
 		if (!customerService.checkAid(TokenManager.getAdminId(),Integer.valueOf(AFTConstants.CUSTOMER_SERVICE_SALESMAN))){
 			if (customerService.checkMax(null,TokenManager.getAdminId())) {
 				res.getError().add(buildError("","私有客户已达最大限制"));
@@ -362,6 +367,11 @@ public class AdminCustomerApiController extends BaseApiController{
 			res.getError().add(buildError("客户名称已存在"));
 			return res;
 		}
+		//添加电话正则
+		if (!RegexUtils.isMobile(in.getContactMobile())){
+			res.getError().add(buildError("手机号码格式错误"));
+			return res;
+		}
 		in.setType(1);
 		//新增为私有客户
 		in.setShareType(0);
@@ -1689,6 +1699,13 @@ public class AdminCustomerApiController extends BaseApiController{
 				return res;
 			}
 		}
+		//手机号码判断
+		if (in.getContactMobile()!=null){
+			if (!RegexUtils.isMobile(in.getContactMobile())){
+				res.getError().add(buildError("","手机号码格式错误"));
+				return res;
+			}
+		}
 		Result result = receiveCustomer(in.getId(), null);
 		res.getError().addAll(result.getError());
 		if (!res.getError().isEmpty()){

+ 7 - 6
src/main/resources/props/config_local.properties

@@ -2,18 +2,19 @@ dev.name=local
 spring.main.lazy-initialization=true
 jdbc.driverClassName=com.mysql.jdbc.Driver
 kede.version=1.3.48
+#kede.version=1.3.39
 static.host=//static.jishutao.com/${kede.version}
-#static.host=//172.16.1.199:3000/${kede.version}
+#static.host=//172.16.1.199:8888/${kede.version}
 #static.host=//172.16.1.187/${kede.version}
 #avatar.host=//172.16.1.199:3000
 
 #jdbc.url=jdbc\:mysql://localhost:3306/aft20250613?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
-#jdbc.url=jdbc\:mysql://localhost:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
-#jdbc.username=root
-#jdbc.password=123456
-jdbc.url=jdbc:mysql://101.37.32.31:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
+jdbc.url=jdbc\:mysql://localhost:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
 jdbc.username=root
-jdbc.password=aftdev
+jdbc.password=123456
+#jdbc.url=jdbc:mysql://101.37.32.31:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
+#jdbc.username=root
+#jdbc.password=aftdev
 jdbc.validationQuery=SELECT 'x'
 jdbc.initialSize=3
 jdbc.maxActive=20