Parcourir la source

bug修改 更改产品主键引起的其他问题修改

张均强 il y a 4 ans
Parent
commit
696ea5578a

+ 52 - 0
modules/distribution/src/main/java/com/fire/dist/consumer/RocketOrderConsumer.java

@@ -0,0 +1,52 @@
+package com.fire.dist.consumer;
+
+import com.fire.common.exception.BaseException;
+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.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 static com.fire.common.constants.RocketTopic.ORDER_TOPIC;
+import static org.apache.rocketmq.spring.annotation.ConsumeMode.ORDERLY;
+
+
+/**
+ * 消息消费者,可与生产者分离
+ * 这里定义的messageMode是集群消费,如果是同一消费组则会组内消费者均衡消费;
+ * 如果是不同消费组,则会起到广播消费的效果
+ *
+ * @author ZJQ 2021年5月27日14:59:42
+ */
+
+@Slf4j
+@Component
+@RefreshScope
+@RocketMQMessageListener(consumerGroup = "${rocketmq.consumer.group}", topic = ORDER_TOPIC, consumeMode = ORDERLY)
+public class RocketOrderConsumer implements RocketMQListener<MessageExt> {
+
+    @Value("${sleep.consume}")
+    private Boolean sleepConsume;
+
+    @Override
+    public void onMessage(MessageExt msg) {
+        if (sleepConsume) {
+            try {
+                Thread.sleep(60000);
+            } catch (InterruptedException e) {
+                log.info("线程sleep失败");
+            }
+            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);
+    }
+
+}

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

@@ -0,0 +1,22 @@
+package com.fire.dist.mapper;
+
+import com.fire.dto.CustomerInfo;
+
+import java.util.List;
+
+/**
+ * 客户表(CustomerInfo)表数据库访问层
+ *
+ * @author ZJQ  2021-05-17 13:40:04
+ */
+public interface CustomerInfoMapper {
+
+    /**
+     * 查询所有客户
+     *
+     * @return CustomerInfo对象list
+     */
+    List<CustomerInfo> queryAll();
+
+}
+

+ 1 - 1
modules/distribution/src/main/resources/bootstrap.yml

@@ -12,4 +12,4 @@ spring:
       discovery:
         server-addr: 192.168.2.114:8848
         namespace: fire
-        service: make-order
+        service: distribution

+ 52 - 0
modules/distribution/src/main/resources/mapper/CustomerInfoMapper.xml

@@ -0,0 +1,52 @@
+<?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.CustomerInfoMapper">
+
+    <resultMap type="com.fire.dto.CustomerInfo" id="CustomerInfoMap">
+        <result property="customerId" column="customer_id" jdbcType="BIGINT"/>
+        <result property="partnerId" column="partner_id" jdbcType="INTEGER"/>
+        <result property="customerName" column="customer_name" jdbcType="VARCHAR"/>
+        <result property="shorterName" column="shorter_name" jdbcType="VARCHAR"/>
+        <result property="linkmanName" column="linkman_name" jdbcType="VARCHAR"/>
+        <result property="linkmanMobile" column="linkman_mobile" jdbcType="VARCHAR"/>
+        <result property="linkmanEmail" column="linkman_email" jdbcType="VARCHAR"/>
+        <result property="address" column="address" jdbcType="VARCHAR"/>
+        <result property="status" column="status" jdbcType="INTEGER"/>
+        <result property="balance" column="balance" jdbcType="BIGINT"/>
+        <result property="creditAmount" column="credit_amount" jdbcType="BIGINT"/>
+        <result property="currentAmount" column="current_amount" jdbcType="BIGINT"/>
+        <result property="isFirstLogin" column="is_first_login" jdbcType="INTEGER"/>
+        <result property="isDeleted" column="is_deleted" 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="partnerCommission" column="partner_commission"/>
+        <result property="userId" column="user_id" jdbcType="BIGINT"/>
+        <result property="priceCheck" column="price_check" jdbcType="INTEGER"/>
+    </resultMap>
+
+    <!--查询全部-->
+    <select id="queryAll" resultMap="CustomerInfoMap">
+        <include refid="baseSql"/>
+    </select>
+
+    <sql id="baseSql">
+        select customer_id,
+               partner_id,
+               customer_name,
+               shorter_name,
+               linkman_name,
+               status,
+               balance,
+               credit_amount,
+               current_amount,
+               is_deleted,
+               partner_commission,
+               user_id,
+               price_check
+        from customer_info
+    </sql>
+
+</mapper>
+

