From 9c09cead959dbeef292628f345e5f80c30fc3d17 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期一, 19 八月 2019 17:42:44 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/mater-1.6.0' into div

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java |   51 +++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 45 insertions(+), 6 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 a8c6ff9..ddf8b52 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
@@ -16,7 +16,9 @@
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
+import org.yeshi.utils.NumberUtil;
 
+import com.google.gson.Gson;
 import com.yeshi.fanli.dao.mybatis.HongBaoV2Mapper;
 import com.yeshi.fanli.dao.mybatis.UserInfoMapper;
 import com.yeshi.fanli.dao.mybatis.money.UserMoneyDetailMapper;
@@ -227,8 +229,9 @@
 
 	@Override
 	public void fanli() {
+		LogHelper.test("澶勭悊杩斿埄鍒拌处");
 		// 鑾峰彇涓荤孩鍖�
-		List<HongBaoV2> hongBaoList = hongBaoV2Mapper.listCanBalanceHongBaoByType(HongBao.TYPE_TAOBAO, 1000);
+		List<HongBaoV2> hongBaoList = hongBaoV2Mapper.listCanBalanceHongBaoByType(HongBaoV2.TYPE_ZIGOU, 1000);
 		//
 		// /**
 		// * 闇�瑕佸疄鏃舵洿鏂板緟杩斿埄鐨勮鍗�
@@ -292,6 +295,11 @@
 	public void fanli(HongBaoV2 hb1) throws TaoBaoWeiQuanException {
 		// 鏌ヨ鏈�鏂扮殑绾㈠寘鏁版嵁
 		hb1 = hongBaoV2Mapper.selectByPrimaryKeyForUpdate(hb1.getId());
+		// 姝e父鐢ㄦ埛鎵嶈兘鍒拌处
+		UserInfo mainUser = userInfoMapper.selectByPrimaryKey(hb1.getUserInfo().getId());
+		if (mainUser == null || mainUser.getState() != UserInfo.STATE_NORMAL) {
+			return;
+		}
 		// 鏌ヨ绾㈠寘鐩稿叧鑱旂殑璁㈠崟
 		HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByHongBaoId(hb1.getId());
 		if (hongBaoOrder == null) {
@@ -456,8 +464,12 @@
 	public void weiQuanOrder(List<TaoBaoWeiQuanOrder> orderList) {
 		if (orderList != null)
 			for (TaoBaoWeiQuanOrder order : orderList) {
-				if (order.getState().contains("缁存潈鎴愬姛")) {
-					CMQManager.getInstance().addWeiQuanOrderMsg(order);
+				try {
+					if (order.getState().contains("缁存潈鎴愬姛")) {
+						CMQManager.getInstance().addWeiQuanOrderMsg(order);
+					}
+				} catch (Exception e) {
+					LogHelper.error("缁存潈璁㈠崟鍔犲叆鍒伴槦鍒楀嚭閿�:"+order!=null?new Gson().toJson(order):null);
 				}
 			}
 	}
@@ -576,6 +588,12 @@
 							|| co.getSourceType() == Constant.SOURCE_TYPE_PDD) {
 						hongBaoList.remove(i);
 						i--;
+					} else {// 涓婄骇鐢ㄦ埛涓嶆槸姝e父鐢ㄦ埛锛岃鍗曞潎涓嶈兘鍒拌处
+						UserInfo userInfo = userInfoMapper.selectByPrimaryKey(item.getUserInfo().getId());
+						if (userInfo == null || userInfo.getState() != UserInfo.STATE_NORMAL) {
+							hongBaoList.remove(i);
+							i--;
+						}
 					}
 				}
 			}
@@ -962,7 +980,7 @@
 			return;
 		String uidStr = order.getExt1();
 		Long uid = null;
-		if (!StringUtil.isNullOrEmpty(uidStr))
+		if (!StringUtil.isNullOrEmpty(uidStr) && NumberUtil.isNumeric(uidStr))
 			uid = Long.parseLong(uidStr);
 		Long positionId = order.getOrderItemList().get(0).getPositionId();
 		if (positionId == JDApiUtil.POSITION_FANLI)// 杩斿埄璁㈠崟
@@ -1005,7 +1023,7 @@
 		// 鍔犲叆璁㈠崟
 		Order oldOrder = orderMapper.selectOrderByOrderIdAndOrderType(jdOrder.getOrderId() + "",
 				Constant.SOURCE_TYPE_JD);
-		if (uid == null && oldOrder.getBeizhu().contains("琛ュ崟"))
+		if (uid == null && oldOrder != null && oldOrder.getBeizhu() != null && oldOrder.getBeizhu().contains("琛ュ崟"))
 			uid = oldOrder.getUserInfo().getId();
 
 		if (uid == null)
@@ -1120,7 +1138,7 @@
 
 		// 鍔犲叆璁㈠崟
 		Order oldOrder = orderMapper.selectOrderByOrderIdAndOrderType(pddOrder.getOrderSn(), Constant.SOURCE_TYPE_PDD);
-		if (uid == null && oldOrder.getBeizhu().contains("琛ュ崟"))
+		if (uid == null && oldOrder != null && oldOrder.getBeizhu() != null && oldOrder.getBeizhu().contains("琛ュ崟"))
 			uid = oldOrder.getUserInfo().getId();
 
 		if (uid == null)
@@ -1194,4 +1212,25 @@
 			}
 		}
 	}
+
+	@Override
+	public void repairCommonOrderByByTaoBaoOrder(String orderId) {
+		//鏍规嵁璁㈠崟鍙锋煡璇㈡窐瀹濊鍗�
+		List<TaoBaoOrder>  orderList=	taoBaoOrderService.getTaoBaoOrderByOrderId(orderId);
+		if(orderList!=null)
+			for(TaoBaoOrder order:orderList)
+			{
+				//鏍规嵁浜ゆ槗ID鏌ヨ甯歌璁㈠崟
+			CommonOrder commonOrder=	commonOrderService.selectBySourceTypeAndTradeId(Constant.SOURCE_TYPE_TAOBAO, order.getTradeId());
+			//淇orderby
+			if(commonOrder!=null)
+			{CommonOrder update=new CommonOrder(commonOrder.getId());
+			update.setOrderBy(order.getOrderBy());
+			update.setUpdateTime(new Date());		
+			commonOrderService.updateByPrimaryKeySelective(update);
+			}
+			}
+		
+		
+	}
 }

--
Gitblit v1.8.0