| | |
| | | package com.yeshi.fanli.util.rocketmq.consumer.integral;
|
| | |
|
| | | 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.mq.order.OrderTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.order.body.OrderMoneyRecievedMQMsg;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | | /**
|
| | | * 金币消息监听
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Component
|
| | | public class IntegralMessageListener implements MessageListener {
|
| | | public IntegralMessageListener() {
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Action consume(Message message, ConsumeContext context) {
|
| | |
|
| | | LogHelper.mqInfo("consumer:IntegralMessageListener", message.getMsgID(), message.getTopic(), message.getTag(),
|
| | | new String(message.getBody()));
|
| | | String tag = message.getTag();
|
| | |
|
| | | if (MQTopicName.TOPIC_ORDER.name().equalsIgnoreCase(message.getTopic())) {
|
| | | if (OrderTopicTagEnum.orderFanLiActual.name().equalsIgnoreCase(tag)) {// 实时到账
|
| | | OrderMoneyRecievedMQMsg msg = new Gson().fromJson(new String(message.getBody()),
|
| | | OrderMoneyRecievedMQMsg.class);
|
| | | if (msg != null && msg.getType() == OrderMoneyRecievedMQMsg.TYPE_ZIGOU) {// 自购到账
|
| | | // 得金币
|
| | | } else if (msg != null && msg.getType() == OrderMoneyRecievedMQMsg.TYPE_SHARE) {// 分享订单
|
| | |
|
| | | } else if (msg != null && msg.getType() == OrderMoneyRecievedMQMsg.TYPE_INVITE) {// 邀请订单
|
| | |
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | }
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | }
|
| | |
|
| | | }
|
| | | package com.yeshi.fanli.util.rocketmq.consumer.integral; |
| | | |
| | | 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.mq.order.OrderTopicTagEnum; |
| | | import com.yeshi.fanli.dto.mq.order.body.OrderMoneyRecievedMQMsg; |
| | | import com.yeshi.fanli.log.LogHelper; |
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName; |
| | | |
| | | /** |
| | | * 金币消息监听 |
| | | * |
| | | * @author Administrator |
| | | * |
| | | */ |
| | | @Component |
| | | public class IntegralMessageListener implements MessageListener { |
| | | public IntegralMessageListener() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public Action consume(Message message, ConsumeContext context) { |
| | | |
| | | LogHelper.mqInfo("consumer:IntegralMessageListener", message.getMsgID(), message.getTopic(), message.getTag(), |
| | | new String(message.getBody())); |
| | | String tag = message.getTag(); |
| | | |
| | | if (MQTopicName.TOPIC_ORDER.name().equalsIgnoreCase(message.getTopic())) { |
| | | if (OrderTopicTagEnum.orderFanLiActual.name().equalsIgnoreCase(tag)) {// 实时到账 |
| | | OrderMoneyRecievedMQMsg msg = new Gson().fromJson(new String(message.getBody()), |
| | | OrderMoneyRecievedMQMsg.class); |
| | | if (msg != null && msg.getType() == OrderMoneyRecievedMQMsg.TYPE_ZIGOU) {// 自购到账 |
| | | // 得金币 |
| | | } else if (msg != null && msg.getType() == OrderMoneyRecievedMQMsg.TYPE_SHARE) {// 分享订单 |
| | | |
| | | } else if (msg != null && msg.getType() == OrderMoneyRecievedMQMsg.TYPE_INVITE) {// 邀请订单 |
| | | |
| | | } |
| | | return Action.CommitMessage; |
| | | } |
| | | } |
| | | return Action.CommitMessage; |
| | | } |
| | | |
| | | } |