Kaynağa Gözat

BUG提交 解决修改字段导致的冲突

张均强 4 yıl önce
ebeveyn
işleme
56b5e54b76

+ 3 - 0
common/fire-dto/src/main/java/com/fire/dto/CustomerInfo.java

@@ -70,4 +70,7 @@ public class CustomerInfo {
     @ApiModelProperty(value = "跟用户关联,客户登录使用")
     private Integer userId;
 
+    @ApiModelProperty(value = "价格校验")
+    private Integer priceCheck;
+
 }

+ 2 - 0
common/fire-dto/src/main/java/com/fire/dto/CustomerProduct.java

@@ -42,6 +42,8 @@ public class CustomerProduct {
 
     @ApiModelProperty(value = "适用区域(省份名称)")
     private  String areaName;
+    @ApiModelProperty(value = "适用区域")
+    private String areaNum;
 
     @ApiModelProperty(value = "运营商  1 : 移动  2 : 电信  3 : 联通")
     private Integer operator;

+ 26 - 0
common/fire-dto/src/main/java/com/fire/dto/enums/PriceCheck.java

@@ -0,0 +1,26 @@
+package com.fire.dto.enums;
+
+public enum PriceCheck {
+
+    //系统
+    NO_CHECK(0, "不校验"),
+    CHECK(1, "校验");
+
+    private final Integer status;
+
+    private final String message;
+
+    PriceCheck(Integer status, String message) {
+        this.status = status;
+        this.message = message;
+    }
+
+    public Integer status() {
+        return status;
+    }
+
+    public String message() {
+        return message;
+    }
+
+}

+ 2 - 2
common/fire-dto/src/main/java/com/fire/dto/enums/Province.java

@@ -38,9 +38,9 @@ public enum Province {
     QG_ALL("100", "全国");
 
 
-    private String code;
+    private final String code;
 
-    private String name;
+    private final String name;
 
 
     Province(String code, String name) {

+ 2 - 2
common/fire-dto/src/main/java/com/fire/dto/enums/Status.java

@@ -29,9 +29,9 @@ public enum Status {
     BALANCE_NOT_ENOUGH("301", "可用余额不足"),
     PARAM_ERROR("306", "参数不合法");
 
-    private String status;
+    private final String status;
 
-    private String message;
+    private final String message;
 
     Status(String status, String message) {
         this.status = status;

+ 2 - 2
common/fire-dto/src/main/java/com/fire/dto/enums/ValidStatus.java

@@ -7,9 +7,9 @@ public enum ValidStatus {
     VALID(1, "有效"),
     SUSPEND(2, "暂停");
 
-    private Integer status;
+    private final Integer status;
 
-    private String message;
+    private final String message;
 
     ValidStatus(Integer status, String message) {
         this.status = status;

+ 3 - 1
modules/make-order/src/main/java/com/fire/order/mapper/FlowProductInfoMapper.java

@@ -1,5 +1,7 @@
 package com.fire.order.mapper;
 
+import com.fire.dto.FireProductInfo;
+
 /**
  * 产品表(适用于供应商和客户)(FlowProductInfo)表数据库访问层
  *
@@ -13,7 +15,7 @@ public interface FlowProductInfoMapper {
      * @param productId 主键
      * @return 实例对象
      */
-    FlowProductInfo queryByPackageId(Long productId);
+    FireProductInfo queryByPackageId(Long productId);
 
 
 }

+ 4 - 0
modules/make-order/src/main/java/com/fire/order/request/OrderRequestContent.java

@@ -35,4 +35,8 @@ public class OrderRequestContent {
     @JsonProperty(value = "USER")
     private String user;
 
+    @ApiModelProperty(value = "结算价格")
+    @JsonProperty(value = "PRICE")
+    private Integer price;
+
 }

+ 26 - 2
modules/make-order/src/main/java/com/fire/order/service/impl/MakeOrderServiceImpl.java

@@ -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;
     }

+ 3 - 1
modules/make-order/src/main/resources/mapper/CustomerInfoMapper.xml

@@ -23,6 +23,7 @@
         <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
         <result property="partnerCommission" column="partner_commission" jdbcType="VARCHAR"/>
         <result property="userId" column="user_id" jdbcType="INTEGER"/>
+        <result property="priceCheck" column="price_check" jdbcType="INTEGER"/>
     </resultMap>
 
     <!--查询全部-->
@@ -42,7 +43,8 @@
                current_amount,
                is_deleted,
                partner_commission,
-               user_id
+               user_id,
+               price_check
         from customer_info
     </sql>
 

+ 4 - 5
modules/make-order/src/main/resources/mapper/FlowProductInfoMapper.xml

@@ -2,7 +2,7 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fire.order.mapper.FlowProductInfoMapper">
 
-    <resultMap type="com.fire.dto.FlowProductInfo" id="FlowProductInfoMap">
+    <resultMap type="com.fire.dto.FireProductInfo" id="FlowProductInfoMap">
         <result property="productId" column="product_id" jdbcType="INTEGER"/>
         <result property="packageId" column="package_id" jdbcType="VARCHAR"/>
         <result property="productCode" column="product_code" jdbcType="VARCHAR"/>
@@ -14,8 +14,6 @@
         <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
         <result property="updator" column="updator" jdbcType="VARCHAR"/>
         <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
-        <result property="zone" column="zone" jdbcType="VARCHAR"/>
-        <result property="delFlag" column="del_flag" jdbcType="VARCHAR"/>
         <result property="operator" column="operator" jdbcType="VARCHAR"/>
     </resultMap>
 
@@ -37,8 +35,9 @@
                create_time,
                updator,
                update_time,
-               zone,
-               del_flag,
+               area_num,
+               area_name,
+               is_delete,
                operator
         from flow_product_info
     </sql>