From c70caa91e6b0e1f944b148b55685aca43bb90783 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 01 四月 2020 14:40:59 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java |  285 ++++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 222 insertions(+), 63 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java
index 8520dd0..c7c155c 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java
@@ -17,10 +17,14 @@
 import org.yeshi.utils.entity.DateInfo;
 import org.yeshi.utils.taobao.TbImgUtil;
 
+import com.aliyun.openservices.ons.api.Message;
+import com.aliyun.openservices.ons.api.Producer;
 import com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper;
 import com.yeshi.fanli.dao.mybatis.order.CommonOrderMapper;
 import com.yeshi.fanli.dao.mybatis.order.CommonOrderTradeIdMapMapper;
 import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoWeiQuanOrderMapper;
+import com.yeshi.fanli.dto.mq.order.OrderTopicTagEnum;
+import com.yeshi.fanli.dto.mq.order.body.OrderConfirmMQMsg;
 import com.yeshi.fanli.dto.order.CommonOrderAddResultDTO;
 import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
 import com.yeshi.fanli.entity.accept.AcceptData;
@@ -38,6 +42,7 @@
 import com.yeshi.fanli.entity.order.HongBaoOrder;
 import com.yeshi.fanli.entity.order.InviteOrderSubsidy;
 import com.yeshi.fanli.entity.pdd.PDDOrder;
+import com.yeshi.fanli.entity.system.ConfigKeyEnum;
 import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
 import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
 import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
@@ -70,9 +75,11 @@
 import com.yeshi.fanli.util.jd.JDApiUtil;
 import com.yeshi.fanli.util.jd.JDUtil;
 import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil;
-import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
+import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
+import com.yeshi.fanli.util.rocketmq.MQTopicName;
 import com.yeshi.fanli.util.taobao.TaoBaoUtil;
 import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
+import com.yeshi.fanli.util.user.UserLevelUtil;
 import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
 import com.yeshi.fanli.vo.order.CommonOrderGoodsVO;
 import com.yeshi.fanli.vo.order.CommonOrderVO;
@@ -128,6 +135,9 @@
 
 	@Resource
 	private UserInfoService userInfoService;
+
+	@Resource(name = "producer")
+	private Producer orderProducer;
 
 	// 濂栧姳璁㈠崟鍥剧墖
 	public final static String PIC_REWARD = "http://img.flqapp.com/resource/order/order_state_reward.png";
@@ -210,7 +220,11 @@
 		}
 
 		// 鏁版嵁鍔犲伐閲嶆柊缁勭粐
-		orderVOFactory(acceptData, listOrder, listGoods, uid);
+		if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
+			orderVOFactoryNew(acceptData, listOrder, listGoods, uid);
+		} else {
+			orderVOFactory(acceptData, listOrder, listGoods, uid);
+		}
 
 		return listOrder;
 	}
@@ -267,21 +281,38 @@
 		}
 		Map<Long, Boolean> vipUserMap = userVIPInfoService.listByUids(needSelectVIPUidList);
 
-		// 璁剧疆鏄惁涓簐ip璁㈠崟
-		for (CommonOrderVO order : listOrder) {
-			if (order.getHongBaoType() == HongBaoV2.TYPE_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_ERJI
-					|| order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI
-					|| order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI) {
-				if (vipUserMap.get(Long.parseLong(order.getUserId())) != null
-						&& vipUserMap.get(Long.parseLong(order.getUserId())) == true)
-					order.setVipOrder(true);
-				else
-					order.setVipOrder(false);
-			} else
-				order.setVipOrder(false);
+		if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
+			for (CommonOrderVO order : listOrder) {
 
-			if (order.isVipOrder())
-				order.setVipOrderDesc("璁㈠崟鏉ユ簮锛氱敱瓒呯骇浼氬憳鐨勭矇涓濅骇鐢�");
+				if (order.getHongBaoType() == HongBaoV2.TYPE_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_ERJI
+						|| order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI
+						|| order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI) {
+					Integer urank = order.getUrank();
+					if (urank != null) {
+						String levelName = UserLevelUtil.getLevelName(urank);
+						if (!StringUtil.isNullOrEmpty(levelName)) {
+							order.setOrderDesc(levelName);
+						}
+					}
+				}
+			}
+		} else {
+			// 璁剧疆鏄惁涓簐ip璁㈠崟
+			for (CommonOrderVO order : listOrder) {
+				if (order.getHongBaoType() == HongBaoV2.TYPE_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_ERJI
+						|| order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI
+						|| order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI) {
+					if (vipUserMap.get(Long.parseLong(order.getUserId())) != null
+							&& vipUserMap.get(Long.parseLong(order.getUserId())) == true)
+						order.setVipOrder(true);
+					else
+						order.setVipOrder(false);
+				} else
+					order.setVipOrder(false);
+
+				if (order.isVipOrder())
+					order.setVipOrderDesc("璁㈠崟鏉ユ簮锛氱敱瓒呯骇浼氬憳鐨勭矇涓濅骇鐢�");
+			}
 		}
 
 		SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm");
