Parcourir la source

任务提交 分发模块客户缓存数据

张均强 il y a 4 ans
Parent
commit
4c374e303f
18 fichiers modifiés avec 547 ajouts et 17 suppressions
  1. 2 1
      common/fire-common/src/main/java/com/fire/common/redis/RedisOrderIdScript.java
  2. 19 8
      common/fire-common/src/main/java/com/fire/common/redis/RedisPriorityQueueScript.java
  3. 0 1
      common/fire-dto/src/main/java/com/fire/dto/enums/RedisKey.java
  4. 19 7
      modules/distribution/src/main/java/com/fire/dist/consumer/RocketOrderConsumer.java
  5. 49 0
      modules/distribution/src/main/java/com/fire/dist/consumer/RocketUpdateConsumer.java
  6. 21 0
      modules/distribution/src/main/java/com/fire/dist/data/DataPool.java
  7. 23 0
      modules/distribution/src/main/java/com/fire/dist/mapper/CustomerProductMapper.java
  8. 24 0
      modules/distribution/src/main/java/com/fire/dist/mapper/FlowAppInfoMapper.java
  9. 39 0
      modules/distribution/src/main/java/com/fire/dist/priority/RedisPriorityQueue.java
  10. 18 0
      modules/distribution/src/main/java/com/fire/dist/service/CacheService.java
  11. 20 0
      modules/distribution/src/main/java/com/fire/dist/service/DistOrderService.java
  12. 75 0
      modules/distribution/src/main/java/com/fire/dist/service/impl/CacheServiceImpl.java
  13. 59 0
      modules/distribution/src/main/java/com/fire/dist/service/impl/DistOrderServiceImpl.java
  14. 43 0
      modules/distribution/src/main/java/com/fire/dist/task/CacheCustomerTask.java
  15. 22 0
      modules/distribution/src/main/resources/bootstrap.yml
  16. 48 0
      modules/distribution/src/main/resources/mapper/CustomerProductMapper.xml
  17. 43 0
      modules/distribution/src/main/resources/mapper/FlowAppInfoMapper.xml
  18. 23 0
      modules/make-order/src/main/resources/bootstrap.yml

+ 2 - 1
common/fire-common/src/main/java/com/fire/common/redis/RedisOrderIdScript.java

@@ -8,6 +8,7 @@ import redis.clients.jedis.JedisCluster;
 import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
 import java.util.Arrays;
+import java.util.Collections;
 
 import static com.fire.dto.enums.RedisKey.ORDER_DOWN;
 
@@ -53,7 +54,7 @@ public class RedisOrderIdScript {
      */
     public String checkOrderId(String customerOrder, String OrderId) {
         String orderName = ORDER_DOWN.key();
-        Object res = jedisCluster.evalsha(runCode, Arrays.asList(orderName, orderName + customerOrder), Arrays.asList(OrderId));
+        Object res = jedisCluster.evalsha(runCode, Arrays.asList(orderName, orderName + customerOrder), Collections.singletonList(OrderId));
         return res.toString();
     }
 }

+ 19 - 8
common/fire-common/src/main/java/com/fire/common/redis/RedisPriorityQueueScript.java

@@ -8,6 +8,7 @@ import redis.clients.jedis.JedisCluster;
 import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
 import java.util.Arrays;
+import java.util.Collections;
 
 import static com.fire.dto.enums.RedisKey.PRIORITY_QUEUE;
 
