admin
2019-10-29 634a8abd408e87e58b4b8e9f52ddf309b43652d0
修改配置文件
添加系统券返利到账订阅
4 文件已重命名
2个文件已修改
12 文件已复制
5个文件已添加
228 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/dto/order/OrderMoneyRecievedMQMsgDTO.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/rocketmq/consumer/coupon/SystemCouponMessageListener.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-dev/rocket/consumer.xml 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-dev/rocket/producer.xml 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-dev/rocket/system-coupon-consumer.xml 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-dev/rocket/transactionProducer.xml 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-dev/spring.xml 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-pro-by/rocket/consumer.xml 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-pro-by/rocket/producer.xml 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-pro-by/rocket/system-coupon-consumer.xml 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-pro-by/rocket/transactionProducer.xml 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-pro-by/spring.xml 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-pro-job/rocket/consumer.xml 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-pro-job/rocket/producer.xml 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-pro-job/rocket/system-coupon-consumer.xml 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-pro-job/rocket/transactionProducer.xml 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-pro-job/spring.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-pro/rocket/consumer.xml 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-pro/rocket/producer.xml 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-pro/rocket/system-coupon-consumer.xml 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-pro/rocket/transactionProducer.xml 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-pro/spring.xml 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dto/order/OrderMoneyRecievedMQMsgDTO.java
@@ -19,6 +19,15 @@
    private String orderId;// 订单号
    private BigDecimal money;// 到账金额
    private Date date;// 到账时间
    private Boolean orderFirst;// 该订单是否是首次到账
    public Boolean getOrderFirst() {
        return orderFirst;
    }
    public void setOrderFirst(Boolean orderFirst) {
        this.orderFirst = orderFirst;
    }
    public OrderMoneyRecievedMQMsgDTO() {
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java
@@ -391,10 +391,29 @@
                return;
        }
        // 查询该订单之前是否有到账
        List<HongBaoOrder> list = hongBaoOrderMapper.listByOrderIdAndSourceType(
                hongBaoOrder.getCommonOrder().getOrderNo(), hongBaoOrder.getCommonOrder().getSourceType());
        List<Long> hongBaoIdList = new ArrayList<>();
        if (list != null) {
            for (HongBaoOrder ho : list) {
                hongBaoIdList.add(ho.getHongBaoV2().getId());
            }
        }
        List<HongBaoV2> allHongBaoList = hongBaoV2Mapper.listByIds(hongBaoIdList);
        boolean first = true;
        for (HongBaoV2 v2 : allHongBaoList)
            if (v2.getState() == HongBaoV2.STATE_YILINGQU) {
                first = false;
                break;
            }
        // 自购到账事务消息
        OrderMoneyRecievedMQMsgDTO mqMsg = new OrderMoneyRecievedMQMsgDTO(OrderMoneyRecievedMQMsgDTO.TYPE_ZIGOU,
                mainUser.getId(), hongBaoOrder.getCommonOrder().getSourceType(),
                hongBaoOrder.getCommonOrder().getOrderNo(), null, new Date());
        mqMsg.setOrderFirst(first);
        Message msg = new Message(MQTopicName.TOPIC_FANLI.name(), "actual", new Gson().toJson(mqMsg).getBytes());
        String key = mainUser.getId() + "-" + UUID.randomUUID().toString();
        msg.setKey(key);
