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/shop/BanLiShopOrderServiceImpl.java |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopOrderServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopOrderServiceImpl.java
index bdfdad8..9ed1b30 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopOrderServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopOrderServiceImpl.java
@@ -40,6 +40,7 @@
 import com.yeshi.fanli.service.inter.money.msg.UserMoneyMsgNotificationService;
 import com.yeshi.fanli.service.inter.mq.MQUnSendInfoService;
 import com.yeshi.fanli.service.inter.redpack.RedPackBalanceService;
+import com.yeshi.fanli.service.inter.redpack.RedPackForbidService;
 import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsClassService;
 import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsService;
 import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsSetPayService;
@@ -47,6 +48,7 @@
 import com.yeshi.fanli.service.inter.shop.BanLiShopOrderService;
 import com.yeshi.fanli.util.Constant;
 import com.yeshi.fanli.util.factory.RedPackDetailFactory;
+import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
 import com.yeshi.fanli.util.rocketmq.MQTopicName;
 import com.yeshi.fanli.util.shop.BanLiShopOrderUtil;
 import com.yeshi.fanli.util.wx.BanLiShopWXPayUtil;
@@ -89,6 +91,10 @@
 
 	@Resource
 	private UserMoneyMsgNotificationService userMoneyMsgNotificationService;
+	
+	@Resource
+	private RedPackForbidService redPackForbidService;
+	
 
 	@Transactional
 	@Override
@@ -170,8 +176,8 @@
 
 	private void sendPlaceOrderMsg(Long orderId, Long uid) {
 
-		Message msg = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.banLiShopOrderDelay.name(),
-				new Gson().toJson(new BanLiShopOrderMQMsg(orderId, uid)).getBytes());
+		Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.banLiShopOrderDelay,
+				new BanLiShopOrderMQMsg(orderId, uid));
 		msg.setKey(orderId + "");
 		long delayTime = System.currentTimeMillis() + (Constant.IS_TEST ? 1000 * 30L : 1000 * 60 * 10);// 10鍒嗛挓鍚庨�氱煡
 		msg.setStartDeliverTime(delayTime);
@@ -341,8 +347,8 @@
 					if (isS)// 鏀粯鎴愬姛锛岄噸鏂板彂閫佹敮浠樻垚鍔熸秷鎭�
 					{
 						BanLiShopOrderMQMsg msg = new BanLiShopOrderMQMsg(order.getId(), order.getUid());
-						Message message = new Message(MQTopicName.TOPIC_ORDER.name(),
-								OrderTopicTagEnum.banLiShopOrderPaid.name(), new Gson().toJson(msg).getBytes());
+						Message message =MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER,
+								OrderTopicTagEnum.banLiShopOrderPaid,msg);
 						producer.send(message);
 						return;
 					}
@@ -373,8 +379,8 @@
 		if (order.getState() != BanLiShopOrder.STATE_PAID)
 			throw new BanLiShopOrderException(1, "璁㈠崟鏈浜庡緟瀹℃牳鐘舵��");
 
-		Message message = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.banLiShopOrderRefund.name(),
-				new Gson().toJson(new BanLiShopOrderMQMsg(order.getId(), order.getUid())).getBytes());
+		Message message =MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.banLiShopOrderRefund,
+			new BanLiShopOrderMQMsg(order.getId(), order.getUid()));
 		try {
 			orderTransactionProducer.send(message, new LocalTransactionExecuter() {
 				@Override
@@ -434,13 +440,11 @@
 			throw new BanLiShopOrderException(22, "鍟嗗搧宸蹭笅绾�");
 		}
 
+		if(redPackForbidService.verifyForbid(uid))
+			throw new BanLiShopOrderException(25, "绾㈠寘鍔熻兘宸茶灏佺");
+		
 		if (pay.getHongBaoPrice() != null && pay.getHongBaoPrice().compareTo(new BigDecimal(0)) > 0) {
-			BigDecimal money = null;
-			try {
-				money = redPackBalanceService.getBalance(uid);
-			} catch (RedPackBalanceException e) {
-				throw new BanLiShopOrderException(25, "绾㈠寘鍔熻兘寮傚父");
-			}
+			BigDecimal money = redPackBalanceService.getBalance(uid);
 			if (money.compareTo(pay.getHongBaoPrice()) < 0) {
 				throw new BanLiShopOrderException(24, "绾㈠寘浣欓涓嶈冻");
 			}

--
Gitblit v1.8.0