From cd637932a970e7935b17d41568fe89c92775bccc Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期五, 06 十二月 2019 17:18:27 +0800
Subject: [PATCH] 双12活动添加,邀请码发布修改,爬单新规则添加

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java |   40 +++++++++++++++++++++++-----------------
 1 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java
index 9ae2f27..c20246d 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java
@@ -26,7 +26,6 @@
 import com.aliyun.openservices.ons.api.transaction.LocalTransactionExecuter;
 import com.aliyun.openservices.ons.api.transaction.TransactionProducer;
 import com.aliyun.openservices.ons.api.transaction.TransactionStatus;
-import com.google.gson.Gson;
 import com.yeshi.fanli.dao.mybatis.user.UserSystemCouponMapper;
 import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
 import com.yeshi.fanli.dto.mq.user.body.UserSystemCouponUseMQMsg;
@@ -75,6 +74,7 @@
 import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService;
 import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
 import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
+import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
 import com.yeshi.fanli.util.Constant;
 import com.yeshi.fanli.util.MoneyBigDecimalUtil;
 import com.yeshi.fanli.util.RedisManager;
@@ -84,6 +84,7 @@
 import com.yeshi.fanli.util.annotation.RequestSerializableByKeyService;
 import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
 import com.yeshi.fanli.util.factory.msg.MsgOtherSystemGiveDTOFactory;
+import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
 import com.yeshi.fanli.util.rocketmq.MQTopicName;
 import com.yeshi.fanli.util.taobao.TaoBaoUtil;
 import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
@@ -178,6 +179,9 @@
 	
 	@Resource(name = "producer")
 	private Producer producer;
+	
+	@Resource
+	private UserVIPInfoService userVIPInfoService;
 
 	
 
@@ -896,8 +900,8 @@
 			UserSystemCouponUseMQMsg mqMsg = new UserSystemCouponUseMQMsg(userSystemCoupon.getId(), order.getOrderId(),
 					sourceType, systemCoupon.getType().name());
 			// 浜嬪姟娑堟伅
-			Message msg = new Message(MQTopicName.TOPIC_USER.name(), UserTopicTagEnum.useSystemCoupon.name(),
-					new Gson().toJson(mqMsg).getBytes());
+			Message msg =MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.useSystemCoupon,
+					mqMsg);
 			try {
 				SendResult result = orderTransactionProducer.send(msg, new LocalTransactionExecuter() {
 					@Override
@@ -1876,18 +1880,20 @@
 					jumpBtn.put("params", jumpLink);
 					jumpBtn.put("jumpDetail", jumpDetailV2Service.getByTypeCache("web"));
 				} else if (CouponTypeEnum.rebatePercentCoupon == type) {
-					// 鍙娇鐢ㄣ�� 鍙禒閫�
-					userCouponVO.setState(UserSystemCoupon.STATE_USE_GIVE);
-
-					// 璁㈠崟鍒楄〃
-					jumpLink.put("state", "2"); // 宸叉敹璐�
-					jumpLink.put("showNav", false); // 涓嶆樉绀轰笂鏂圭粺璁′俊鎭�
-					jumpLink.put("type", "1"); // 杩斿埄璁㈠崟
-					jumpLink.put("title", "杩斿埄璁㈠崟"); // 鏍囬鍚�
-					jumpLink.put("goodsType", "0"); // 璁㈠崟鏉ユ簮
-					jumpBtn = new HashMap<String, Object>();
-					jumpBtn.put("params", jumpLink);
-					jumpBtn.put("jumpDetail", jumpDetailV2Service.getByTypeCache("order_screen_list"));
+					if (userVIPInfoService.isVIP(uid)) { // 浼氬憳鍙彲璧犻��
+						userCouponVO.setState(UserSystemCoupon.STATE_GIVE_ONLY);
+					} else {// 鍙娇鐢� 鍙禒閫�
+						userCouponVO.setState(UserSystemCoupon.STATE_USE_GIVE);
+						 
+						jumpLink.put("state", "2"); // 宸叉敹璐�
+						jumpLink.put("showNav", false); // 涓嶆樉绀轰笂鏂圭粺璁′俊鎭�
+						jumpLink.put("type", "1"); // 杩斿埄璁㈠崟
+						jumpLink.put("title", "杩斿埄璁㈠崟"); // 鏍囬鍚�
+						jumpLink.put("goodsType", "0"); // 璁㈠崟鏉ユ簮
+						jumpBtn = new HashMap<String, Object>();
+						jumpBtn.put("params", jumpLink);
+						jumpBtn.put("jumpDetail", jumpDetailV2Service.getByTypeCache("order_screen_list"));
+					}
 				}
 			} else if (UserSystemCoupon.STATE_IN_USE == state && give) {
 				userCouponVO.setCouponEffect("璧犻�佷腑");
@@ -2082,8 +2088,8 @@
 		UserSystemCouponUseMQMsg msg = new UserSystemCouponUseMQMsg();
 		msg.setUserSystemCouponId(id);
 		msg.setCouponType(type.name());
-		Message message = new Message(MQTopicName.TOPIC_USER.name(), UserTopicTagEnum.systemCouponDrawback.name(),
-				new Gson().toJson(msg).getBytes());
+		Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.systemCouponDrawback,
+				msg);
 		try {
 			producer.send(message);
 		} catch (Exception e) {

--
Gitblit v1.8.0