@@ -293,11 +324,14 @@
 		boolean vip = userVIPInfoService.isVIP(uid);
 		// 鏄惁瀛樺湪濂栧姳鍒�
 		boolean hasRewardCoupon = userSystemCouponService.getValidRebateCoupon(uid);
-
+		long nowTime = java.lang.System.currentTimeMillis();
 		for (CommonOrderVO order : listOrder) {
 			String orderNo = order.getOrderNo();
 			Integer sourceType = order.getSourceType();
+			Integer hongBaoType = order.getHongBaoType();
 
+			BigDecimal totalPay = new BigDecimal(0);
+			BigDecimal totalActual = new BigDecimal(0);
 			// 鍟嗗搧淇℃伅缁勫悎
 			for (CommonOrderVO commonOrder : listGoods) {
 				CommonOrderGoods goods = commonOrder.getCommonOrderGoods();
@@ -327,7 +361,16 @@
 					}
 					commonGoodsVO.setActualPay("浠樻閲戦锛毬�" + totalSettlement);
 
-					Integer hongBaoType = order.getHongBaoType();
+					totalPay = MoneyBigDecimalUtil.add(totalPay, totalSettlement);
+
+					// 鍟嗗搧浠锋牸
+					BigDecimal actualPrice = commonGoodsVO.getActualPrice();
+					if (actualPrice != null) {
+						Integer totalCount = commonOrder.getTotalCount();
+						totalActual = MoneyBigDecimalUtil.add(totalActual,
+								MoneyBigDecimalUtil.mul(new BigDecimal(totalCount), actualPrice));
+					}
+
 					// 閭�璇疯鍗曚俊鎭繚鎶�
 					if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType
 							|| HongBaoV2.TYPE_ERJI == hongBaoType || HongBaoV2.TYPE_SHARE_YIJI == hongBaoType
@@ -356,9 +399,17 @@
 			}
 
 			Date thirdCreateTime = order.getThirdCreateTime();
-			if (thirdCreateTime != null) {
-				order.setDownTime("涓嬪崟鏃堕棿锛�" + format.format(thirdCreateTime));
-				order.setObtainTime(thirdCreateTime.getTime());
+			order.setDownTime("涓嬪崟鏃堕棿锛�" + format.format(thirdCreateTime));
+			order.setObtainTime(thirdCreateTime.getTime());
+
+			// 2.1鍒嗕韩璁㈠崟鍜岃繑鍒╄鍗曞疄浠橀噾棰濆ぇ浜庢垨鑰呭皬浜庡埜鍚庝环鐨勬椂鍊欙紝璁㈠崟椤甸潰 鍙樉绀�3澶� 涓嬪崟鏃堕棿寮�濮�
+			if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
+				if (HongBaoV2.TYPE_SHARE_YIJI == hongBaoType
+						&& DateUtil.plusDayDate(3, thirdCreateTime).getTime() > nowTime
+						&& totalPay.compareTo(totalActual) != 0) {
+					order.setFanliDesc("鐢卞疄浠橀噾棰�*杩斿埄姣旇绠楄�屾潵");
+					order.setFanliDescLink(configService.get(ConfigKeyEnum.shareOrderRebateDescLink.getKey()));
+				}
 			}
 
 			Date settleTime = order.getSettleTime();
@@ -446,7 +497,6 @@
 			// 璁㈠崟鏍囪瘑
 			List<String> signList = new ArrayList<String>();
 			/* 璁㈠崟杩斿埄绫诲瀷 杞崲 */
