From 2012b3b5db3c6b06535a68f775bcc81b16151b90 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期五, 06 九月 2019 16:54:00 +0800
Subject: [PATCH] 加入任务

---
 fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java |  129 ++++++++++++++++++++++++------------------
 1 files changed, 74 insertions(+), 55 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 38a0908..e4a2e53 100644
--- a/fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java
+++ b/fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java
@@ -36,6 +36,7 @@
 import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service;
 import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
 import com.yeshi.fanli.service.inter.integral.IntegralGetService;
+import com.yeshi.fanli.service.inter.integral.IntegralTaskRecordService;
 import com.yeshi.fanli.service.inter.jd.JDOrderService;
 import com.yeshi.fanli.service.inter.lable.BoutiqueAutoRuleService;
 import com.yeshi.fanli.service.inter.lable.LabelService;
@@ -123,6 +124,9 @@
 
 	@Resource
 	private HongBaoOrderService hongBaoOrderService;
+
+	@Resource
+	private IntegralTaskRecordService integralTaskRecordService;
 
 	private static boolean isInited = false;
 
@@ -779,68 +783,83 @@
 					if (map != null) {
 						// 鏄惁鏄鍗�
 						for (Iterator<String> its = map.keySet().iterator(); its.hasNext();) {
-							String key = its.next();
-							Order order = map.get(key);
-							// 缁熻璁㈠崟涓嬬殑鐢ㄦ埛鎵�鑾峰緱鐨勮繑鍒╅噾棰�
-							List<CommonOrder> list = commonOrderService.listBySourceTypeAndOrderId(order.getOrderType(),
-									order.getOrderId());
-							Map<Long, BigDecimal> hongBaoMoney = new HashMap<>();
-							if (list != null)
-								for (CommonOrder commonOrder : list) {
-									HongBaoOrder hongBaoOrder = hongBaoOrderService
-											.selectDetailByCommonOrderId(commonOrder.getId());
-									if (hongBaoOrder != null && hongBaoOrder.getHongBaoV2() != null) {
-										Long mainUid = hongBaoOrder.getHongBaoV2().getUserInfo().getId();
-										if (hongBaoMoney.get(mainUid) == null)
-											hongBaoMoney.put(mainUid, new BigDecimal(0));
-										hongBaoMoney.put(mainUid,
-												hongBaoMoney.get(mainUid).add(hongBaoOrder.getHongBaoV2().getMoney()));
-										// 鏌ヨ涓婄骇
-										List<HongBaoV2> children = hongBaoV2Service
-												.listChildrenById(hongBaoOrder.getHongBaoV2().getId());
-										if (children != null) {
-											for (HongBaoV2 hongBao : children) {
-												Long uid = hongBao.getUserInfo().getId();
-												if (hongBaoMoney.get(uid) == null)
-													hongBaoMoney.put(uid, new BigDecimal(0));
-												hongBaoMoney.put(uid, hongBaoMoney.get(uid).add(hongBao.getMoney()));
+							try {
+								String key = its.next();
+								Order order = map.get(key);
+								// 缁熻璁㈠崟涓嬬殑鐢ㄦ埛鎵�鑾峰緱鐨勮繑鍒╅噾棰�
+								List<CommonOrder> list = commonOrderService
+										.listBySourceTypeAndOrderId(order.getOrderType(), order.getOrderId());
+								Map<Long, BigDecimal> hongBaoMoney = new HashMap<>();
+								if (list != null)
+									for (CommonOrder commonOrder : list) {
+										HongBaoOrder hongBaoOrder = hongBaoOrderService
+												.selectDetailByCommonOrderId(commonOrder.getId());
+										if (hongBaoOrder != null && hongBaoOrder.getHongBaoV2() != null) {
+											Long mainUid = hongBaoOrder.getHongBaoV2().getUserInfo().getId();
+											if (hongBaoMoney.get(mainUid) == null)
+												hongBaoMoney.put(mainUid, new BigDecimal(0));
+											hongBaoMoney.put(mainUid, hongBaoMoney.get(mainUid)
+													.add(hongBaoOrder.getHongBaoV2().getMoney()));
+											// 鏌ヨ涓婄骇
+											List<HongBaoV2> children = hongBaoV2Service
+													.listChildrenById(hongBaoOrder.getHongBaoV2().getId());
+											if (children != null) {
+												for (HongBaoV2 hongBao : children) {
+													Long uid = hongBao.getUserInfo().getId();
+													if (hongBaoMoney.get(uid) == null)
+														hongBaoMoney.put(uid, new BigDecimal(0));
+													hongBaoMoney.put(uid,
+															hongBaoMoney.get(uid).add(hongBao.getMoney()));
+												}
 											}
 										}
 									}
-								}
 
-							if (isFirstValidOrder(order.getOrderId(), order.getOrderType(),
-									order.getUserInfo().getId())) {// 鏈夋晥鐨勯鍗�
-								if (hongBaoMoney.get(order.getUserInfo().getId()) == null || hongBaoMoney
-										.get(order.getUserInfo().getId()).compareTo(new BigDecimal("0")) <= 0) {
-									// TODO 鍒嗕韩濂栭噾鏄�0
-								}
+								if (isFirstValidOrder(order.getOrderId(), order.getOrderType(),
+										order.getUserInfo().getId())) {// 鏈夋晥鐨勯鍗�
+									if (hongBaoMoney.get(order.getUserInfo().getId()) == null || hongBaoMoney
+											.get(order.getUserInfo().getId()).compareTo(new BigDecimal("0")) <= 0) {
+										// 鍒嗕韩濂栭噾鏄�0
+										integralTaskRecordService.firstShareOrderReward(order.getUserInfo().getId(),
+												null);
+									}
 
-								// 鑾峰彇涓婁袱绾ф暟鎹�
-								UserInfo boss = threeSaleSerivce.getBoss(order.getUserInfo().getId());
-								if (boss != null) {// 鍒ゆ柇涓婄骇鐨勭孩鍖�
-									if (hongBaoMoney.get(boss.getId()) == null
-											|| hongBaoMoney.get(boss.getId()).compareTo(new BigDecimal("0")) <= 0) {
-										// TODO 琛ュ伩璧勯噾
+									// 鑾峰彇涓婁袱绾ф暟鎹�
+									UserInfo boss = threeSaleSerivce.getBoss(order.getUserInfo().getId());
+									if (boss != null) {// 鍒ゆ柇涓婄骇鐨勭孩鍖�
+										if (hongBaoMoney.get(boss.getId()) == null
+												|| hongBaoMoney.get(boss.getId()).compareTo(new BigDecimal("0")) <= 0) {
+											// 琛ュ伩閲戝竵
+											integralTaskRecordService.firstSharerOrderRewardBoss(boss.getId(),
+													order.getUserInfo().getId(), null);
+										}
+									}
+
+								} else {// 鑷喘璁㈠崟
+									UserInfo boss = threeSaleSerivce.getBoss(order.getUserInfo().getId());
+									if (boss != null) {// 鍒ゆ柇涓婄骇鐨勭孩鍖�
+										if (hongBaoMoney.get(boss.getId()) == null
+												|| hongBaoMoney.get(boss.getId()).compareTo(new BigDecimal("0")) <= 0) {
+											// 琛ュ伩閲戝竵1绾�
+											integralTaskRecordService.firstRebateOrderRewardBoss(boss.getId(),
+													order.getUserInfo().getId(), null);
+										}
+									}
+
+									boss = threeSaleSerivce.getBoss(boss.getId());
+									if (boss != null) {// 鍒ゆ柇涓婄骇鐨勭孩鍖�
+										if (hongBaoMoney.get(boss.getId()) == null
+												|| hongBaoMoney.get(boss.getId()).compareTo(new BigDecimal("0")) <= 0) {
+											// 琛ュ伩閲戝竵2绾�
+											integralTaskRecordService.firstRebateOrderRewardBossSuper(boss.getId(),
+													order.getUserInfo().getId(), null);
+										}
 									}
 								}
-
-							} else {// 鑷喘璁㈠崟
-								UserInfo boss = threeSaleSerivce.getBoss(order.getUserInfo().getId());
-								if (boss != null) {// 鍒ゆ柇涓婄骇鐨勭孩鍖�
-									if (hongBaoMoney.get(boss.getId()) == null
-											|| hongBaoMoney.get(boss.getId()).compareTo(new BigDecimal("0")) <= 0) {
-										// TODO 琛ュ伩璧勯噾1绾�
-									}
-								}
-
-								boss = threeSaleSerivce.getBoss(boss.getId());
-								if (boss != null) {// 鍒ゆ柇涓婄骇鐨勭孩鍖�
-									if (hongBaoMoney.get(boss.getId()) == null
-											|| hongBaoMoney.get(boss.getId()).compareTo(new BigDecimal("0")) <= 0) {
-										// TODO 琛ュ伩璧勯噾2绾�
-									}
-								}
+								PlaceOrderCMQManager.getInstance().deleteQueueMsg(PlaceOrderCMQManager.QUEUE_INTEGRAL,
+										key);
+							} catch (Exception e) {
+								LogHelper.errorDetailInfo(e);
 							}
 						}
 

--
Gitblit v1.8.0