From dd5b15229cb15459fa7c31ccea77dac28cbfafbd Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期一, 13 四月 2020 10:04:20 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/order/HongBaoV2ServiceImpl.java |   75 +++++++++++++------------------------
 1 files changed, 27 insertions(+), 48 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/HongBaoV2ServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/HongBaoV2ServiceImpl.java
index c0f1139..f1fe884 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/HongBaoV2ServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/HongBaoV2ServiceImpl.java
@@ -34,6 +34,7 @@
 import com.yeshi.fanli.entity.order.CommonOrderGoods;
 import com.yeshi.fanli.entity.order.HongBaoOrder;
 import com.yeshi.fanli.entity.order.ShareGoodsActivityOrder;
+import com.yeshi.fanli.entity.system.ConfigKeyEnum;
 import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
 import com.yeshi.fanli.exception.order.HongBaoException;
 import com.yeshi.fanli.exception.order.ShareGoodsActivityOrderException;
@@ -146,7 +147,7 @@
 		return hongBaoV2Mapper.selectByPrimaryKey(id);
 	}
 
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
 	@Override
 	public int addHongBao(List<CommonOrder> commonOrderList, int type) throws HongBaoException, UserAccountException {
 		Set<Integer> stateSet = new HashSet<>();// 璁㈠崟鐘舵�丼et
@@ -189,63 +190,36 @@
 					switch (t) {
 					case HongBaoV2.TYPE_ZIGOU:
 						userOrderMsgNotificationService.orderFanLiStatistic(uid, orderId, orderType,
-								commonOrder.getPayment(), money, goodsCount, state);
+								commonOrder.getPayment(), money, goodsCount, commonOrder.getState(),
+								commonOrder.getThirdCreateTime());
+
 						break;
 					case HongBaoV2.TYPE_SHARE_GOODS:
 
 						userOrderMsgNotificationService.orderShareStatistic(uid, orderId, orderType,
-								commonOrder.getPayment(), money, goodsCount, state);
+								commonOrder.getPayment(), money, goodsCount, commonOrder.getState(),
+								commonOrder.getThirdCreateTime());
+
 						break;
 					case HongBaoV2.TYPE_YIJI:
-
 						userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType,
-								commonOrder.getPayment(), money, goodsCount, state);
+								commonOrder.getPayment(), money, goodsCount, commonOrder.getState(),
+								commonOrder.getThirdCreateTime());
 						break;
 					case HongBaoV2.TYPE_ERJI:
-
-						userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType,
-								commonOrder.getPayment(), money, goodsCount, state);
+						userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType, 	commonOrder.getPayment(), money,
+								goodsCount,  commonOrder.getState(), commonOrder.getThirdCreateTime());
 						break;
 
 					case HongBaoV2.TYPE_SHARE_YIJI:
-						userOrderMsgNotificationService.orderShareFirstLevelStatistic(uid, orderId, orderType,
-								commonOrder.getPayment(), money, goodsCount, state, notify.getBeizhu());
+						userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType,
+								commonOrder.getPayment(), money, goodsCount, commonOrder.getState(),
+								commonOrder.getThirdCreateTime());
+						
+					case HongBaoV2.TYPE_SHARE_ERJI:
+						userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType, 	commonOrder.getPayment(), money,
+								goodsCount,  commonOrder.getState(), commonOrder.getThirdCreateTime());
 						break;
-					}
-				}
-			}
-
-			// 娣诲姞鏂扮増鏈�氱煡
-
-			if (!hasAdd) {
-				Iterator<Integer> its = notificationMap.keySet().iterator();
-				while (its.hasNext()) {
-					Integer t = its.next();
-					HongBaoV2 notify = notificationMap.get(t).getHongBaoV2();
-					CommonOrder commonOrder = notificationMap.get(t).getCommonOrder();
-					String orderId = commonOrderList.get(0).getOrderNo();
-					Long uid = notify.getUserInfo().getId();
-					BigDecimal money = notify.getMoney();
-					switch (t) {
-					case HongBaoV2.TYPE_ZIGOU:
-						userOrderMsgNotificationService.orderFanLiStateChanged(uid, orderId, orderType,
-								commonOrder.getPayment(), money, state);
-						break;
-					case HongBaoV2.TYPE_SHARE_GOODS:
-						userOrderMsgNotificationService.orderShareStateChanged(uid, orderId, orderType,
-								commonOrder.getPayment(), money, state);
-						break;
-					case HongBaoV2.TYPE_YIJI:
-						userOrderMsgNotificationService.orderInviteStateChanged(uid, orderId, orderType,
-								commonOrder.getPayment(), money, state);
-						break;
-					case HongBaoV2.TYPE_ERJI:
-						userOrderMsgNotificationService.orderInviteStateChanged(uid, orderId, orderType,
-								commonOrder.getPayment(), money, state);
-						break;
-					case HongBaoV2.TYPE_SHARE_YIJI:
-						userOrderMsgNotificationService.orderShareFirstLevelStateChanged(uid, orderId, orderType,
-								commonOrder.getPayment(), money, state);
 					}
 				}
 			}
@@ -276,7 +250,7 @@
 		return CommonOrder.STATE_SX;
 	}
 
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
 	private boolean updateHongBao(HongBaoOrder hongBaoOrder, CommonOrder commonOrder, int type,
 			Map<Integer, HongBaoOrder> notificationMap) throws HongBaoException, UserAccountException {
 		System.out.println(commonOrder.getOrderNo());
@@ -663,7 +637,7 @@
 		return true;
 	}
 
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
 	private void saveHongBao(CommonOrder commonOrder, int type, Map<Integer, HongBaoOrder> notificationMap)
 			throws HongBaoException, UserAccountException {
 		if (type == HongBaoV2.TYPE_ZIGOU) {// 鑾峰彇鑷喘鐨勮繑鍒╂瘮渚�
@@ -885,7 +859,7 @@
 				shareRate = hongBaoManageService.getShareRate(commonOrder.getCreateTime().getTime());
 
 			// 鍒ゆ柇璁㈠崟鍒嗕韩娲诲姩鏄惁寮�鍚�
-			if ("1".equalsIgnoreCase(configService.get("share_goods_activity_open"))) {
+			if ("1".equalsIgnoreCase(configService.get(ConfigKeyEnum.shareGoodsActivityOpen.getKey()))) {
 				// 娌℃湁璁㈠崟锛屽苟涓旀槸娓犻亾ID鏉ョ殑锛屽苟涓�
 				UserExtraTaoBaoInfo taoBaoExtraInfo = userExtraTaoBaoInfoService
 						.getByUid(commonOrder.getUserInfo().getId());
@@ -1177,4 +1151,9 @@
 		return hongBaoV2Mapper.listByIds(idList);
 	}
 
+	@Override
+	public List<HongBaoDTO> listByOrderTradeId(String tradeId) {
+		return hongBaoV2Mapper.listByOrderTradeId(tradeId);
+	}
+
 }

--
Gitblit v1.8.0