-			Integer hongBaoType = order.getHongBaoType();
 			if (HongBaoV2.TYPE_ZIGOU == hongBaoType || 2 == hongBaoType) {
 				// 鑷喘
 				hongbaoInfo = "杩斿埄";
@@ -902,11 +952,20 @@
 			wholeOrderState = CommonOrder.STATE_WHOLE_ORDER_BUFENYOUXIAO;
 
 		for (TaoBaoOrder taoBaoOrder : taoBaoOrders) {
-			CommonOrder newCommonOrder = TaoBaoOrderUtil.convert(taoBaoOrder);
+			CommonOrder newCommonOrder = CommonOrderFactory.create(taoBaoOrder);
 			CommonOrderGoods cog = new CommonOrderGoods();
-			cog.setGoodsId(taoBaoOrder.getAuctionId() + "");
-			cog.setGoodsType(Constant.SOURCE_TYPE_TAOBAO);
-			newCommonOrder.setCommonOrderGoods(cog);
+
+			if ("楗夸簡涔�".equalsIgnoreCase(taoBaoOrder.getOrderType())) {
+				cog.setGoodsId(taoBaoOrder.getTradeId() + "");
+				cog.setGoodsType(Constant.SOURCE_TYPE_ELME);
+				cog.setPicture("http://img.flqapp.com/resource/goods/elme_picture_demo.png");
+				cog.setTitle(taoBaoOrder.getTitle());
+				newCommonOrder.setCommonOrderGoods(cog);
+			} else {
+				cog.setGoodsId(taoBaoOrder.getAuctionId() + "");
+				cog.setGoodsType(Constant.SOURCE_TYPE_TAOBAO);
+				newCommonOrder.setCommonOrderGoods(cog);
+			}
 			newCommonOrder.setStateWholeOrder(wholeOrderState);
 			// 璁㈠崟鍟嗗搧鎻掑叆
 			List<CommonOrderGoods> commonGoodsList = commonOrderGoodsMapper.listByGoodsIdAndGoodsType(cog.getGoodsId(),
@@ -914,22 +973,25 @@
 			if (commonGoodsList.size() <= 0)// 涓嶅瓨鍦ㄥ氨鎻掑叆鍟嗗搧
 			{
 				TaoBaoGoodsBrief taoBaoGoods = null;
-				try {
-					taoBaoGoods = TaoKeApiUtil.getSimpleGoodsInfo(taoBaoOrder.getAuctionId());
-					LogManager.getLogger(LogType.taobaoGoods).info(String.format("璁㈠崟鍟嗗搧鍒嗙被:%s#%s#%s",
-							taoBaoGoods.getAuctionId(), taoBaoGoods.getRootCategoryName(), taoBaoGoods.getLeafName()));
-				} catch (TaobaoGoodsDownException e) {
-					e.printStackTrace();
-					LogHelper.errorDetailInfo(e, "AUCTIONID:" + taoBaoOrder.getAuctionId(), "");
+				if (cog.getGoodsType() != Constant.SOURCE_TYPE_ELME) {
 					try {
-						taoBaoGoods = TaoBaoUtil.getSimpleGoodsBrief(taoBaoOrder.getAuctionId());
-						// 璁板綍鍟嗗搧鍒嗙被
+						taoBaoGoods = TaoKeApiUtil.getSimpleGoodsInfo(taoBaoOrder.getAuctionId());
+						LogManager.getLogger(LogType.taobaoGoods)
+								.info(String.format("璁㈠崟鍟嗗搧鍒嗙被:%s#%s#%s", taoBaoGoods.getAuctionId(),
+										taoBaoGoods.getRootCategoryName(), taoBaoGoods.getLeafName()));
+					} catch (TaobaoGoodsDownException e) {
+						e.printStackTrace();
+						LogHelper.errorDetailInfo(e, "AUCTIONID:" + taoBaoOrder.getAuctionId(), "");
+						try {
+							taoBaoGoods = TaoBaoUtil.getSimpleGoodsBrief(taoBaoOrder.getAuctionId());
+							// 璁板綍鍟嗗搧鍒嗙被
 
-					} catch (Exception e1) {
-						CommonGoods commonGoods = commonGoodsService.getCommonGoodsByGoodsIdAndGoodsType(
-								taoBaoOrder.getAuctionId(), Constant.SOURCE_TYPE_TAOBAO);
-						if (commonGoods != null)
-							taoBaoGoods = TaoBaoUtil.convert(commonGoods);
+						} catch (Exception e1) {
+							CommonGoods commonGoods = commonGoodsService.getCommonGoodsByGoodsIdAndGoodsType(
+									taoBaoOrder.getAuctionId(), Constant.SOURCE_TYPE_TAOBAO);
+							if (commonGoods != null)
+								taoBaoGoods = TaoBaoUtil.convert(commonGoods);
+						}
 					}
 				}
 				if (taoBaoGoods != null) {
@@ -942,6 +1004,7 @@
 			newCommonOrder.setUserInfo(new UserInfo(uid));
 			commonOrderList.add(addCommonOrder(newCommonOrder));
 		}
+		addConfirmMQMsg(commonOrderList);
 		return commonOrderList;
 	}
 
@@ -992,7 +1055,53 @@
 			newCommonOrder.setUserInfo(new UserInfo(uid));
 			commonOrderList.add(addCommonOrder(newCommonOrder));
 		}
+		addConfirmMQMsg(commonOrderList);
 		return commonOrderList;
+	}
+
+	private void addConfirmMQMsg(List<CommonOrderAddResultDTO> resultList) {
+
+		// 璁㈠崟鏄惁鏂板鎴栬�呮洿鏂拌繃
+		boolean isAddOrUpdate = false;
+		for (CommonOrderAddResultDTO dto : resultList)
+			if (dto.getType() == CommonOrderAddResultDTO.TYPE_ADD
+					|| dto.getType() == CommonOrderAddResultDTO.TYPE_UPDATE) {
+				isAddOrUpdate = true;
+				break;
+			}
+		boolean hasSettleOrder = false;
+		// 鏌ヨ鏄惁鏈夌粨绠楃殑璁㈠崟
+		if (isAddOrUpdate) {
+			for (CommonOrderAddResultDTO dto : resultList) {
+				if (dto.getCommonOrder().getSettleTime() != null && dto.getCommonOrder().getSettlement() != null) {
+					hasSettleOrder = true;
+					break;
+				}
+			}
+		}
+		// 鏈夌粨绠楃殑璁㈠崟
+		if (hasSettleOrder) {
+			if (!Constant.IS_TEST) {
+				// 缁熻缁撶畻閲戦
+				BigDecimal settlement = new BigDecimal("0");
+				CommonOrder firstOrder = null;
+				for (CommonOrderAddResultDTO dto : resultList)
+					if (dto.getCommonOrder().getSettlement() != null) {
+						settlement = settlement.add(dto.getCommonOrder().getSettlement());
+						if (firstOrder == null)
+							firstOrder = dto.getCommonOrder();
+					}
+				if (firstOrder != null) {
+					Date placeDate = firstOrder.getThirdCreateTime();
+					OrderConfirmMQMsg mqMsg = new OrderConfirmMQMsg(firstOrder.getOrderNo(), firstOrder.getSourceType(),
+							settlement, firstOrder.getUserInfo().getId(), placeDate, new Date());
+					Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderConfirm,
+							mqMsg);
+					orderProducer.send(msg);
+				}
+			}
+		}
+
 	}
 
 	@Transactional(rollbackFor = Exception.class)
@@ -1057,6 +1166,7 @@
 			newCommonOrder.setUserInfo(new UserInfo(uid));
 			commonOrderList.add(addCommonOrder(newCommonOrder));
 		}
