From 27c1fd58461e2fd15be392b3c308b4343af8d973 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期三, 01 四月 2020 14:53:50 +0800
Subject: [PATCH] 发圈统计

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java |   70 +++++++++++++++++++++--------------
 1 files changed, 42 insertions(+), 28 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 56fd1cb..b4e7db2 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
@@ -63,6 +63,7 @@
 import com.yeshi.fanli.service.inter.user.UserInfoService;
 import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService;
 import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
+import com.yeshi.fanli.service.inter.user.invite.UserInviteService;
 import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
 import com.yeshi.fanli.util.Constant;
 import com.yeshi.fanli.util.MoneyBigDecimalUtil;
@@ -135,6 +136,9 @@
 
 	@Resource
 	private UserInfoService userInfoService;
+	
+	@Resource
+	private UserInviteService userInviteService;
 
 	@Resource(name = "producer")
 	private Producer orderProducer;
@@ -1730,6 +1734,14 @@
 		return commonOrderMapper.countSearchOrderByUid(uid, list);
 	}
 
+	
+	@Override
+	public List<CommonOrder> getMinSettleTimeAndUid() {
+		return commonOrderMapper.getMinSettleTimeAndUid();
+	}
+
+	
+	
 	@Override
 	public List<CommonOrderVO> searchOrderByUid(AcceptData acceptData, int page, int size, Long uid, List<ESOrder> list)
 			throws Exception {
@@ -1824,8 +1836,8 @@
 		// 2019.8.1寮�濮嬭繑鍥炵淮鏉冧俊鎭�
 		Date august = TimeUtil.parse("2019-08-01");
 
-		// 褰撳墠鐢ㄦ埛鏄惁VIP
-		boolean vip = userVIPInfoService.isVIP(uid);
+		// 褰撳墠鐢ㄦ埛鏄惁鍙互浣跨敤濂栧姳鍒�
+		boolean isvip = userInviteService.verifyVIP(uid);
 		// 鏄惁瀛樺湪濂栧姳鍒�
 		boolean hasRewardCoupon = userSystemCouponService.getValidRebateCoupon(uid);
 
@@ -1844,7 +1856,9 @@
 				if (sourceType.equals(commonOrder.getSourceType()) && orderNo.equals(commonOrder.getOrderNo())) {
 					CommonOrderGoodsVO commonGoodsVO = new CommonOrderGoodsVO();
 					PropertyUtils.copyProperties(commonGoodsVO, goods);
-					commonGoodsVO.setGoodsType(sourceType);
+					if (commonGoodsVO.getGoodsType() == null) {
+						commonGoodsVO.setGoodsType(sourceType);
+					}
 
 					// 娣樺疂鍟嗗搧鍥剧墖澶勭悊
 					String picture = commonGoodsVO.getPicture();
@@ -1876,24 +1890,35 @@
 					}
 
 					// 璁㈠崟绫诲瀷涓虹┖鏃� 宸插晢鍝佺被涓哄噯
-					Integer orderType = order.getOrderType();
-					if (orderType == null) {
-						String shopType = commonGoodsVO.getShopType();
-						if (CommonOrderGoodsVO.TYPE_TAOBAO.equalsIgnoreCase(shopType)) {
-							order.setOrderType(1);
-						} else if (CommonOrderGoodsVO.TYPE_TMALL.equalsIgnoreCase(shopType)) {
-							order.setOrderType(2);
-						}
+					String shopType = commonGoodsVO.getShopType();
+					if (CommonOrderGoodsVO.TYPE_TAOBAO.equalsIgnoreCase(shopType)) {
+						order.setOrderType(1);
+					} else if (CommonOrderGoodsVO.TYPE_TMALL.equalsIgnoreCase(shopType)) {
+						order.setOrderType(2);
 					}
 					
 					Integer goodsType = commonGoodsVO.getGoodsType();
-					if (goodsType != null & goodsType == 6) {
-						order.setOrderType(5); // 楗夸簡涔堣鍗�
+					if (goodsType != null & goodsType == Constant.SOURCE_TYPE_ELME) {
+						order.setOrderType(Constant.SOURCE_TYPE_ELME); // 楗夸簡涔堣鍗�
 					}
 
 					order.getListOrderGoods().add(commonGoodsVO);
 				}
 			}
+			
+			
+			// 璁㈠崟绫诲瀷
+			if (sourceType == Constant.SOURCE_TYPE_TAOBAO) {
+				Integer orderType = order.getOrderType();
+				if (orderType == null) {
+					order.setOrderType(1);
+				}
+			} else if (sourceType == Constant.SOURCE_TYPE_JD) {
+				order.setOrderType(3);
+			} else if (sourceType == Constant.SOURCE_TYPE_PDD) {
+				order.setOrderType(4);
+			}
+						
 
 			Date thirdCreateTime = order.getThirdCreateTime();
 			if (thirdCreateTime != null) {
@@ -1906,16 +1931,6 @@
 				order.setReceiveTime("鏀惰揣鏃堕棿锛�" + format.format(settleTime));
 			}
 
-			// 璁㈠崟绫诲瀷
-			if (sourceType == Constant.SOURCE_TYPE_TAOBAO) {
-				Integer orderType = order.getOrderType();
-				if (orderType == null)
-					order.setOrderType(1);
-			} else if (sourceType == Constant.SOURCE_TYPE_JD) {
-				order.setOrderType(3);
-			} else if (sourceType == Constant.SOURCE_TYPE_PDD) {
-				order.setOrderType(4);
-			}
 
 			/* 璁㈠崟鐘舵�� 杞崲澶勭悊 */
 			String orderStateContent = "";
@@ -1966,7 +1981,6 @@
 					List<TaoBaoWeiQuanOrder> listWQ = taoBaoWeiQuanOrderMapper
 							.selectListByOrderIdAndState(order.getOrderNo(), "缁存潈鎴愬姛");
 
-					boolean isPart = false;// 榛樿澶辨晥
 					BigDecimal weiQuanMoney = getWeiQuanMoney(listWQ, sourceType, uid);
 					if (settleTime != null && august != null && settleTime.getTime() > august.getTime()) {
 						orderStateContent = "鍞悗鎴愬姛";
@@ -2101,13 +2115,13 @@
 			if (HongBaoV2.TYPE_ZIGOU == hongBaoType) {
 				// 濂栧姳璁㈠崟銆佸厤鍗� 浣跨敤璁板綍
 				if (sourceType == null) {
-					couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, null, uid, vip);
+					couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, null, uid, isvip);
 				} else if (sourceType == Constant.SOURCE_TYPE_TAOBAO) {
-					couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordTB, uid, vip);
+					couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordTB, uid, isvip);
 				} else if (sourceType == Constant.SOURCE_TYPE_JD) {
-					couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordJD, uid, vip);
+					couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordJD, uid, isvip);
 				} else if (sourceType == Constant.SOURCE_TYPE_PDD) {
-					couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordPDD, uid, vip);
+					couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordPDD, uid, isvip);
 				}
 			}
 

--
Gitblit v1.8.0