浏览代码

bug修改 部分dto数据类型冲突,修改提交

张均强 4 年之前
父节点
当前提交
22a80f7edd
共有 25 个文件被更改,包括 446 次插入46 次删除
  1. 12 4
      common/fire-dto/src/main/java/com/fire/dto/ChannelGroup.java
  2. 16 1
      common/fire-dto/src/main/java/com/fire/dto/ChannelInfo.java
  3. 5 0
      common/fire-dto/src/main/java/com/fire/dto/ChannelProductInfo.java
  4. 6 1
      common/fire-dto/src/main/java/com/fire/dto/DistributeGroup.java
  5. 1 1
      common/fire-dto/src/main/java/com/fire/dto/FlowAppInfo.java
  6. 1 1
      common/fire-dto/src/main/java/com/fire/dto/MobileFlowDispatchRec.java
  7. 1 0
      common/fire-dto/src/main/java/com/fire/dto/enums/RedisKey.java
  8. 1 1
      modules/admin/src/main/java/com/fire/admin/dto/FlowAppInfoDto.java
  9. 19 15
      modules/distribution/src/main/java/com/fire/dist/consumer/RocketOrderConsumer.java
  10. 5 0
      modules/distribution/src/main/java/com/fire/dist/data/DataPool.java
  11. 23 0
      modules/distribution/src/main/java/com/fire/dist/mapper/ChannelGroupMapper.java
  12. 23 0
      modules/distribution/src/main/java/com/fire/dist/mapper/ChannelInfoMapper.java
  13. 23 0
      modules/distribution/src/main/java/com/fire/dist/mapper/ChannelProductInfoMapper.java
  14. 22 0
      modules/distribution/src/main/java/com/fire/dist/mapper/DistributeGroupMapper.java
  15. 4 0
      modules/distribution/src/main/java/com/fire/dist/service/CacheService.java
  16. 43 8
      modules/distribution/src/main/java/com/fire/dist/service/impl/CacheServiceImpl.java
  17. 51 8
      modules/distribution/src/main/java/com/fire/dist/service/impl/DistOrderServiceImpl.java
  18. 32 0
      modules/distribution/src/main/resources/mapper/ChannelGroupMapper.xml
  19. 70 0
      modules/distribution/src/main/resources/mapper/ChannelInfoMapper.xml
  20. 38 0
      modules/distribution/src/main/resources/mapper/ChannelProductInfoMapper.xml
  21. 42 0
      modules/distribution/src/main/resources/mapper/DistributeGroupMapper.xml
  22. 3 1
      modules/distribution/src/main/resources/mapper/FlowAppInfoMapper.xml
  23. 1 0
      modules/make-order/src/main/java/com/fire/order/service/impl/CacheServiceImpl.java
  24. 1 1
      modules/make-order/src/main/java/com/fire/order/service/impl/MakeOrderServiceImpl.java
  25. 3 4
      modules/make-order/src/main/resources/mapper/CustomerProductMapper.xml

+ 12 - 4
common/fire-dto/src/main/java/com/fire/dto/ChannelGroup.java

@@ -1,15 +1,15 @@
 package com.fire.dto;
 
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableLogic;
-import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 
 import java.util.Date;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @author: admin
@@ -45,4 +45,12 @@ public class ChannelGroup {
     @ApiModelProperty("删除标记 0-未删除,1-删除")
     @TableLogic
     private Integer isDelete;
+
+    @TableField(exist = false)
+    private List<DistributeGroup> distributeGroups;
+
+    @TableField(exist = false)
+    @JsonIgnoreProperties
+    @ApiModelProperty(value = "分发组map list", hidden = true)
+    private Map<Integer, List<DistributeGroup>> distributeGroupsMap;
 }

+ 16 - 1
common/fire-dto/src/main/java/com/fire/dto/ChannelInfo.java

