From c8f11c229b87d1652b6da0b15576c166cd51eb8b Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 01 一月 2020 14:25:22 +0800
Subject: [PATCH] 首页悬浮图mapperbug修改,增加商品详情中的比例展示

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderMoneySettleServiceImpl.java |   64 +++++++++++++++-----------------
 1 files changed, 30 insertions(+), 34 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderMoneySettleServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderMoneySettleServiceImpl.java
index c37fa76..3ffecd1 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderMoneySettleServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderMoneySettleServiceImpl.java
@@ -114,7 +114,7 @@
 	@Resource
 	private HongBaoV2SettleTempService hongBaoV2SettleTempService;
 
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
 	@Override
 	public void inviteSettleTB(Long uid) throws OrderMoneySettleException {
 		// 鏌ヨUID鐨勪竴浜岀骇閭�璇疯禋
@@ -156,6 +156,7 @@
 		// 閭�璇疯禋鍒拌处浜嬪姟娑堟伅
 		OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_INVITE, uid,
 				sourceType, null, null, new Date(), 0);
+
 		Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderFanLiActual, mqMsg);
 		String taskKey = getTaskKey(uid);
 		msg.setKey(taskKey);
@@ -175,9 +176,10 @@
 		} catch (Exception e) {
 			LogHelper.mqError(e.getMessage(), msg.getTopic(), msg.getTag(), new Gson().toJson(mqMsg));
 		}
+		System.out.println(new Gson().toJson(mqMsg));
 	}
 
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
 	@Override
 	public void inviteSettleJD(Long uid) throws OrderMoneySettleException {
 		// 鏌ヨUID鐨勪竴浜岀骇閭�璇疯禋
@@ -236,7 +238,7 @@
 		}
 	}
 
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
 	@Override
 	public void inviteSettlePDD(Long uid) throws OrderMoneySettleException {
 		// 鏌ヨUID鐨勪竴浜岀骇閭�璇疯禋
@@ -295,7 +297,7 @@
 		}
 	}
 
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
 	@Override
 	public void shareSettleTB(Long uid) throws OrderMoneySettleException {
 		/**
@@ -340,7 +342,7 @@
 		}
 	}
 
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
 	@Override
 	public void shareSettleJD(Long uid) throws OrderMoneySettleException {
 		/**
@@ -381,7 +383,7 @@
 		}
 	}
 
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
 	@Override
 	public void shareSettlePDD(Long uid) throws OrderMoneySettleException {
 		/**
@@ -422,7 +424,7 @@
 		}
 	}
 
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
 	@Override
 	public void ziGouSettle(String orderId, int sourceType, String taskKey) throws OrderMoneySettleException {
 		// 鏌ヨ鍚屼竴璁㈠崟鍙风殑绾㈠寘
@@ -465,6 +467,25 @@
 						userHongBao.put(uid, new ArrayList<>());
 					userHongBao.get(uid).add(hb);
 				}
+			}
+		}
+
+		// 鑾峰彇缁存潈璧勯噾
+		if (sourceType == Constant.SOURCE_TYPE_TAOBAO) {
+			try {
+				Map<Long, BigDecimal> userSubMoneyMap = taoBaoWeiQuanDrawBackService.doWeiQuanFanli(orderId, false);
+				if (userSubMoneyMap != null) {
+					for (Iterator<Long> its = userMoney.keySet().iterator(); its.hasNext();) {
+						Long uid = its.next();
+						if (userSubMoneyMap.get(uid) != null) {
+							// 鍑忓幓缁存潈璧勯噾
+							userMoney.put(uid, userMoney.get(uid).subtract(userSubMoneyMap.get(uid)));														
+						}
+					}
+				}
+			} catch (Exception e) {
+				LogHelper.errorDetailInfo(e);
+				throw new OrderMoneySettleException(2, "缁存潈璁㈠崟鍑洪敊");
 			}
 		}
 
@@ -521,31 +542,6 @@
 			e.printStackTrace();
 		}
 
-		// 缁存潈鎵f锛�2018-08-05鍚庡紑濮嬪疄琛岋級
-
-		try {
-			if (sourceType == Constant.SOURCE_TYPE_TAOBAO)
-				taoBaoWeiQuanDrawBackService.doWeiQuanFanli(orderId);
-		} catch (TaoBaoWeiQuanException e) {
-			if (e.getCode() == TaoBaoWeiQuanException.CODE_NEDD_UPDATE_ORDER) {
-				List<TaoBaoOrder> olist = taoBaoOrderService.getTaoBaoOrderByOrderId(orderId);
-				if (olist != null && olist.size() > 0) {
-					long time = TimeUtil.convertToTimeTemp(olist.get(0).getCreateTime(), "yyyy-MM-dd HH:mm:ss");
-					olist = TaoKeOrderApiUtil.getTaoBaoCommonOrderList(time, time + 1000 * 2L, 1);
-					if (olist != null && olist.size() > 0) {
-						for (int i = 0; i < olist.size(); i++) {
-							if (!olist.get(i).getOrderId().equalsIgnoreCase(orderId)) {// 鍒犻櫎鏃犲叧璁㈠崟
-								olist.remove(i);
-								i--;
-							}
-						}
-						taoBaoOrderService.addTaoBaoOrderList(olist);
-					}
-				}
-			} else
-				throw new OrderMoneySettleException(e.getCode(), "缁存潈澶勭悊鍑洪敊:" + e.getMsg());
-		}
-
 		// 娣诲姞缁撶畻鏄犲皠
 
 	}
@@ -574,7 +570,7 @@
 		return hongBao;
 	}
 
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
 	private void fanliInviteTB(List<HongBaoV2> hongBaoList, Long uid, String key) throws TaoBaoWeiQuanException {
 		List<Long> hbIdList = new ArrayList<>();
 		BigDecimal invitemoney = new BigDecimal(0);
@@ -954,7 +950,7 @@
 	 * @param orderId
 	 * @param sourceType
 	 */
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
 	@Override
 	public void inviteSubsidySettle(Long uid, String taskKey) throws OrderMoneySettleException {
 		// 鏌ヨkey

--
Gitblit v1.8.0