@@ -503,7 +522,7 @@
        } catch (OrderMoneySettleException e) {
            e.printStackTrace();
        }
        if(1>0)
        if (1 > 0)
            return;
        try {
@@ -1182,7 +1201,7 @@
        Message msg = new Message(MQTopicName.TOPIC_ORDER.name(),
                String.format(MQTagConstant.TAG_ORDER_STATISTIC_PREFIX + "%s-%s", sourceType, hongBaoType),
                new Gson().toJson(mqMsg).getBytes());
        SendResult result=    orderTransactionProducer.send(msg, new LocalTransactionExecuter() {
        SendResult result = orderTransactionProducer.send(msg, new LocalTransactionExecuter() {
            @Override
            public TransactionStatus execute(Message arg0, Object arg1) {
                int resultCode = 0;
@@ -1196,10 +1215,10 @@
                    }
                }
                return TransactionStatus.CommitTransaction;
//                if (resultCode != 0)
//                    return TransactionStatus.CommitTransaction;
//                else
//                    return TransactionStatus.RollbackTransaction;
                // if (resultCode != 0)
                // return TransactionStatus.CommitTransaction;
                // else
                // return TransactionStatus.RollbackTransaction;
            }
        }, null);
        System.out.println(result);
fanli/src/main/java/com/yeshi/fanli/util/rocketmq/consumer/coupon/SystemCouponMessageListener.java
New file
@@ -0,0 +1,36 @@
package com.yeshi.fanli.util.rocketmq.consumer.coupon;
import org.springframework.stereotype.Component;
import com.aliyun.openservices.ons.api.Action;
import com.aliyun.openservices.ons.api.ConsumeContext;
import com.aliyun.openservices.ons.api.Message;
import com.aliyun.openservices.ons.api.MessageListener;
import com.google.gson.Gson;
import com.yeshi.fanli.dto.order.OrderMoneyRecievedMQMsgDTO;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.util.rocketmq.MQTopicName;
@Component
public class SystemCouponMessageListener implements MessageListener {
    @Override
    public Action consume(Message message, ConsumeContext context) {
        LogHelper.mqInfo("consumer-SystemCouponMessageListener", message.getTopic(), message.getTag(),
                new String(message.getBody()));
        if (MQTopicName.TOPIC_FANLI.name().equalsIgnoreCase(message.getTopic())) {
            OrderMoneyRecievedMQMsgDTO orderMoneyRecievedMQMsgDTO = new Gson().fromJson(new String(message.getBody()),
                    OrderMoneyRecievedMQMsgDTO.class);
            if (orderMoneyRecievedMQMsgDTO != null) {
                if (orderMoneyRecievedMQMsgDTO.getOrderFirst() != null
                        && orderMoneyRecievedMQMsgDTO.getOrderFirst() == true) {
                    // 首次到账返利
                    // TODO 业务代码添加
                    // 业务代码执行成功后返回
                    return Action.CommitMessage;
                }
            }
        }
        return Action.CommitMessage;
    }
}
fanli/src/main/resource/env-dev/rocket/consumer.xml
fanli/src/main/resource/env-dev/rocket/producer.xml
fanli/src/main/resource/env-dev/rocket/system-coupon-consumer.xml
New file
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
    <bean id="systemCouponMessageListener"
        class="com.yeshi.fanli.util.rocketmq.consumer.coupon.SystemCouponMessageListener"></bean> <!--Listener 配置 -->
    <!-- Group ID 订阅同一个 Topic,可以创建多个 ConsumerBean -->
    <bean id="systemCouponConsumer" class="com.aliyun.openservices.ons.api.bean.ConsumerBean"
        init-method="start" destroy-method="shutdown">
        <property name="properties"> <!--消费者配置信息 -->
            <props>
                <prop key="AccessKey">LTAI4FwmTxVCuzTaoZtDiV8z</prop>
                <prop key="SecretKey">ixWg90QbYFKP6ae5xpAo2P1qwIyll5</prop>
                <prop key="GROUP_ID">GID_SYSTEM_COUPON</prop>
                <prop key="NAMESRV_ADDR">http://MQ_INST_1205444665315884_BbaMbxF4.mq-internet-access.mq-internet.aliyuncs.com:80
                </prop>
                <!--将消费者线程数固定为 50 个 <prop key="ConsumeThreadNums">50</prop> -->
            </props>
        </property>
        <property name="subscriptionTable">
            <map>
                <!-- 系统券相关的消息订阅 -->
                <!-- 订阅到账 -->
                <entry value-ref="systemCouponMessageListener">
                    <key>
                        <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
                            <property name="topic" value="TOPIC_FANLI" />
                            <property name="expression" value="actual" />
                        </bean>
                    </key>
                </entry>
            </map>
        </property>
    </bean>
</beans>
fanli/src/main/resource/env-dev/rocket/transactionProducer.xml
fanli/src/main/resource/env-dev/spring.xml
copy from fanli/src/main/resource/spring.xml copy to fanli/src/main/resource/env-dev/spring.xml
File was copied from fanli/src/main/resource/spring.xml
@@ -49,9 +49,12 @@
        </property>
    </bean>
    
    <!--
    <import resource="classpath:/rocket/consumer.xml"/>
    <import resource="classpath:/rocket/system-coupon-consumer.xml"/>
    <import resource="classpath:/rocket/producer.xml"/>
    <import resource="classpath:/rocket/transactionProducer.xml"/>
     -->
    <!--异步定义推荐方式 <task:executor id="executor" pool-size="15" /> <task:scheduler 
        id="scheduler" pool-size="30" /> <task:annotation-driven executor="executor" 
fanli/src/main/resource/env-pro-by/rocket/consumer.xml
copy from fanli/src/main/resource/rocket/consumer.xml copy to fanli/src/main/resource/env-pro-by/rocket/consumer.xml
fanli/src/main/resource/env-pro-by/rocket/producer.xml
copy from fanli/src/main/resource/rocket/producer.xml copy to fanli/src/main/resource/env-pro-by/rocket/producer.xml
fanli/src/main/resource/env-pro-by/rocket/system-coupon-consumer.xml
New file
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
    <bean id="systemCouponMessageListener"
        class="com.yeshi.fanli.util.rocketmq.consumer.coupon.SystemCouponMessageListener"></bean> <!--Listener 配置 -->
    <!-- Group ID 订阅同一个 Topic,可以创建多个 ConsumerBean -->
    <bean id="systemCouponConsumer" class="com.aliyun.openservices.ons.api.bean.ConsumerBean"
        init-method="start" destroy-method="shutdown">
        <property name="properties"> <!--消费者配置信息 -->
            <props>
                <prop key="AccessKey">LTAI4FwmTxVCuzTaoZtDiV8z</prop>
                <prop key="SecretKey">ixWg90QbYFKP6ae5xpAo2P1qwIyll5</prop>
                <prop key="GROUP_ID">GID_SYSTEM_COUPON</prop>
                <prop key="NAMESRV_ADDR">http://MQ_INST_1205444665315884_BbaMbxF4.mq-internet-access.mq-internet.aliyuncs.com:80
                </prop>
                <!--将消费者线程数固定为 50 个 <prop key="ConsumeThreadNums">50</prop> -->
            </props>
        </property>
        <property name="subscriptionTable">
            <map>
                <!-- 系统券相关的消息订阅 -->
                <!-- 订阅到账 -->
                <entry value-ref="systemCouponMessageListener">
                    <key>
                        <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
                            <property name="topic" value="TOPIC_FANLI" />
                            <property name="expression" value="actual" />
                        </bean>
                    </key>
                </entry>
            </map>
        </property>
    </bean>
</beans>
fanli/src/main/resource/env-pro-by/rocket/transactionProducer.xml
copy from fanli/src/main/resource/rocket/transactionProducer.xml copy to fanli/src/main/resource/env-pro-by/rocket/transactionProducer.xml
fanli/src/main/resource/env-pro-by/spring.xml
File was renamed from fanli/src/main/resource/spring.xml
@@ -48,8 +48,10 @@
            </array>
        </property>
    </bean>
    <!--
    <import resource="classpath:/rocket/consumer.xml"/>
    <import resource="classpath:/rocket/system-coupon-consumer.xml"/>
     -->
    <import resource="classpath:/rocket/producer.xml"/>
    <import resource="classpath:/rocket/transactionProducer.xml"/>
fanli/src/main/resource/env-pro-job/rocket/consumer.xml
copy from fanli/src/main/resource/rocket/consumer.xml copy to fanli/src/main/resource/env-pro-job/rocket/consumer.xml
fanli/src/main/resource/env-pro-job/rocket/producer.xml
copy from fanli/src/main/resource/rocket/producer.xml copy to fanli/src/main/resource/env-pro-job/rocket/producer.xml
fanli/src/main/resource/env-pro-job/rocket/system-coupon-consumer.xml
New file
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
    <bean id="systemCouponMessageListener"
        class="com.yeshi.fanli.util.rocketmq.consumer.coupon.SystemCouponMessageListener"></bean> <!--Listener 配置 -->
    <!-- Group ID 订阅同一个 Topic,可以创建多个 ConsumerBean -->
    <bean id="systemCouponConsumer" class="com.aliyun.openservices.ons.api.bean.ConsumerBean"
        init-method="start" destroy-method="shutdown">
        <property name="properties"> <!--消费者配置信息 -->
            <props>
                <prop key="AccessKey">LTAI4FwmTxVCuzTaoZtDiV8z</prop>
                <prop key="SecretKey">ixWg90QbYFKP6ae5xpAo2P1qwIyll5</prop>
                <prop key="GROUP_ID">GID_SYSTEM_COUPON</prop>
                <prop key="NAMESRV_ADDR">http://MQ_INST_1205444665315884_BbaMbxF4.mq-internet-access.mq-internet.aliyuncs.com:80
                </prop>
                <!--将消费者线程数固定为 50 个 <prop key="ConsumeThreadNums">50</prop> -->
            </props>
        </property>
        <property name="subscriptionTable">
            <map>
                <!-- 系统券相关的消息订阅 -->
                <!-- 订阅到账 -->
                <entry value-ref="systemCouponMessageListener">
                    <key>
                        <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
                            <property name="topic" value="TOPIC_FANLI" />
                            <property name="expression" value="actual" />
                        </bean>
                    </key>
                </entry>
            </map>
        </property>
    </bean>
</beans>
fanli/src/main/resource/env-pro-job/rocket/transactionProducer.xml
copy from fanli/src/main/resource/rocket/transactionProducer.xml copy to fanli/src/main/resource/env-pro-job/rocket/transactionProducer.xml
fanli/src/main/resource/env-pro-job/spring.xml
copy from fanli/src/main/resource/spring.xml copy to fanli/src/main/resource/env-pro-job/spring.xml
File was copied from fanli/src/main/resource/spring.xml
@@ -50,6 +50,7 @@
    </bean>
    
    <import resource="classpath:/rocket/consumer.xml"/>
    <import resource="classpath:/rocket/system-coupon-consumer.xml"/>
    <import resource="classpath:/rocket/producer.xml"/>
    <import resource="classpath:/rocket/transactionProducer.xml"/>
fanli/src/main/resource/env-pro/rocket/consumer.xml
copy from fanli/src/main/resource/rocket/consumer.xml copy to fanli/src/main/resource/env-pro/rocket/consumer.xml
fanli/src/main/resource/env-pro/rocket/producer.xml
copy from fanli/src/main/resource/rocket/producer.xml copy to fanli/src/main/resource/env-pro/rocket/producer.xml
fanli/src/main/resource/env-pro/rocket/system-coupon-consumer.xml
New file
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
    <bean id="systemCouponMessageListener"
        class="com.yeshi.fanli.util.rocketmq.consumer.coupon.SystemCouponMessageListener"></bean> <!--Listener 配置 -->
    <!-- Group ID 订阅同一个 Topic,可以创建多个 ConsumerBean -->
    <bean id="systemCouponConsumer" class="com.aliyun.openservices.ons.api.bean.ConsumerBean"
        init-method="start" destroy-method="shutdown">
        <property name="properties"> <!--消费者配置信息 -->
            <props>
                <prop key="AccessKey">LTAI4FwmTxVCuzTaoZtDiV8z</prop>
                <prop key="SecretKey">ixWg90QbYFKP6ae5xpAo2P1qwIyll5</prop>
                <prop key="GROUP_ID">GID_SYSTEM_COUPON</prop>
                <prop key="NAMESRV_ADDR">http://MQ_INST_1205444665315884_BbaMbxF4.mq-internet-access.mq-internet.aliyuncs.com:80
                </prop>
                <!--将消费者线程数固定为 50 个 <prop key="ConsumeThreadNums">50</prop> -->
            </props>
        </property>
        <property name="subscriptionTable">
            <map>
                <!-- 系统券相关的消息订阅 -->
                <!-- 订阅到账 -->
                <entry value-ref="systemCouponMessageListener">
                    <key>
                        <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
                            <property name="topic" value="TOPIC_FANLI" />
                            <property name="expression" value="actual" />
                        </bean>
                    </key>
                </entry>
            </map>
        </property>
    </bean>
</beans>
fanli/src/main/resource/env-pro/rocket/transactionProducer.xml
copy from fanli/src/main/resource/rocket/transactionProducer.xml copy to fanli/src/main/resource/env-pro/rocket/transactionProducer.xml
fanli/src/main/resource/env-pro/spring.xml
copy from fanli/src/main/resource/spring.xml copy to fanli/src/main/resource/env-pro/spring.xml
File was copied from fanli/src/main/resource/spring.xml
@@ -48,8 +48,10 @@
            </array>
        </property>
    </bean>
    <!--
    <import resource="classpath:/rocket/consumer.xml"/>
    <import resource="classpath:/rocket/system-coupon-consumer.xml"/>
     -->
    <import resource="classpath:/rocket/producer.xml"/>
    <import resource="classpath:/rocket/transactionProducer.xml"/>