+ 1 - 1
modules/make-order/src/main/java/com/fire/order/consumer/RocketUpdateConsumer.java

@@ -24,7 +24,7 @@ import static com.fire.common.constants.RocketTopic.UPDATE_TOPIC;
 
 @Slf4j
 @Component
-@RocketMQMessageListener(consumerGroup = "${rocketmq.consumer.group}", topic = UPDATE_TOPIC,consumeTimeout  = 3000)
+@RocketMQMessageListener(consumerGroup = "${rocketmq.consumer.group}", topic = UPDATE_TOPIC)
 public class RocketUpdateConsumer implements RocketMQListener<MessageExt> {
 
     @Resource

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

@@ -328,7 +328,6 @@ public class MakeOrderServiceImpl implements MakeOrderService {
         order.setAreaCode(product.getAreaNum());
         order.setPrice(product.getPrice());
         order.setCustomerProductId(product.getCustomerProductId());
-        order.setProductId(product.getProductId());
         order.setPhoneOperator(product.getOperator());
         order.setPhoneCity(phoneZone.getAreaCode());
         order.setAppId(appId);

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

@@ -5,7 +5,6 @@
     <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"/>
@@ -20,7 +19,6 @@
     <select id="queryAll" resultMap="CustomerProductMap">
         select a.customer_product_id,
                a.customer_id,
-               a.product_id,
                a.package_id,
                a.type,
                a.price,
@@ -36,7 +34,6 @@
     <sql id="baseSql">
         select a.customer_product_id,
                a.customer_id,
-               a.product_id,
                a.package_id,
                a.type,
                a.price,

+ 2 - 2
modules/make-order/src/main/resources/mapper/FlowOrderInfoMapper.xml

@@ -50,14 +50,14 @@
         insert into flow_order_info(order_id, flow_app_id, package_id, customer_id, order_type, customer_name, phone_no,
                                     extorder_id, rec_id, apply_date, active_date, limited_date, status, note,
                                     gw_seq_no, gw_status, last_modify_date, gw_error_code, flow_amount,
-                                    adapter_name, usage_limit, batch_count, send_count, area_code, price,
+                                    usage_limit, batch_count, send_count, area_code, price,
                                     partner_balance_price, operator_balance_price, customer_product_id, channel_id,
                                     callback_time, product_id, attr1, attr2, attr3, channel_name, app_id,
                                     channel_product_id, callback_status, phone_operator, phone_city)
         values (#{orderId}, #{flowAppId}, #{packageId}, #{customerId}, #{orderType}, #{customerName}, #{phoneNo},
                 #{extorderId},
                 #{recId}, #{applyDate}, #{activeDate}, #{limitedDate}, #{status}, #{note}, #{gwSeqNo}, #{gwStatus},
-                #{lastModifyDate}, #{gwErrorCode}, #{flowAmount}, #{adapterName}, #{usageLimit}, #{batchCount},
+                #{lastModifyDate}, #{gwErrorCode}, #{flowAmount}, #{usageLimit}, #{batchCount},
                 #{sendCount}, #{areaCode}, #{price}, #{partnerBalancePrice}, #{operatorBalancePrice},
                 #{customerProductId}, #{channelId}, #{callbackTime}, #{productId}, #{attr1}, #{attr2}, #{attr3},
                 #{channelName}, #{appId}, #{channelProductId}, #{callbackStatus}, #{phoneOperator}, #{phoneCity})

+ 1 - 7
modules/make-order/src/main/resources/mapper/FlowProductInfoMapper.xml

@@ -3,13 +3,10 @@
 <mapper namespace="com.fire.order.mapper.FlowProductInfoMapper">
 
     <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"/>
         <result property="productName" column="product_name" jdbcType="VARCHAR"/>
         <result property="productType" column="product_type" jdbcType="INTEGER"/>
         <result property="productPrice" column="product_price" jdbcType="NUMERIC"/>
-        <result property="productDesc" column="product_desc" jdbcType="VARCHAR"/>
         <result property="creator" column="creator" jdbcType="VARCHAR"/>
         <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
         <result property="updator" column="updator" jdbcType="VARCHAR"/>
@@ -24,13 +21,10 @@
     </select>
 
     <sql id="baseSql">
-        select product_id,
-               package_id,
-               product_code,
+        select package_id,
                product_name,
                product_type,
                product_price,
-               product_desc,
                creator,
                create_time,
                updator,