+		addConfirmMQMsg(commonOrderList);
 		return commonOrderList;
 	}
 
@@ -1240,7 +1350,7 @@
 	@Override
 	public List<CommonOrderVO> listQuery(long start, int count, Integer keyType, String key, Integer state,
 			Integer type, Integer orderState, String startTime, String endTime, Integer source, List<Long> listShopId,
-			List<Long> listGoodsId, Date minTime, BigDecimal money,BigDecimal payment) throws CommonOrderException {
+			List<Long> listGoodsId, Date minTime, BigDecimal money, BigDecimal payment) throws CommonOrderException {
 
 		List<CommonOrderVO> list = null;
 
@@ -1249,7 +1359,7 @@
 					startTime, endTime, source, payment);
 		} else {
 			list = commonOrderMapper.listQuery(start, count, keyType, key, state, type, orderState, startTime, endTime,
-					source, listShopId, listGoodsId, minTime, money,payment);
+					source, listShopId, listGoodsId, minTime, money, payment);
 		}
 
 		if (list == null) {
@@ -1436,7 +1546,7 @@
 	@Override
 	public long countQuery(Integer keyType, String key, Integer state, Integer type, Integer orderState,
 			String startTime, String endTime, Integer source, List<Long> listShopId, List<Long> listGoodsId,
-			Date minTime, BigDecimal money,BigDecimal payment) throws CommonOrderException {
+			Date minTime, BigDecimal money, BigDecimal payment) throws CommonOrderException {
 		if (StringUtil.isNullOrEmpty(key) || keyType == 1) {// 鎼滅储妗嗘棤鍊兼垨鑰呮寜璁㈠崟鍙锋悳绱㈡椂閮藉彧鎼滅储涓昏鍗�
 			return commonOrderMapper.countQueryWithNoChild(keyType, key, state, type, orderState, startTime, endTime,
 					source, payment);
@@ -1673,7 +1783,8 @@
 	}
 
 	@Override
-	public List<CommonOrderVO> searchOrderByUid(int page, int size, Long uid, List<ESOrder> list) throws Exception {
+	public List<CommonOrderVO> searchOrderByUid(AcceptData acceptData, int page, int size, Long uid, List<ESOrder> list)
+			throws Exception {
 		List<CommonOrderVO> listVO = commonOrderMapper.searchOrderByUid((page - 1) * size, size, uid, list);
 
 		// 璁㈠崟淇℃伅涓虹┖
@@ -1690,7 +1801,7 @@
 		}
 
 		// 鏁版嵁鍔犲伐閲嶆柊缁勭粐
-		orderVOFactoryNew(listVO, listGoods, uid);
+		orderVOFactoryNew(acceptData, listVO, listGoods, uid);
 
 		return listVO;
 	}
@@ -1703,8 +1814,8 @@
 	 * @param listGoods
 	 * @param uid
 	 */
-	private void orderVOFactoryNew(List<CommonOrderVO> listOrder, List<CommonOrderVO> listGoods, Long uid)
-			throws Exception {
+	private void orderVOFactoryNew(AcceptData acceptData, List<CommonOrderVO> listOrder, List<CommonOrderVO> listGoods,
+			Long uid) throws Exception {
 		List<String> listTB = new ArrayList<String>();
 		List<String> listJD = new ArrayList<String>();
 		List<String> listPDD = new ArrayList<String>();
@@ -1747,21 +1858,38 @@
 		}
 		Map<Long, Boolean> vipUserMap = userVIPInfoService.listByUids(needSelectVIPUidList);
 
-		// 璁剧疆鏄惁涓簐ip璁㈠崟
-		for (CommonOrderVO order : listOrder) {
-			if (order.getHongBaoType() == HongBaoV2.TYPE_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_ERJI
-					|| order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI
-					|| order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI) {
-				if (vipUserMap.get(Long.parseLong(order.getUserId())) != null
-						&& vipUserMap.get(Long.parseLong(order.getUserId())) == true)
-					order.setVipOrder(true);
-				else
-					order.setVipOrder(false);
-			} else
-				order.setVipOrder(false);
+		if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
+			for (CommonOrderVO order : listOrder) {
+				if (order.getHongBaoType() == HongBaoV2.TYPE_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_ERJI
+						|| order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI
+						|| order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI) {
+					Integer urank = order.getUrank();
+					if (urank != null) {
+						String levelName = UserLevelUtil.getLevelName(urank);
+						if (!StringUtil.isNullOrEmpty(levelName)) {
+							order.setOrderDesc(levelName);
+						}
+					}
+				}
 
-			if (order.isVipOrder())
-				order.setVipOrderDesc("璁㈠崟鏉ユ簮锛氱敱瓒呯骇浼氬憳鐨勭矇涓濅骇鐢�");
+			}
+		} else {
+			// 璁剧疆鏄惁涓簐ip璁㈠崟
+			for (CommonOrderVO order : listOrder) {
+				if (order.getHongBaoType() == HongBaoV2.TYPE_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_ERJI
+						|| order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI
+						|| order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI) {
+					if (vipUserMap.get(Long.parseLong(order.getUserId())) != null
+							&& vipUserMap.get(Long.parseLong(order.getUserId())) == true)
+						order.setVipOrder(true);
+					else
+						order.setVipOrder(false);
+				} else
+					order.setVipOrder(false);
+
+				if (order.isVipOrder())
+					order.setVipOrderDesc("璁㈠崟鏉ユ簮锛氱敱瓒呯骇浼氬憳鐨勭矇涓濅骇鐢�");
+			}
 		}
 
 		SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm");
@@ -1774,9 +1902,14 @@
 		// 鏄惁瀛樺湪濂栧姳鍒�
 		boolean hasRewardCoupon = userSystemCouponService.getValidRebateCoupon(uid);
 
+		long nowTime = java.lang.System.currentTimeMillis();
 		for (CommonOrderVO order : listOrder) {
 			String orderNo = order.getOrderNo();
 			Integer sourceType = order.getSourceType();
+			Integer hongBaoType = order.getHongBaoType();
+
+			BigDecimal totalPay = new BigDecimal(0);
+			BigDecimal totalActual = new BigDecimal(0);
 
 			// 鍟嗗搧淇℃伅缁勫悎
 			for (CommonOrderVO commonOrder : listGoods) {
@@ -1807,7 +1940,16 @@
 					}
 					commonGoodsVO.setActualPay("浠樻閲戦锛毬�" + totalSettlement);
 
-					Integer hongBaoType = order.getHongBaoType();
+					totalPay = MoneyBigDecimalUtil.add(totalPay, totalSettlement);
+
+					// 鍟嗗搧浠锋牸
+					BigDecimal actualPrice = commonGoodsVO.getActualPrice();
+					if (actualPrice != null) {
+						Integer totalCount = commonOrder.getTotalCount();
+						totalActual = MoneyBigDecimalUtil.add(totalActual,
+								MoneyBigDecimalUtil.mul(new BigDecimal(totalCount), actualPrice));
+					}
+
 					// 閭�璇疯鍗曚俊鎭繚鎶�
 					if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType
 							|| HongBaoV2.TYPE_ERJI == hongBaoType || HongBaoV2.TYPE_SHARE_YIJI == hongBaoType
@@ -1839,6 +1981,16 @@
 			if (thirdCreateTime != null) {
 				order.setDownTime("涓嬪崟鏃堕棿锛�" + format.format(thirdCreateTime));
 				order.setObtainTime(thirdCreateTime.getTime());
+			}
+
+			// 2.1鍒嗕韩璁㈠崟鍜岃繑鍒╄鍗曞疄浠橀噾棰濆ぇ浜庢垨鑰呭皬浜庡埜鍚庝环鐨勬椂鍊欙紝璁㈠崟椤甸潰 鍙樉绀�3澶� 涓嬪崟鏃堕棿寮�濮�
+			if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
+				if (HongBaoV2.TYPE_SHARE_GOODS == hongBaoType
+						&& DateUtil.plusDayDate(3, thirdCreateTime).getTime() > nowTime
+						&& totalPay.compareTo(totalActual) != 0) {
+					order.setFanliDesc("鐢卞疄浠橀噾棰�*杩斿埄姣旇绠楄�屾潵");
+					order.setFanliDescLink(configService.get(ConfigKeyEnum.shareOrderRebateDescLink.getKey()));
+				}
 			}
 
 			Date settleTime = order.getSettleTime();
@@ -1915,7 +2067,6 @@
 			// 璁㈠崟鏍囪瘑
 			List<String> signList = new ArrayList<String>();
 			/* 璁㈠崟杩斿埄绫诲瀷 杞崲 */
-			Integer hongBaoType = order.getHongBaoType();
 			if (HongBaoV2.TYPE_ZIGOU == hongBaoType || 2 == hongBaoType) {
 				// 鑷喘
 				hongbaoInfo = "杩斿埄";
@@ -2184,4 +2335,12 @@
 		}
 	}
 
+	@Override
+	public Date getThirdCreateTime(String orderId, int sourceType) {
+		List<CommonOrder> list = listBySourceTypeAndOrderId(sourceType, orderId);
+		if (list == null || list.size() == 0)
+			return null;
+		return list.get(0).getThirdCreateTime();
+	}
+
 }

--
Gitblit v1.8.0