|
@@ -3,7 +3,10 @@ package com.fire.order.service.impl;
|
|
|
|
|
|
import com.alibaba.nacos.api.utils.StringUtils;
|
|
|
import com.alibaba.nacos.common.utils.MD5Utils;
|
|
|
+import com.fire.dto.CustomerInfo;
|
|
|
+import com.fire.dto.CustomerProduct;
|
|
|
import com.fire.dto.FlowAppInfo;
|
|
|
+import com.fire.dto.PhoneZone;
|
|
|
import com.fire.order.data.DataPool;
|
|
|
import com.fire.order.request.OrderRequestContent;
|
|
|
import com.fire.order.request.OrderRequestMsgBody;
|
|
@@ -20,6 +23,8 @@ import org.springframework.stereotype.Service;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
import java.util.Map;
|
|
|
|
|
|
+import static com.fire.dto.enums.PriceCheck.CHECK;
|
|
|
+import static com.fire.dto.enums.Province.QG_ALL;
|
|
|
import static com.fire.dto.enums.Status.*;
|
|
|
import static com.fire.dto.enums.ValidStatus.INVALID;
|
|
|
|
|
@@ -180,14 +185,14 @@ public class MakeOrderServiceImpl implements MakeOrderService {
|
|
|
orderResp.setRMsg(SIGN_FAIL.message());
|
|
|
return responseDto;
|
|
|
}
|
|
|
- Map<String, CustomerProductInfo> productMap = flowAppInfo.getProductMap();
|
|
|
+ Map<String, CustomerProduct> productMap = flowAppInfo.getProductMap();
|
|
|
//校验产品是否存在
|
|
|
if (productMap == null) {
|
|
|
orderResp.setRCode(PACKAGE_ERROR.status());
|
|
|
orderResp.setRMsg(PACKAGE_ERROR.message());
|
|
|
return responseDto;
|
|
|
}
|
|
|
- CustomerProductInfo product = productMap.get(packageId);
|
|
|
+ CustomerProduct product = productMap.get(packageId);
|
|
|
if (product == null) {
|
|
|
orderResp.setRCode(PACKAGE_ERROR.status());
|
|
|
orderResp.setRMsg(PACKAGE_ERROR.message());
|
|
@@ -200,6 +205,25 @@ public class MakeOrderServiceImpl implements MakeOrderService {
|
|
|
orderResp.setRMsg(PACKAGE_ERROR.message());
|
|
|
return responseDto;
|
|
|
}
|
|
|
+ //如果产品不是全国性产品那么进行归属地校验
|
|
|
+ if (!QG_ALL.getCode().equals(product.getAreaNum())) {
|
|
|
+ //根据号码前七位,获取归属地信息
|
|
|
+ String start7 = phoneNo.substring(0, 7);
|
|
|
+ PhoneZone phoneZone = DataPool.phoneZoneMap.get(start7);
|
|
|
+ //如果归属不一样,那么不通过校验
|
|
|
+ if (phoneZone == null || !phoneZone.getProvinceCode().equals(product.getAreaNum())) {
|
|
|
+ orderResp.setRCode(FAILURE_SERVER.status());
|
|
|
+ orderResp.setRMsg("号码归属和所选产品归属不一致");
|
|
|
+ return responseDto;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //如果要求校验结算价格
|
|
|
+ CustomerInfo customerInfo = flowAppInfo.getCustomerInfo();
|
|
|
+ if (customerInfo != null && CHECK.status().equals(customerInfo.getPriceCheck()) && !product.getPrice().equals(content.getPrice())) {
|
|
|
+ orderResp.setRCode(FAILURE_SERVER.status());
|
|
|
+ orderResp.setRMsg("结算价格不一致");
|
|
|
+ return responseDto;
|
|
|
+ }
|
|
|
|
|
|
return responseDto;
|
|
|
}
|