|
@@ -1,5 +1,6 @@
|
|
|
package com.jd.zfjyjgfwpt.controller;
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.jd.zfjyjgfwpt.entity.PurchaseInformation;
|
|
@@ -49,9 +50,22 @@ public class PurchaseInformationController {
|
|
|
*/
|
|
|
@PostMapping("insertPurchaseIntention")
|
|
|
public Map<String, Object> insertPurchaseIntention(@Valid PurchaseInformation purchaseInformation) {
|
|
|
-// if (!Blank.isPhone(purchaseInformation.getPhone())) {
|
|
|
-// return SendUtil.send(false, "请输入正确的手机号", null);
|
|
|
-// }
|
|
|
+ if (Blank.isNotEmpty(purchaseInformation.getPhone())) {
|
|
|
+ if (ObjectUtil.equal(purchaseInformation.getContactType(), 1)) {
|
|
|
+ if (!Blank.isQQPattern(purchaseInformation.getPhone())) {
|
|
|
+ return SendUtil.send(false, "请输入正确的联系方式", null);
|
|
|
+ }
|
|
|
+ }else if (ObjectUtil.equal(purchaseInformation.getContactType(), 2)) {
|
|
|
+ if (!Blank.isWxPattern(purchaseInformation.getPhone())) {
|
|
|
+ return SendUtil.send(false, "请输入正确的联系方式", null);
|
|
|
+ }
|
|
|
+ }else if (ObjectUtil.equal(purchaseInformation.getContactType(), 3)) {
|
|
|
+ if (!Blank.isPhone(purchaseInformation.getPhone())) {
|
|
|
+ return SendUtil.send(false, "请输入正确的联系方式", null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (purchaseInformation.getMoneyMax() < purchaseInformation.getMoneyMin()) {
|
|
|
return SendUtil.send(false, "最高预算不能小于最低预算", null);
|
|
|
}
|
|
@@ -82,9 +96,22 @@ public class PurchaseInformationController {
|
|
|
if (Blank.isEmpty(purchaseInformation.getId())) {
|
|
|
return SendUtil.send(false, ConstString.REQUEST_WRONGPARAMS);
|
|
|
}
|
|
|
-// if (!Blank.isPhone(purchaseInformation.getPhone())) {
|
|
|
-// return SendUtil.send(false, "请输入正确的手机号", null);
|
|
|
-// }
|
|
|
+ if (Blank.isNotEmpty(purchaseInformation.getPhone())) {
|
|
|
+ if (ObjectUtil.equal(purchaseInformation.getContactType(), 1)) {
|
|
|
+ if (!Blank.isQQPattern(purchaseInformation.getPhone())) {
|
|
|
+ return SendUtil.send(false, "请输入正确的联系方式", null);
|
|
|
+ }
|
|
|
+ }else if (ObjectUtil.equal(purchaseInformation.getContactType(), 2)) {
|
|
|
+ if (!Blank.isWxPattern(purchaseInformation.getPhone())) {
|
|
|
+ return SendUtil.send(false, "请输入正确的联系方式", null);
|
|
|
+ }
|
|
|
+ }else if (ObjectUtil.equal(purchaseInformation.getContactType(), 3)) {
|
|
|
+ if (!Blank.isPhone(purchaseInformation.getPhone())) {
|
|
|
+ return SendUtil.send(false, "请输入正确的联系方式", null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (purchaseInformation.getMoneyMax() < purchaseInformation.getMoneyMin()) {
|
|
|
return SendUtil.send(false, "最高预算不能小于最低预算", null);
|
|
|
}
|