From dcfd801ea435c1c87ed47f2ee24cdabaaf230d6f Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 31 三月 2020 12:15:56 +0800
Subject: [PATCH] 大淘客商品过滤修改

---
 fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java |   68 +++++++++++++++++++++++++++++++--
 1 files changed, 63 insertions(+), 5 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java b/fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java
index 751df38..5133d26 100644
--- a/fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java
+++ b/fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java
@@ -35,6 +35,7 @@
 import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
 import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
 import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
+import com.yeshi.fanli.exception.money.OrderMoneySettleException;
 import com.yeshi.fanli.exception.order.TaoBaoWeiQuanException;
 import com.yeshi.fanli.log.LogHelper;
 import com.yeshi.fanli.service.inter.ad.DouYinClickEventService;
@@ -163,6 +164,7 @@
 			doTaoBaoNewOrders();// 澶勭悊娣樺疂璁㈠崟锛堝垰鍒氫骇鐢熺殑锛�
 			doOrderFanLiNew();// 鏂扮増杩斿埄
 			doOrderTiChengFanLi();// 澶勭悊璁㈠崟鎻愭垚杩斿埄
+			doOrderTeamRewardFanLi();// 鍥㈤槦濂栧姳鍒拌处
 			doWeiQuanOrder();// 澶勭悊缁存潈璁㈠崟
 			doPushIOS();// 澶勭悊鍙戦�両OS娑堟伅
 			doUserMoneyDebtJob();// 鍊哄姟鍋胯繕
@@ -327,7 +329,8 @@
 								try {
 									HongBaoV2 hongbao = map.get(handler);
 									if (hongbao != null) {
-										String key = "hongbao-fanli-" + hongbao.getId();
+										String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.hongBaoFanLi,
+												hongbao.getId() + "");
 										if (StringUtil.isNullOrEmpty(redisManager.getCommonString(key))) {
 											// 澶勭悊涔嬪悗瑕侀殧2灏忔椂鍐嶆杩涜澶勭悊
 											redisManager.cacheCommonString(key, "1", 60 * 60 * 2);
@@ -378,6 +381,47 @@
 									orderProcessService.fanliInvaiteAndShare(map.get(handler));
 									CMQManager.getInstance().deleteFanLiTiChengMsg(handler);
 								} catch (TaoBaoWeiQuanException e) {
+									try {
+										LogHelper.errorDetailInfo(e);
+									} catch (Exception e1) {
+										e1.printStackTrace();
+									}
+								} catch (Exception e) {
+									try {
+										LogHelper.errorDetailInfo(e, map.get(handler).toString(), "");
+									} catch (Exception e1) {
+										e1.printStackTrace();
+									}
+								}
+							}
+						}
+					} catch (Exception e) {
+
+					}
+				}
+			}
+		});
+	}
+
+	/**
+	 * 璁㈠崟鍥㈤槦濂栧姳鍒拌处
+	 */
+	public void doOrderTeamRewardFanLi() {
+		executor.execute(new Runnable() {
+			@Override
+			public void run() {
+				while (true) {
+					try {
+
+						Map<String, Long> map = CMQManager.getInstance().consumeOrderTeamRewardMsg(16);
+						if (map != null) {
+							Iterator<String> its = map.keySet().iterator();
+							while (its.hasNext()) {
+								String handler = its.next();
+								try {
+									orderProcessService.fanliOrderTeamReward(map.get(handler));
+									CMQManager.getInstance().deleteOrderTeamRewardMsg(handler);
+								} catch (OrderMoneySettleException e) {
 									try {
 										LogHelper.errorDetailInfo(e);
 									} catch (Exception e1) {
@@ -840,14 +884,28 @@
 	private void fanliGetIntegral(HongBaoV2 hongBaoV2) {
 		if (hongBaoV2 != null && hongBaoV2.getState() == HongBaoV2.STATE_YILINGQU
 				&& hongBaoV2.getMoney().compareTo(new BigDecimal(0)) > 0) {
+			// 鏌ヨ瀵瑰簲鐨勮鍗曞彿
+			Long mainHongBaoId = hongBaoV2.getId();
+			if (hongBaoV2.getParent() != null && hongBaoV2.getParent().getId() != null)
+				mainHongBaoId = hongBaoV2.getParent().getId();
+
+			HongBaoOrder hongbaoOrder = hongBaoOrderService.selectDetailByHongBaoId(mainHongBaoId);
+			if (hongbaoOrder == null || hongbaoOrder.getCommonOrder() == null)
+				return;
+			CommonOrder commonOrder = hongbaoOrder.getCommonOrder();
+
 			if (hongBaoV2.getType() == HongBaoV2.TYPE_ZIGOU) {// 鑷喘璁㈠崟
-				integralGetService.addRebateOrder(hongBaoV2.getUserInfo().getId());
+				integralGetService.addRebateOrder(hongBaoV2.getUserInfo().getId(), commonOrder.getOrderNo(),
+						commonOrder.getSourceType());
 			} else if (hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_GOODS) {// 鍒嗕韩璁㈠崟
-				integralGetService.addShareOrder(hongBaoV2.getUserInfo().getId());
+				integralGetService.addShareOrder(hongBaoV2.getUserInfo().getId(), commonOrder.getOrderNo(),
+						commonOrder.getSourceType());
 			} else if (hongBaoV2.getType() == HongBaoV2.TYPE_YIJI || hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_YIJI) {// 涓�绾ч個璇�
-				integralGetService.addInviteOrderLevelOne(hongBaoV2.getUserInfo().getId());
+				integralGetService.addInviteOrderLevelOne(hongBaoV2.getUserInfo().getId(), commonOrder.getOrderNo(),
+						commonOrder.getSourceType());
 			} else if (hongBaoV2.getType() == HongBaoV2.TYPE_ERJI || hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_ERJI) {// 浜岀骇閭�璇�
-				integralGetService.addInviteOrderLevelTwo(hongBaoV2.getUserInfo().getId());
+				integralGetService.addInviteOrderLevelTwo(hongBaoV2.getUserInfo().getId(), commonOrder.getOrderNo(),
+						commonOrder.getSourceType());
 			}
 		}
 	}

--
Gitblit v1.8.0