@@ -26,15 +27,15 @@ public class RedisPriorityQueueScript {
     public void initScript() {
         String slotKey = PRIORITY_QUEUE.key();
         //LUA脚本
-        String SCRIPT = "local index = KEYS[1]"+
+        String SCRIPT = "local index = KEYS[1]" +
                 " local operating = ARGV[1]" +
                 " local score = ARGV[2]" +
                 " local content = ARGV[3]" +
                 " local res = 0" +
-                " if operating == 'get' then"+
+                " if operating == 'get' then" +
                 " local ks=redis.call('ZRANGE', index, '0', '0')" +
                 " for _, item in ipairs(ks) do" +
-                " res = redis.call('ZREM', index, item)"+
+                " res = redis.call('ZREM', index, item)" +
                 " if res > 0 then" +
                 " return item" +
                 " end" +
@@ -51,25 +52,35 @@ public class RedisPriorityQueueScript {
             log.info("脚本已加载");
         }
     }
+
     /*
      * 获取优先级队列分发订单内容
      * 返回 null:失败 获取数据:成功
      */
     public String getContent() {
         String priorityQueue = PRIORITY_QUEUE.key();
-        Object res = jedisCluster.evalsha(runCode, Arrays.asList(priorityQueue), Arrays.asList("get","",""));
-        return res.toString();
+        Object res = jedisCluster.evalsha(runCode, Collections.singletonList(priorityQueue), Arrays.asList("get", "", ""));
+        if (res != null) {
+            return res.toString();
+        } else {
+            return null;
+        }
     }
+
     /*
      * 添加优先级队列分发订单内容
      * 1.score 排序序号
      * 2.content 分发记录类容
      * 返回 0:覆盖 1:成功
      */
-    public String addContent(Long score,String content) {
+    public Integer addContent(Long score, String content) {
         String priorityQueue = PRIORITY_QUEUE.key();
-        Object res = jedisCluster.evalsha(runCode, Arrays.asList(priorityQueue), Arrays.asList("add",String.valueOf(score),content));
-        return res.toString();
+        Object res = jedisCluster.evalsha(runCode, Collections.singletonList(priorityQueue), Arrays.asList("add", String.valueOf(score), content));
+        if (res != null) {
+            return Integer.valueOf(res.toString());
+        } else {
+            return null;
+        }
     }
 
 

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

@@ -10,7 +10,6 @@ public enum RedisKey {
     ORDER_DOWN("{down.order}", "客户下单号 非订单号"),
     PRIORITY_QUEUE("{priority.queue}", "分发订单优先级队列");
 
-
     private final String key;
 
     private final String desc;

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

@@ -1,6 +1,9 @@
 package com.fire.dist.consumer;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fire.common.exception.BaseException;
+import com.fire.dist.priority.RedisPriorityQueue;
+import com.fire.dto.FlowOrderInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.rocketmq.common.message.MessageExt;
 import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
@@ -9,8 +12,8 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.cloud.context.config.annotation.RefreshScope;
 import org.springframework.stereotype.Component;
 
-import java.text.SimpleDateFormat;
-import java.util.Date;
+import javax.annotation.Resource;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import static com.fire.common.constants.RocketTopic.ORDER_TOPIC;
 import static org.apache.rocketmq.spring.annotation.ConsumeMode.ORDERLY;
@@ -27,14 +30,18 @@ import static org.apache.rocketmq.spring.annotation.ConsumeMode.ORDERLY;
 @Slf4j
 @Component
 @RefreshScope
-@RocketMQMessageListener(consumerGroup = "${rocketmq.consumer.group}", topic = ORDER_TOPIC, consumeMode = ORDERLY)
+@RocketMQMessageListener(consumerGroup = "${rocketmq.consumer.group}", topic = ORDER_TOPIC, consumeMode = ORDERLY, consumeThreadMax = 1)
 public class RocketOrderConsumer implements RocketMQListener<MessageExt> {
 
     @Value("${sleep.consume}")
     private Boolean sleepConsume;
 
+    @Resource
+    private RedisPriorityQueue redisPriorityQueue;
+
     @Override
     public void onMessage(MessageExt msg) {
+
         if (sleepConsume) {
             try {
                 Thread.sleep(60000);
@@ -43,10 +50,15 @@ public class RocketOrderConsumer implements RocketMQListener<MessageExt> {
             }
             throw new BaseException("暂停消费");
         }
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
-        String born = sdf.format(new Date(msg.getBornTimestamp()));
-        String store = sdf.format(new Date(msg.getStoreTimestamp()));
-        log.info("消费消息:" + msg.getMsgId() + " 消息产生时间:" + born + " 消息存储时间:" + store);
+        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);
+        }
+
     }
 
 }

+ 49 - 0
modules/distribution/src/main/java/com/fire/dist/consumer/RocketUpdateConsumer.java

@@ -0,0 +1,49 @@
+package com.fire.dist.consumer;
+
+import com.alibaba.nacos.api.utils.StringUtils;
+import com.fire.dist.service.CacheService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.rocketmq.common.message.MessageExt;
+import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
+import org.apache.rocketmq.spring.core.RocketMQListener;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+
+import static com.fire.common.constants.RocketTags.CONSUMER_PRODUCT_TAG;
+import static com.fire.common.constants.RocketTopic.UPDATE_TOPIC;
+
+
+/**
+ * 消息消费者,可与生产者分离
+ * 这里定义的messageMode是集群消费,如果是同一消费组则会组内消费者均衡消费;
+ * 如果是不同消费组,则会起到广播消费的效果
+ *
+ * @author ZJQ 2021年5月26日14:59:42
+ */
+
+@Slf4j
+@Component
+@RocketMQMessageListener(consumerGroup = "${rocketmq.consumer.group}", topic = UPDATE_TOPIC)
+public class RocketUpdateConsumer implements RocketMQListener<MessageExt> {
+
+    @Resource
+    private CacheService cacheService;
+
+    @Override
+    public void onMessage(MessageExt msg) {
+        //只消费最近十分钟的消息,因为再之前的消息为历史的更新没有意义
+        Long now = System.currentTimeMillis();
+        Long bron = msg.getBornTimestamp();
+        if (now - bron < 600000) {
+            String tag = msg.getTags();
+            if (!StringUtils.isEmpty(tag)) {
+                log.info("消费更新缓存消息:" + tag);
+                switch (tag) {
+                    case CONSUMER_PRODUCT_TAG -> cacheService.cacheCustomer();
+
+                }
+            }
+        }
+    }
+}

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

@@ -0,0 +1,21 @@
+package com.fire.dist.data;
+
+import com.fire.dto.FlowAppInfo;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 需要在内存中缓存的信息
+ *
+ * @author ZJQ 2021年5月31日16:14:47
+ */
+public class DataPool {
+
+    /**
+     * 客户信息
+     */
+    public static Map<String, FlowAppInfo> flowAppInfoMap = new HashMap<>();
+
+
+}

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

@@ -0,0 +1,23 @@
+package com.fire.dist.mapper;
+
+
+import com.fire.dto.CustomerProduct;
+
+import java.util.List;
+
+/**
+ * 客户产品表(CustomerProduct)表数据库访问层
+ *
+ * @author ZJQ  2021-05-17 16:47:08
+ */
+public interface CustomerProductMapper {
+
+    /**
+     * 查询所有客户产品
+     *
+     * @return 实例对象
+     */
+    List<CustomerProduct> queryAll();
+
+}
+

+ 24 - 0
modules/distribution/src/main/java/com/fire/dist/mapper/FlowAppInfoMapper.java

@@ -0,0 +1,24 @@
+package com.fire.dist.mapper;
+
+import com.fire.dto.FlowAppInfo;
+
+import java.util.List;
+
+/**
+ * 客户接入表(FlowAppInfo)表数据库访问层
+ *
+ * @author ZJQ  2021-05-17 14:08:29
+ */
+public interface FlowAppInfoMapper {
+
+    /**
+     * 查询所有接入信息
+     *
+     * @return 实例对象list
+     */
+    List<FlowAppInfo> queryAll();
+
+
+
+}
+

+ 39 - 0
modules/distribution/src/main/java/com/fire/dist/priority/RedisPriorityQueue.java

@@ -0,0 +1,39 @@
+package com.fire.dist.priority;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+import redis.clients.jedis.JedisCluster;
+
+import javax.annotation.Resource;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import static com.fire.dto.enums.RedisKey.PRIORITY_QUEUE;
+
+
+/**
+ * 消息消费者,可与生产者分离
+ * 这里定义的messageMode是集群消费,如果是同一消费组则会组内消费者均衡消费;
+ * 如果是不同消费组,则会起到广播消费的效果
+ *
+ * @author ZJQ 2021年5月27日14:59:42
+ */
+
+@Slf4j
+@Component
+public class RedisPriorityQueue {
+
+    private AtomicInteger offset = new AtomicInteger(0);
+
+    @Resource
+    private JedisCluster jedisCluster;
+
+    public void push(long score, String body) {
+        jedisCluster.zadd(PRIORITY_QUEUE.key(), score, body);
+    }
+
+    public Set<String> consumer() {
+        return jedisCluster.zrange(PRIORITY_QUEUE.key(), -1, -1);
+    }
+
+}

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

@@ -0,0 +1,18 @@
+package com.fire.dist.service;
+
+
+/**
+ * 客户服务层
+ *
+ * @author ZJQ 2021年5月17日15:51:14
+ */
+public interface CacheService {
+
+    /**
+     * 缓存客户信息
+     */
+    void cacheCustomer();
+
+
+
+}

+ 20 - 0
modules/distribution/src/main/java/com/fire/dist/service/DistOrderService.java

@@ -0,0 +1,20 @@
+package com.fire.dist.service;
+
+
+import com.fire.dto.FlowOrderInfo;
+
+/**
+ * 分发主要逻辑
+ *
+ * @author ZJQ 2021年5月31日17:13:54
+ */
+public interface DistOrderService {
+
+    /**
+     * 分发方法
+     *
+     * @param orderInfo 订单
+     */
+    void distOrder(FlowOrderInfo orderInfo);
+
+}

+ 75 - 0
modules/distribution/src/main/java/com/fire/dist/service/impl/CacheServiceImpl.java

@@ -0,0 +1,75 @@
+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.service.CacheService;
+import com.fire.dto.CustomerInfo;
+import com.fire.dto.CustomerProduct;
+import com.fire.dto.FlowAppInfo;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * 客户服务实现层
+ *
+ * @author ZJQ 2021年5月14日17:13:54
+ */
+@Service
+public class CacheServiceImpl implements CacheService {
+
+    @Resource
+    private FlowAppInfoMapper flowAppInfoMapper;
+
+    @Resource
+    private CustomerInfoMapper customerInfoMapper;
+
+    @Resource
+    private CustomerProductMapper customerProductMapper;
+
+
+    /**
+     * 缓存客户信息
+     */
+    @Override
+    public void cacheCustomer() {
+        //查询所有的客户信息和所有的接入信息
+        List<FlowAppInfo> appInfos = flowAppInfoMapper.queryAll();
+        List<CustomerInfo> customerInfos = customerInfoMapper.queryAll();
+        List<CustomerProduct> products = customerProductMapper.queryAll();
+
+        if (CollectionUtils.isNotEmpty(appInfos) && CollectionUtils.isNotEmpty(customerInfos) && CollectionUtils.isNotEmpty(products)) {
+            //将客户信息List 转换为客户id为key的map 如果存在重复key,以后出现的为准
+            Map<Long, CustomerInfo> customerInfoMap = customerInfos.stream().collect(Collectors.toMap(CustomerInfo::getCustomerId, a -> a, (k1, k2) -> k2));
+            //根据客户id进行分组
+            Map<Long, List<CustomerProduct>> longListMap = products.stream().collect(Collectors.groupingBy(CustomerProduct::getCustomerId));
+            //遍历接入信息
+            for (FlowAppInfo appInfo : appInfos) {
+                if (appInfo != null && appInfo.getCustomerId() != null) {
+                    CustomerInfo customerInfo = customerInfoMap.get(appInfo.getCustomerId());
+                    //将对应客户信息放入接入信息中
+                    appInfo.setCustomerInfo(customerInfo);
+                    List<CustomerProduct> customerProducts = longListMap.get(appInfo.getCustomerId());
+                    if (customerProducts != null) {
+                        //将客户产品放入接入信息中
+                        Map<String, CustomerProduct> productMap = customerProducts.stream().collect(Collectors.toMap(CustomerProduct::getPackageId, a -> a, (k1, k2) -> k2));
+                        appInfo.setProductMap(productMap);
+                    }
+                }
+            }
+            //将接入信息list 转换为appId为key的map 如果存在重复key,以后出现的为准
+            DataPool.flowAppInfoMap = appInfos.stream().collect(Collectors.toMap(FlowAppInfo::getAppId, a -> a, (k1, k2) -> k2));
+        }
+
+
+    }
+
+
+}

+ 59 - 0
modules/distribution/src/main/java/com/fire/dist/service/impl/DistOrderServiceImpl.java

@@ -0,0 +1,59 @@
+package com.fire.dist.service.impl;
+
+
+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 lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+
+import static com.fire.dto.enums.ValidStatus.SUSPEND;
+
+/**
+ * 分发主要逻辑实现
+ *
+ * @author ZJQ 2021年5月31日17:13:54
+ */
+@Service
+@Slf4j
+public class DistOrderServiceImpl implements DistOrderService {
+
+    @Override
+    public void distOrder(FlowOrderInfo orderInfo) {
+        //appId是否存在
+        FlowAppInfo flowAppInfo = DataPool.flowAppInfoMap.get(orderInfo.getAppId());
+        if (flowAppInfo == null) {
+            log.error("客户信息为空,请检查缓存机制,本次订单号为:" + orderInfo.getOrderId());
+            return;
+        }
+        CustomerInfo customerInfo = flowAppInfo.getCustomerInfo();
+        if (customerInfo == null) {
+            log.error("客户信息为空,请检查缓存机制,本次订单号为:" + orderInfo.getOrderId());
+            return;
+        }
+        //客户是否暂停
+        if (SUSPEND.status().equals(customerInfo.getStatus())) {
+            //todo 放入待发送db
+            return;
+        }
+        //下单时间
+        Date applyDate = orderInfo.getApplyDate();
+        if (applyDate == null) {
+            log.error("订单下单时间为空,请检查系统bug,订单号为:" + orderInfo.getOrderId());
+            return;
+        }
+        int timeOut = flowAppInfo.getTime() * 1000;
+        long now = System.currentTimeMillis();
+        if (now - applyDate.getTime() > timeOut) {
+            //todo 超时回调
+            return;
+        }
+        //todo 取分发记录
+
+    }
+
+}

+ 43 - 0
modules/distribution/src/main/java/com/fire/dist/task/CacheCustomerTask.java

@@ -0,0 +1,43 @@
+package com.fire.dist.task;
+
+import com.fire.dist.service.CacheService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+
+/**
+ * 缓存任务
+ *
+ * @author ZJQ 2021年5月31日13:41:01
+ */
+@Component
+@Slf4j
+public class CacheCustomerTask {
+    @Resource
+    private CacheService cacheService;
+
+    /**
+     * 每天凌晨2时5分0秒定时缓存客户信息
+     */
+    @Async
+    @Scheduled(cron = "0 5 2 * * ?")
+    public void cacheCustomer() {
+        cacheService.cacheCustomer();
+    }
+
+    /**
+     * spring启动时执行缓存初始化客户信息
+     */
+    @Async
+    @PostConstruct
+    public void initCustomer() {
+        cacheService.cacheCustomer();
+        log.info("spring启动时执行缓存初始化客户信息");
+    }
+
+
+}

+ 22 - 0
modules/distribution/src/main/resources/bootstrap.yml

@@ -3,6 +3,13 @@ server:
 spring:
   application:
     name: distribution
+  profiles:
+    active: dev
+---
+spring:
+  config:
+    activate:
+      on-profile: dev
   cloud:
     nacos:
       config:
@@ -13,3 +20,18 @@ spring:
         server-addr: 192.168.2.114:8848
         namespace: fire
         service: distribution
+---
+spring:
+  config:
+    activate:
+      on-profile: test
+  cloud:
+    nacos:
+      config:
+        server-addr: 192.168.2.114:8848
+        file-extension: yaml
+        namespace: fire
+      discovery:
+        server-addr: 192.168.2.114:8848
+        namespace: fire
+        service: distribution

+ 48 - 0
modules/distribution/src/main/resources/mapper/CustomerProductMapper.xml

@@ -0,0 +1,48 @@
+<?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.CustomerProductMapper">
+
+    <resultMap type="com.fire.dto.CustomerProduct" id="CustomerProductMap">
+        <result property="customerProductId" column="customer_product_id" jdbcType="INTEGER"/>
+        <result property="customerId" column="customer_id" jdbcType="INTEGER"/>
+        <result property="productId" column="product_id" jdbcType="INTEGER"/>
+        <result property="packageId" column="package_id" jdbcType="VARCHAR"/>
+        <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="areaName" column="area_name" jdbcType="VARCHAR"/>
+        <result property="operator" column="operator" jdbcType="INTEGER"/>
+        <result property="areaNum" column="area_num" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <!--查询单个-->
+    <select id="queryAll" resultMap="CustomerProductMap">
+        select a.customer_product_id,
+               a.customer_id,
+               a.package_id,
+               a.type,
+               a.price,
+               a.face_price,
+               a.is_valid,
+               b.area_name,
+               b.operator,
+               b.area_num,
+               b.product_id
+        from customer_product a
+                 left join flow_product_info b on a.package_id = b.package_id
+    </select>
+
+    <sql id="baseSql">
+        select a.customer_product_id,
+               a.customer_id,
+               a.package_id,
+               a.type,
+               a.price,
+               a.face_price,
+               a.is_valid
+        from customer_product a
+    </sql>
+
+</mapper>
+

+ 43 - 0
modules/distribution/src/main/resources/mapper/FlowAppInfoMapper.xml

@@ -0,0 +1,43 @@
+<?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.FlowAppInfoMapper">
+
+    <resultMap type="com.fire.dto.FlowAppInfo" id="FlowAppInfoMap">
+        <result property="flowAppId" column="flow_app_id" jdbcType="INTEGER"/>
+        <result property="customerId" column="customer_id" jdbcType="INTEGER"/>
+        <result property="appId" column="app_id" jdbcType="VARCHAR"/>
+        <result property="appKey" column="app_key" jdbcType="VARCHAR"/>
+        <result property="startDate" column="start_date" jdbcType="TIMESTAMP"/>
+        <result property="endDate" column="end_date" jdbcType="TIMESTAMP"/>
+        <result property="status" column="status" jdbcType="INTEGER"/>
+        <result property="appName" column="app_name" jdbcType="VARCHAR"/>
+        <result property="callbackUrl" column="callback_url" jdbcType="VARCHAR"/>
+        <result property="ipAddress" column="ip_address" jdbcType="VARCHAR"/>
+        <result property="dispatchChannel" column="dispatch_channel" jdbcType="VARCHAR"/>
+        <result property="totalCount" column="total_count" jdbcType="INTEGER"/>
+        <result property="time" column="time" jdbcType="INTEGER"/>
+    </resultMap>
+
+    <!--查询全部-->
+    <select id="queryAll" resultMap="FlowAppInfoMap">
+        <include refid="baseSql"/>
+    </select>
+
+    <sql id="baseSql">
+        select flow_app_id,
+               customer_id,
+               app_id,
+               app_key,
+               start_date,
+               end_date,
+               status,
+               app_name,
+               callback_url,
+               ip_address,
+               dispatch_channel,
+               total_count
+        from flow_app_info
+    </sql>
+
+</mapper>
+

+ 23 - 0
modules/make-order/src/main/resources/bootstrap.yml

@@ -3,6 +3,13 @@ server:
 spring:
   application:
     name: make-order
+  profiles:
+    active: dev
+---
+spring:
+  config:
+    activate:
+      on-profile: dev
   cloud:
     nacos:
       config:
@@ -13,3 +20,19 @@ spring:
         server-addr: 192.168.2.114:8848
         namespace: fire
         service: make-order
+---
+spring:
+  config:
+    activate:
+      on-profile: test
+  cloud:
+    nacos:
+      config:
+        server-addr: 47.106.133.48:8848
+        file-extension: yaml
+        namespace: fire
+      discovery:
+        server-addr: 47.106.133.48:8848
+        namespace: fire
+        service: make-order
+