From 0b177e19cfc810ca12195c0b4e2d934566afb6b0 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期五, 27 九月 2019 15:10:03 +0800
Subject: [PATCH] 限时秒杀bug修改,淘宝成功订单状态处理

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java |   50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java
index 977a615..b495b03 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java
@@ -1443,4 +1443,54 @@
 			return false;
 	}
 
+	@Transactional(rollbackFor = Exception.class)
+	public void invalidHongBaoV2AndGiveGodenCorn(Long hongBaoId, Long uid, String orderId, int sourceType,
+			String beiZhu) throws Exception {
+		HongBaoV2 v2 = new HongBaoV2(hongBaoId);
+		v2.setState(HongBaoV2.STATE_SHIXIAO);
+		v2.setBeizhu(beiZhu);
+		v2.setUpdateTime(new Date());
+		hongBaoV2Service.updateByPrimaryKeySelective(v2);
+		List<HongBaoV2> children = hongBaoV2Service.listChildrenById(hongBaoId);
+		if (children != null)
+			for (HongBaoV2 child : children) {
+				HongBaoV2 update = new HongBaoV2(child.getId());
+				update.setState(HongBaoV2.STATE_SHIXIAO);
+				update.setBeizhu(beiZhu);
+				update.setUpdateTime(new Date());
+				hongBaoV2Service.updateByPrimaryKeySelective(update);
+			}
+		userSystemCouponService.systemGiveRewardCoupon(uid, 1, orderId, sourceType, "鍥犲晢瀹惰繚绾︽湭鑳界粨绠楄繑鍒╂垨鍟嗗宸茬粡鍏冲簵");
+	}
+
+	@Transactional
+	@Override
+	public void doTaoBaoSellerNotPaid(TaoBaoOrder order) {
+
+		// 鏍规嵁浜ゆ槗ID鏌ヨ
+		if (!StringUtil.isNullOrEmpty(order.getTradeId())) {
+			List<CommonOrder> commonOrderList = commonOrderService
+					.listBySourceTypeAndTradeId(Constant.SOURCE_TYPE_TAOBAO, order.getTradeId());
+			if (commonOrderList != null)
+				// 鏌ヨ涓昏鍗�
+				for (CommonOrder commonOrder : commonOrderList) {
+				// 鏌ヨ涓荤孩鍖�
+				HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(commonOrder.getId());
+				if (hongBaoOrder != null && hongBaoOrder.getHongBaoV2() != null) {
+				if (hongBaoOrder.getHongBaoV2().getState() == HongBaoV2.STATE_BUKELINGQU) {
+				// 璁㈠崟澶辨晥,璧犻�侀噾甯�
+				try {
+				invalidHongBaoV2AndGiveGodenCorn(hongBaoOrder.getHongBaoV2().getId(), hongBaoOrder.getHongBaoV2().getUserInfo().getId(), commonOrder.getOrderNo(), commonOrder.getSourceType(), "璁㈠崟鎴愬姛锛屽晢瀹舵湭鎵撴");
+				} catch (Exception e) {
+				e.printStackTrace();
+				}
+				}
+
+				}
+
+				}
+		}
+
+	}
+
 }

--
Gitblit v1.8.0