From f4a0f2acc63d7785eab108419a4e16f5f688cb95 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期六, 18 一月 2020 12:06:27 +0800
Subject: [PATCH] 用户注册信息

---
 fanli/src/main/java/com/yeshi/fanli/util/rocketmq/consumer/coupon/SystemCouponMessageListener.java |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/util/rocketmq/consumer/coupon/SystemCouponMessageListener.java b/fanli/src/main/java/com/yeshi/fanli/util/rocketmq/consumer/coupon/SystemCouponMessageListener.java
index d671aac..88f3e52 100644
--- a/fanli/src/main/java/com/yeshi/fanli/util/rocketmq/consumer/coupon/SystemCouponMessageListener.java
+++ b/fanli/src/main/java/com/yeshi/fanli/util/rocketmq/consumer/coupon/SystemCouponMessageListener.java
@@ -12,9 +12,10 @@
 import com.yeshi.fanli.dto.mq.BaseMQMsgBody;
 import com.yeshi.fanli.dto.mq.order.OrderTopicTagEnum;
 import com.yeshi.fanli.dto.mq.order.body.OrderMoneyRecievedMQMsg;
+import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
+import com.yeshi.fanli.dto.mq.user.body.UserSystemCouponUseMQMsg;
 import com.yeshi.fanli.log.LogHelper;
 import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
-import com.yeshi.fanli.util.Constant;
 import com.yeshi.fanli.util.rocketmq.MQTopicName;
 
 @Component
@@ -29,8 +30,6 @@
 				message.getTag(), new String(message.getBody()));
 		String tag = message.getTag();
 		BaseMQMsgBody baseBody = new Gson().fromJson(new String(message.getBody()), BaseMQMsgBody.class);
-		if (baseBody.isTest() != Constant.IS_TEST)
-			return Action.ReconsumeLater;
 
 		if (MQTopicName.TOPIC_ORDER.name().equalsIgnoreCase(message.getTopic())) {
 			if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderFanLiActual.name()))// 瀹炴椂鍒拌处
@@ -41,16 +40,26 @@
 					if (orderMoneyRecievedMQMsgDTO.getOrderFirst() != null
 							&& orderMoneyRecievedMQMsgDTO.getOrderFirst() == true) {
 						// 棣栨鍒拌处杩斿埄
-						// TODO 涓氬姟浠g爜娣诲姞
-
+						
 						// 婵�娲诲厤鍗曞埜
-						userSystemCouponService.triggerFreeCouponActivate(orderMoneyRecievedMQMsgDTO.getUid());
+						userSystemCouponService.triggerFreeCouponActivate(orderMoneyRecievedMQMsgDTO.getUid(),
+								orderMoneyRecievedMQMsgDTO.getOrderId(), orderMoneyRecievedMQMsgDTO.getSourceType());
 
 						// 涓氬姟浠g爜鎵ц鎴愬姛鍚庤繑鍥�
 						return Action.CommitMessage;
 					}
 				}
 			}
+		} else if (MQTopicName.TOPIC_USER.name().equalsIgnoreCase(message.getTopic())) {
+			if (UserTopicTagEnum.systemCouponDrawback.name().equalsIgnoreCase(tag)) {// 鍒搁��鍥�
+				UserSystemCouponUseMQMsg userSystemCouponUseMQMsg = new Gson().fromJson(new String(message.getBody()),
+						UserSystemCouponUseMQMsg.class);
+				//澶勭悊鍒搁��鍥�
+				userSystemCouponService.sendBackByGiveId(userSystemCouponUseMQMsg.getUserSystemCouponId());
+				
+				// 涓氬姟浠g爜鎵ц鎴愬姛鍚庤繑鍥�
+				return Action.CommitMessage;
+			}
 		}
 		return Action.CommitMessage;
 	}

--
Gitblit v1.8.0