@@ -1,6 +1,11 @@
 package com.fire.dto;
 
 import com.baomidou.mybatisplus.annotation.*;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -8,6 +13,7 @@ import lombok.NoArgsConstructor;
 
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author: admin
@@ -21,7 +27,7 @@ import java.util.List;
 @TableName("access_channel_info")
 public class ChannelInfo {
 
-    @TableId(value = "channel_id", type = IdType.AUTO)
+    @TableId(value = "channel_id",type = IdType.AUTO)
     @ApiModelProperty("通道id")
     private Long channelId;
 
@@ -68,4 +74,13 @@ public class ChannelInfo {
     @TableField(exist = false)
     @ApiModelProperty("通道产品")
     private List<ChannelProductInfo> channelProductInfos;
+
+    @TableField(exist = false)
+    @ApiModelProperty(value = "分发组id", hidden = true)
+    private Integer distributeGroupId;
+
+    @TableField(exist = false)
+    @ApiModelProperty(value = "通道产品 根据通道id分第一层 根据区域分第二次 根据面额分第三层", hidden = true)
+    @JsonIgnoreProperties
+    Map<String, Map<Long, List<ChannelProductInfo>>> productListMap;
 }

+ 5 - 0
common/fire-dto/src/main/java/com/fire/dto/ChannelProductInfo.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -55,4 +56,8 @@ public class ChannelProductInfo {
 
     @TableField(exist = false)
     private ChannelInfo channelInfo;
+
+    @TableField(exist = false)
+    @ApiModelProperty("省级行政编码")
+    private String areaNum;
 }

+ 6 - 1
common/fire-dto/src/main/java/com/fire/dto/DistributeGroup.java

@@ -25,7 +25,7 @@ public class DistributeGroup {
 
     @TableId(type = IdType.AUTO)
     @ApiModelProperty("主键")
-    private Integer id;
+    private Integer distributeGroupId;
 
     @ApiModelProperty("分发组名称")
     private String name;
@@ -62,5 +62,10 @@ public class DistributeGroup {
     private Integer isDelete;
 
     @TableField(exist = false)
+    @ApiModelProperty("通道组列表")
     private List<ChannelGroup> channelGroups;
+
+    @TableField(exist = false)
+    @ApiModelProperty("通道组列表")
+    private List<ChannelInfo> channelInfos;
 }

+ 1 - 1
common/fire-dto/src/main/java/com/fire/dto/FlowAppInfo.java

@@ -63,7 +63,7 @@ public class FlowAppInfo {
     private Integer time;
 
     @ApiModelProperty(value = "通道ID(关联的通道组id)")
-    private  Integer channelId;
+    private  Long channelId;
 
     /********************************扩展字段***********************************/
     @ApiModelProperty(value = "客户基本信息")

+ 1 - 1
common/fire-dto/src/main/java/com/fire/dto/MobileFlowDispatchRec.java

@@ -11,7 +11,7 @@ import lombok.Data;
 public class MobileFlowDispatchRec {
 
     @ApiModelProperty(value = "分发ID号")
-    private String recId;
+    private Long recId;
 
     @ApiModelProperty(value = "分发订单号")
     private String orderId;

+ 1 - 0
common/fire-dto/src/main/java/com/fire/dto/enums/RedisKey.java

@@ -5,6 +5,7 @@ public enum RedisKey {
     //系统
     ORDER_ID_INCR("order.id.incr", "自增订单id"),
     ORDER_INFO("order.info", "订单详情"),
+    CHILD_ORDER_INFO("child.order.info", "子订单详情"),
     CUSTOMER_AMOUNT("{customer.amount}", "客户金额"),
     SUPPLIER_AMOUNT("{supplier.amount}", "供应商金额"),
     ORDER_DOWN("{down.order}", "客户下单号 非订单号"),

+ 1 - 1
modules/admin/src/main/java/com/fire/admin/dto/FlowAppInfoDto.java

@@ -43,6 +43,6 @@ public class FlowAppInfoDto {
     private Integer time;
 
     @ApiModelProperty(value = "通道ID(关联的通道组id)")
-    private  Integer channelId;
+    private  Long channelId;
 
 }

+ 19 - 15
modules/distribution/src/main/java/com/fire/dist/consumer/RocketOrderConsumer.java

@@ -13,8 +13,8 @@ import org.springframework.cloud.context.config.annotation.RefreshScope;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
-import java.util.concurrent.atomic.AtomicInteger;
 
+import static com.fire.common.constants.RocketTags.MAKE_TAG;
 import static com.fire.common.constants.RocketTopic.ORDER_TOPIC;
 import static org.apache.rocketmq.spring.annotation.ConsumeMode.ORDERLY;
 
@@ -41,25 +41,29 @@ public class RocketOrderConsumer implements RocketMQListener<MessageExt> {
 
     @Override
     public void onMessage(MessageExt msg) {
+        String tag = msg.getTags();
+        //只消费tag为make的消息
+        if (MAKE_TAG.equals(tag)) {
+            if (sleepConsume) {
+                try {
+                    Thread.sleep(60000);
+                } catch (InterruptedException e) {
+                    log.info("线程sleep失败");
+                }
+                throw new BaseException("暂停消费");
+            }
+            String orderStr = new String(msg.getBody());
+            ObjectMapper om = new ObjectMapper();
 
-        if (sleepConsume) {
             try {
-                Thread.sleep(60000);
-            } catch (InterruptedException e) {
-                log.info("线程sleep失败");
+                FlowOrderInfo orderInfo = om.readValue(orderStr, FlowOrderInfo.class);
+                redisPriorityQueue.push(orderInfo.getOrderId(), orderStr);
+            } catch (Exception e) {
+                log.error("订单消息解析失败,消息体为:" + orderStr, e);
+                throw new BaseException("订单消息解析失败");
             }
-            throw new BaseException("暂停消费");
         }
-        String orderStr = new String(msg.getBody());
-        ObjectMapper om = new ObjectMapper();
 
-        try {
-            FlowOrderInfo orderInfo = om.readValue(orderStr, FlowOrderInfo.class);
-            redisPriorityQueue.push(orderInfo.getOrderId(), orderStr);
-        } catch (Exception e) {
-            log.error("订单消息解析失败,消息体为:" + orderStr, e);
-            throw new BaseException("订单消息解析失败");
-        }
 
     }
 

+ 5 - 0
modules/distribution/src/main/java/com/fire/dist/data/DataPool.java

@@ -1,5 +1,6 @@
 package com.fire.dist.data;
 
+import com.fire.dto.ChannelGroup;
 import com.fire.dto.FlowAppInfo;
 
 import java.util.HashMap;
@@ -17,5 +18,9 @@ public class DataPool {
      */
     public static Map<String, FlowAppInfo> flowAppInfoMap = new HashMap<>();
 
+    /**
+     * 通道信息
+     */
+    public static Map<Long, ChannelGroup> channelGroupMap = new HashMap<>();
 
 }

+ 23 - 0
modules/distribution/src/main/java/com/fire/dist/mapper/ChannelGroupMapper.java

@@ -0,0 +1,23 @@
+package com.fire.dist.mapper;
+
+import com.fire.dto.ChannelGroup;
+
+import java.util.List;
+
+/**
+ * 通道组表(AccessChannelGroup)表数据库访问层
+ *
+ * @author ZJQ  2021-06-02 10:22:22
+ */
+public interface ChannelGroupMapper {
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @return 实例对象list
+     */
+    List<ChannelGroup> queryAll();
+
+
+}
+

+ 23 - 0
modules/distribution/src/main/java/com/fire/dist/mapper/ChannelInfoMapper.java

@@ -0,0 +1,23 @@
+package com.fire.dist.mapper;
+
+import com.fire.dto.ChannelInfo;
+
+import java.util.List;
+
+/**
+ * 通道表(AccessChannelInfo)表数据库访问层
+ *
+ * @author ZJQ  2021-06-01 18:29:09
+ */
+public interface ChannelInfoMapper {
+
+    /**
+     * 查询全部
+     *
+     * @return 实例对象list
+     */
+    List<ChannelInfo> queryAll();
+
+
+}
+

+ 23 - 0
modules/distribution/src/main/java/com/fire/dist/mapper/ChannelProductInfoMapper.java

@@ -0,0 +1,23 @@
+package com.fire.dist.mapper;
+
+import com.fire.dto.ChannelProductInfo;
+
+import java.util.List;
+
+/**
+ * 通道产品表(ChannelProductInfo)表数据库访问层
+ *
+ * @author ZJQ  2021-06-01 18:24:40
+ */
+public interface ChannelProductInfoMapper {
+
+    /**
+     * 查询所有
+     *
+     * @return 实例对象list
+     */
+    List<ChannelProductInfo> queryAll();
+
+
+}
+

+ 22 - 0
modules/distribution/src/main/java/com/fire/dist/mapper/DistributeGroupMapper.java

@@ -0,0 +1,22 @@
+package com.fire.dist.mapper;
+
+import com.fire.dto.DistributeGroup;
+
+import java.util.List;
+
+/**
+ * 分发组表(DistributeGroup)表数据库访问层
+ *
+ * @author ZJQ  2021-06-02 10:07:32
+ */
+public interface DistributeGroupMapper {
+
+    /**
+     * 查询所有
+     *
+     * @return 实例对象list
+     */
+    List<DistributeGroup> queryAll();
+
+}
+

+ 4 - 0
modules/distribution/src/main/java/com/fire/dist/service/CacheService.java

@@ -13,6 +13,10 @@ public interface CacheService {
      */
     void cacheCustomer();
 
+    /**
+     * 缓存通道信息
+     */
+    void cacheChannel();
 
 
 }

+ 43 - 8
modules/distribution/src/main/java/com/fire/dist/service/impl/CacheServiceImpl.java

@@ -3,16 +3,13 @@ package com.fire.dist.service.impl;
 
 import com.alibaba.nacos.common.utils.CollectionUtils;
 import com.fire.dist.data.DataPool;
-import com.fire.dist.mapper.CustomerInfoMapper;
-import com.fire.dist.mapper.CustomerProductMapper;
-import com.fire.dist.mapper.FlowAppInfoMapper;
+import com.fire.dist.mapper.*;
 import com.fire.dist.service.CacheService;
-import com.fire.dto.CustomerInfo;
-import com.fire.dto.CustomerProduct;
-import com.fire.dto.FlowAppInfo;
+import com.fire.dto.*;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.Comparator;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -34,6 +31,18 @@ public class CacheServiceImpl implements CacheService {
     @Resource
     private CustomerProductMapper customerProductMapper;
 
+    @Resource
+    private ChannelProductInfoMapper channelProductInfoMapper;
+
+    @Resource
+    private ChannelInfoMapper channelInfoMapper;
+
+    @Resource
+    private DistributeGroupMapper distributeGroupMapper;
+
+    @Resource
+    private ChannelGroupMapper channelGroupMapper;
+
 
     /**
      * 缓存客户信息
@@ -67,9 +76,35 @@ public class CacheServiceImpl implements CacheService {
             //将接入信息list 转换为appId为key的map 如果存在重复key,以后出现的为准
             DataPool.flowAppInfoMap = appInfos.stream().collect(Collectors.toMap(FlowAppInfo::getAppId, a -> a, (k1, k2) -> k2));
         }
-
-
     }
 
+    /**
+     * 缓存通道信息
+     */
+    @Override
+    public void cacheChannel() {
+        List<ChannelProductInfo> productInfos = channelProductInfoMapper.queryAll();
+        List<ChannelInfo> channelInfos = channelInfoMapper.queryAll();
+        List<DistributeGroup> distributeGroups = distributeGroupMapper.queryAll();
+        List<ChannelGroup> channelGroups = channelGroupMapper.queryAll();
 
+        if (CollectionUtils.isNotEmpty(productInfos) && CollectionUtils.isNotEmpty(channelInfos) && CollectionUtils.isNotEmpty(distributeGroups) && CollectionUtils.isNotEmpty(channelGroups)) {
+            //通道产品 根据 通道id第一层 区域第二层 面额分第三层 进行分组
+            Map<Long, Map<String, Map<Long, List<ChannelProductInfo>>>> productListMap = productInfos.stream().collect(Collectors.groupingBy(ChannelProductInfo::getChannelId, Collectors.groupingBy(ChannelProductInfo::getAreaNum, Collectors.groupingBy(ChannelProductInfo::getStandardPrice))));
+            //将产品挂载到通道上面
+            channelInfos.forEach(a -> a.setProductListMap(productListMap.get(a.getChannelId())));
+            //通道按分发组id进行分组
+            Map<Integer, List<ChannelInfo>> channelListMap = channelInfos.stream().collect(Collectors.groupingBy(ChannelInfo::getDistributeGroupId));
+            //将通道挂载到分发组上面
+            distributeGroups.forEach(a -> a.setChannelInfos(channelListMap.get(a.getDistributeGroupId())));
+            //分发组按 通道组id第一层 运营商第二层 进行分组
+            Map<Long, Map<Integer, List<DistributeGroup>>> distributeGroupListMap = distributeGroups.stream().collect(Collectors.groupingBy(DistributeGroup::getChannelGroupId, Collectors.groupingBy(DistributeGroup::getOperator)));
+            //将分发组进行排序
+            distributeGroupListMap.forEach((k1, v1) -> v1.forEach((k2, v2) -> v2.sort(Comparator.comparingInt(DistributeGroup::getWeight).reversed())));
+            //将分发组挂载到通道组上
+            channelGroups.forEach(a -> a.setDistributeGroupsMap(distributeGroupListMap.get(a.getChannelGroupId())));
+            //通道组转为map 以通道组id为key 存到内存常量中
+            DataPool.channelGroupMap = channelGroups.stream().collect(Collectors.toMap(ChannelGroup::getChannelGroupId, a -> a, (k1, k2) -> k2));
+        }
+    }
 }

+ 51 - 8
modules/distribution/src/main/java/com/fire/dist/service/impl/DistOrderServiceImpl.java

@@ -1,19 +1,22 @@
 package com.fire.dist.service.impl;
 
 
+import com.alibaba.nacos.common.utils.CollectionUtils;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fire.dist.data.DataPool;
 import com.fire.dist.service.DistOrderService;
-import com.fire.dto.CustomerInfo;
-import com.fire.dto.FlowAppInfo;
-import com.fire.dto.FlowOrderInfo;
-import com.fire.dto.MobileFlowDispatchRec;
+import com.fire.dto.*;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import redis.clients.jedis.JedisCluster;
 
 import javax.annotation.Resource;
 import java.util.Date;
+import java.util.List;
+import java.util.Map;
 
+import static com.fire.dto.enums.RedisKey.CHILD_ORDER_INFO;
 import static com.fire.dto.enums.ValidStatus.SUSPEND;
 
 /**
@@ -30,16 +33,18 @@ public class DistOrderServiceImpl implements DistOrderService {
 
     @Override
     public void distOrder(FlowOrderInfo orderInfo) {
-        //appId是否存在
+        //取客户信息,进行分发校验
         FlowAppInfo flowAppInfo = DataPool.flowAppInfoMap.get(orderInfo.getAppId());
         Long orderId = orderInfo.getOrderId();
         if (flowAppInfo == null) {
             log.error("客户信息为空,请检查缓存机制,本次订单号为:" + orderId);
+            //todo  入回调队列
             return;
         }
         CustomerInfo customerInfo = flowAppInfo.getCustomerInfo();
         if (customerInfo == null) {
             log.error("客户信息为空,请检查缓存机制,本次订单号为:" + orderId);
+            //todo  入回调队列
             return;
         }
         //客户是否暂停
@@ -59,14 +64,52 @@ public class DistOrderServiceImpl implements DistOrderService {
             //todo 超时回调  入回调队列
             return;
         }
-        //todo 取分发记录
+        //取分发记录
         Integer sendCount = orderInfo.getSendCount();
+        Integer nowSendCount = sendCount == null ? 1 : sendCount + 1;
         MobileFlowDispatchRec childOrder = null;
-        if(sendCount != null){
+        ObjectMapper om = new ObjectMapper();
+        if (sendCount != null) {
             Long childId = orderId + sendCount;
+            String obj = jedisCluster.hget(CHILD_ORDER_INFO.key(), String.valueOf(childId));
+            if (obj != null) {
+                try {
+                    childOrder = om.readValue(obj, MobileFlowDispatchRec.class);
+                } catch (JsonProcessingException e) {
+                    log.error("提取分发记录失败", e);
+                }
+            }
+        }
+        //找到通道组
+        ChannelGroup channelGroup = DataPool.channelGroupMap.get(flowAppInfo.getChannelId());
+        if (channelGroup == null) {
+            //todo 回调队列 直接失败
+            return;
+        }
+        //提取通道下面的分发组
+        Map<Integer, List<DistributeGroup>> distributeGroupsMap = channelGroup.getDistributeGroupsMap();
+        if (distributeGroupsMap == null) {
+            //todo 回调队列 直接失败
+            return;
+        }
+        //找到对应运营商的分发组列表
+        List<DistributeGroup> distributeGroups = distributeGroupsMap.get(orderInfo.getPhoneOperator());
+        if (CollectionUtils.isEmpty(distributeGroups)) {
+            //todo 回调队列 直接失败
+            return;
+        }
+        //分发组已经按权重排序
+        distributeGroups.forEach(a -> {
+
+        });
+
+        //当取不到分发记录时
+        if (childOrder == null) {
+            childOrder = new MobileFlowDispatchRec();
+            childOrder.setRecId(orderId + nowSendCount);
 
         }
-        //
+
 
     }
 

+ 32 - 0
modules/distribution/src/main/resources/mapper/ChannelGroupMapper.xml

@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fire.dist.mapper.ChannelGroupMapper">
+
+    <resultMap type="com.fire.dto.ChannelGroup" id="AccessChannelGroupMap">
+        <result property="channelGroupId" column="channel_group_id" jdbcType="INTEGER"/>
+        <result property="groupName" column="group_name" jdbcType="VARCHAR"/>
+        <result property="creator" column="creator" jdbcType="VARCHAR"/>
+        <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="isDelete" column="is_delete" jdbcType="INTEGER"/>
+    </resultMap>
+
+    <!--查询全部-->
+    <select id="queryAll" resultMap="AccessChannelGroupMap">
+        <include refid="baseSql"/>
+        where channel_group_id = #{channelGroupId}
+    </select>
+
+    <sql id="baseSql">
+        select channel_group_id,
+               group_name,
+               creator,
+               create_time,
+               updator,
+               update_time,
+               is_delete
+        from access_channel_group
+    </sql>
+</mapper>
+

+ 70 - 0
modules/distribution/src/main/resources/mapper/ChannelInfoMapper.xml

@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fire.dist.mapper.ChannelInfoMapper">
+
+    <resultMap type="com.fire.dto.ChannelInfo" id="ChannelInfoMap">
+        <result property="channelId" column="channel_id" jdbcType="INTEGER"/>
+        <result property="supplierId" column="supplier_id" jdbcType="INTEGER"/>
+        <result property="channelName" column="channel_name" jdbcType="VARCHAR"/>
+        <result property="operator" column="operator" jdbcType="INTEGER"/>
+        <result property="isValid" column="is_valid" jdbcType="INTEGER"/>
+        <result property="remark" column="remark" jdbcType="VARCHAR"/>
+        <result property="creator" column="creator" jdbcType="VARCHAR"/>
+        <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="ip" column="ip" jdbcType="VARCHAR"/>
+        <result property="discount" column="discount" jdbcType="NUMERIC"/>
+        <result property="channelType" column="channel_type" jdbcType="INTEGER"/>
+        <result property="isDelete" column="is_delete" jdbcType="INTEGER"/>
+        <result property="distributeGroupId" column="distribute_group_id" jdbcType="INTEGER"/>
+    </resultMap>
+
+    <!--查询全部-->
+    <select id="queryAll" resultMap="ChannelInfoMap">
+        select a.channel_id,
+               a.supplier_id,
+               a.channel_name,
+               a.operator,
+               a.is_valid,
+               a.remark,
+               a.ip,
+               a.discount,
+               a.channel_type,
+               a.succ_num,
+               a.fail_num,
+               a.succ_ratio,
+               a.timly_rate,
+               a.total_succ_ratio,
+               a.is_delete,
+               b.distribute_group_id
+        from access_channel_info a
+                 left join distribute_group_channel b on a.channel_id = b.channel_id
+    </select>
+
+    <sql id="baseSql">
+        select channel_id,
+               supplier_id,
+               channel_name,
+               operator,
+               is_valid,
+               remark,
+               creator,
+               create_time,
+               updator,
+               update_time,
+               ip,
+               discount,
+               is_allow_sale,
+               is_sms_notice,
+               channel_type,
+               succ_num,
+               fail_num,
+               succ_ratio,
+               timly_rate,
+               total_succ_ratio,
+               is_delete
+        from access_channel_info
+    </sql>
+</mapper>
+

+ 38 - 0
modules/distribution/src/main/resources/mapper/ChannelProductInfoMapper.xml

@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fire.dist.mapper.ChannelProductInfoMapper">
+
+    <resultMap type="com.fire.dto.ChannelProductInfo" id="ChannelProductInfoMap">
+        <result property="channelProductId" column="channel_product_id" jdbcType="INTEGER"/>
+        <result property="channelId" column="channel_id" jdbcType="INTEGER"/>
+        <result property="productId" column="product_id" jdbcType="VARCHAR"/>
+        <result property="productName" column="product_name" jdbcType="VARCHAR"/>
+        <result property="packageId" column="package_id" jdbcType="VARCHAR"/>
+        <result property="standardPrice" column="standard_price" jdbcType="INTEGER"/>
+        <result property="price" column="price" jdbcType="NUMERIC"/>
+        <result property="remark" column="remark" jdbcType="VARCHAR"/>
+        <result property="isValid" column="is_valid" jdbcType="INTEGER"/>
+        <result property="discount" column="discount" jdbcType="VARCHAR"/>
+        <result property="areaNum" column="area_num" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <!--查询全部-->
+    <select id="queryAll" resultMap="ChannelProductInfoMap">
+        select a.channel_product_id,
+               a.channel_id,
+               a.product_id,
+               a.product_name,
+               a.package_id,
+               a.standard_price,
+               a.price,
+               a.remark,
+               a.is_valid,
+               a.discount,
+               b.area_num
+        from channel_product_info a
+                 left join flow_product_info b on a.product_id = b.product_id
+    </select>
+
+
+</mapper>
+

+ 42 - 0
modules/distribution/src/main/resources/mapper/DistributeGroupMapper.xml

@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fire.dist.mapper.DistributeGroupMapper">
+
+    <resultMap type="com.fire.dto.DistributeGroup" id="DistributeGroupMap">
+        <result property="distributeGroupId" column="distribute_group_id" jdbcType="INTEGER"/>
+        <result property="name" column="name" jdbcType="VARCHAR"/>
+        <result property="channelGroupId" column="channel_group_id" jdbcType="INTEGER"/>
+        <result property="policy" column="policy" jdbcType="VARCHAR"/>
+        <result property="operator" column="operator" jdbcType="INTEGER"/>
+        <result property="weight" column="weight" jdbcType="INTEGER"/>
+        <result property="creator" column="creator" jdbcType="VARCHAR"/>
+        <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="isValid" column="is_valid" jdbcType="INTEGER"/>
+        <result property="isDelete" column="is_delete" jdbcType="INTEGER"/>
+    </resultMap>
+
+    <!--查询所有-->
+    <select id="queryAll" resultMap="DistributeGroupMap">
+        <include refid="baseSql"/>
+    </select>
+
+
+    <sql id="baseSql">
+        select distribute_group_id,
+               name,
+               channel_group_id,
+               policy,
+               operator,
+               weight,
+               creator,
+               create_time,
+               updator,
+               update_time,
+               is_valid,
+               is_delete
+        from distribute_group
+    </sql>
+</mapper>
+

+ 3 - 1
modules/distribution/src/main/resources/mapper/FlowAppInfoMapper.xml

@@ -16,6 +16,7 @@
         <result property="dispatchChannel" column="dispatch_channel" jdbcType="VARCHAR"/>
         <result property="totalCount" column="total_count" jdbcType="INTEGER"/>
         <result property="time" column="time" jdbcType="INTEGER"/>
+        <result property="channelId" column="channel_id" jdbcType="INTEGER"/>
     </resultMap>
 
     <!--查询全部-->
@@ -35,7 +36,8 @@
                callback_url,
                ip_address,
                dispatch_channel,
-               total_count
+               total_count,
+               channel_id
         from flow_app_info
     </sql>
 

+ 1 - 0
modules/make-order/src/main/java/com/fire/order/service/impl/CacheServiceImpl.java

@@ -122,6 +122,7 @@ public class CacheServiceImpl implements CacheService {
         if (CollectionUtils.isNotEmpty(maintenances)) {
             Map<String, OperatorMaintenance> maintenanceMap = new HashMap<>();
             for (OperatorMaintenance om : maintenances) {
+                //维护信息的key为 省.运营商.面额
                 String key = om.getProvince() + "." + om.getOperator() + "." + om.getFacePrice();
                 maintenanceMap.put(key, om);
             }

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

@@ -226,7 +226,7 @@ public class MakeOrderServiceImpl implements MakeOrderService {
             return responseDto;
         }
         //校验产品是否有效
-        Integer isValid = product.getIsValid();
+        Integer isValid = product.getIsEffective();
         if (INVALID.status().equals(isValid)) {
             orderResp.setRCode(PACKAGE_ERROR.status());
             orderResp.setRMsg(PACKAGE_ERROR.message());

+ 3 - 4
modules/make-order/src/main/resources/mapper/CustomerProductMapper.xml

@@ -10,7 +10,7 @@
         <result property="type" column="type" jdbcType="INTEGER"/>
         <result property="price" column="price" jdbcType="NUMERIC"/>
         <result property="facePrice" column="face_price" jdbcType="NUMERIC"/>
-        <result property="isValid" column="is_valid" jdbcType="INTEGER"/>
+        <result property="isEffective" column="is_effective" jdbcType="INTEGER"/>
         <result property="areaName" column="area_name" jdbcType="VARCHAR"/>
         <result property="operator" column="operator" jdbcType="INTEGER"/>
         <result property="areaNum" column="area_num" jdbcType="VARCHAR"/>
@@ -24,7 +24,7 @@
                a.type,
                a.price,
                a.face_price,
-               a.is_valid,
+               a.is_effective,
                b.area_name,
                b.operator,
                b.area_num,
@@ -39,8 +39,7 @@
                a.package_id,
                a.type,
                a.price,
-               a.face_price,
-               a.is_valid
+               a.face_price
         from customer_product a
     </sql>