From 6fdcc0c26dd33e87a024a69ed635d9aedb59cad6 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 07 一月 2020 12:02:50 +0800
Subject: [PATCH] 订单搜索引擎增量更新

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/order/HongBaoV2ServiceImpl.java |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 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 b6cfc24..4a25bb0 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
@@ -146,7 +146,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
@@ -276,7 +276,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());
@@ -285,7 +285,7 @@
 		if (oldHongBao == null)
 			throw new HongBaoException(10, "绾㈠寘瀵硅薄涓嶅瓨鍦�");
 		// 宸茬粡澶辨晥锛屽凡缁忛鍙栵紝鏂拌�佺姸鎬佷竴鑷寸殑绾㈠寘涓嶅仛澶勭悊
-		if (oldHongBao.getState() == HongBaoV2.STATE_SHIXIAO||oldHongBao.getState() == HongBaoV2.STATE_YILINGQU)
+		if (oldHongBao.getState() == HongBaoV2.STATE_SHIXIAO || oldHongBao.getState() == HongBaoV2.STATE_YILINGQU)
 			return false;
 
 		if (type == HongBaoV2.TYPE_ZIGOU) {// 鑾峰彇鑷喘鐨勮繑鍒╂瘮渚�
@@ -371,6 +371,9 @@
 			List<HongBaoV2> children = hongBaoV2Mapper.listChildrenById(hongBao.getId());
 			if (children != null && children.size() > 0)
 				for (HongBaoV2 child : children) {
+					if (child.getState() == HongBaoV2.STATE_YILINGQU)
+						continue;
+
 					HongBaoV2 childUpdate = new HongBaoV2(child.getId());
 					childUpdate.setState(hongBao.getState());
 					childUpdate.setUpdateTime(new Date());
@@ -592,6 +595,9 @@
 			List<HongBaoV2> children = hongBaoV2Mapper.listChildrenById(hongBao.getId());
 			if (children != null)
 				for (HongBaoV2 child : children) {
+					if (child.getState() == HongBaoV2.STATE_YILINGQU)
+						continue;
+
 					HongBaoV2 childUpdate = new HongBaoV2(child.getId());
 					// 缁熶竴璁剧疆鐘舵��
 					childUpdate.setState(hongBao.getState());
@@ -657,7 +663,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) {// 鑾峰彇鑷喘鐨勮繑鍒╂瘮渚�
@@ -1170,5 +1176,11 @@
 	public List<HongBaoV2> listByIds(List<Long> idList) {
 		return hongBaoV2Mapper.listByIds(idList);
 	}
+	
+	
+	@Override
+	public List<HongBaoDTO> listByOrderTradeId(String tradeId) {
+		return hongBaoV2Mapper.listByOrderTradeId(tradeId);
+	}
 
 }

--
Gitblit v1.8.0