From 0f52108bac0ebf47a563c41bcb97d934b7cf12ab Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期三, 11 十二月 2019 15:07:06 +0800
Subject: [PATCH] 订单筛选

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java |   89 ++++++++++++++++++++++----------------------
 1 files changed, 44 insertions(+), 45 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 d6bfb98..012c740 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
@@ -213,9 +213,9 @@
 	 * @param list
 	 * @param signList
 	 */
-	public void setSystemCouponRecord(CommonOrderVO order, boolean hasRewardCoupon, boolean exchangeCoupon,
-			Integer hongBaoState, Integer hongBaoType, List<UserSystemCouponRecord> list, List<String> signList,
-			AcceptData acceptData) {
+	public void setSystemCouponRecord(CommonOrderVO order, boolean hasRewardCoupon,	Integer hongBaoState,
+			Integer hongBaoType, List<UserSystemCouponRecord> list, List<String> signList,
+			Long uid, AcceptData acceptData) {
 
 		// 鏄惁鍏嶅崟鍟嗗搧
 		boolean freeOrder = false;
@@ -262,34 +262,34 @@
 		// 璁㈠崟鏍囪瘑
 		order.setSignList(signList);
 
-		// 1.6.5 鏄惁瀛樺湪鏂板厬鎹㈢殑鍒�
-		if (!hasRewardCoupon && exchangeCoupon) {
-			try {
-				Date thirdCreateTime = order.getThirdCreateTime();
-				if (thirdCreateTime != null) {
-					long downOrderTime = thirdCreateTime.getTime();
-					long limitDate = TimeUtil.convertDateToTemp("2019-09-10");
-					if (downOrderTime > limitDate)
-						hasRewardCoupon = true;
-				}
-			} catch (Exception e) {
-				e.printStackTrace();
-			}
-		}
-
-		boolean rewardOrder = false;
 		int type = 1; // 1 甯歌璺宠浆椤甸潰 2寮瑰嚭閫夐」锛堝鍔卞埜锛�
-		if (rewardSuccess) {
-			if (!VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
-				rewardOrder = true; // 濂栧姳鎴愬姛 2.0.2 娑堝け
+		boolean rewardOrder = false;
+		
+		if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
+			if (rewardSuccess) { 
+				rewardOrder = true; // 浠ュ墠鐗堟湰濂栧姳鎴愬姛 鐨勬樉绀哄叆鍙�
+			}
+			
+			// 宸插埌璐︾殑杩斿埄璁㈠崟銆侀潪浼氬憳鍙娇鐢ㄥ鍔卞埜
+			if (!freeOrder && HongBaoV2.TYPE_ZIGOU == hongBaoType && HongBaoV2.STATE_YILINGQU == hongBaoState
+					&& !userVIPInfoService.isVIP(uid)) { 
+				type = 2; 
+				rewardOrder = true; 
 			}
 		} else if (hasRewardCoupon && !freeOrder && HongBaoV2.TYPE_ZIGOU == hongBaoType
-				&& HongBaoV2.STATE_YILINGQU == hongBaoState) {
-			// 鏈夊彲鐢ㄧ殑濂栧姳鍒� 銆侀潪鍏嶅崟璁㈠崟 銆佷笖宸插埌璐︾殑 銆佽繑鍒╄鍗�
-			type = 2;
-			rewardOrder = true;
+					&& HongBaoV2.STATE_YILINGQU == hongBaoState && !userVIPInfoService.isVIP(uid)) {
+			 // 鏈夊彲鐢ㄧ殑濂栧姳鍒� 銆侀潪鍏嶅崟璁㈠崟 銆佷笖宸插埌璐︾殑 銆佽繑鍒╄鍗曘�� 闈炶秴绾т細鍛�
+			type = 2; 
+			rewardOrder = true; 
 		}
-
+		
+		// 缁存潈璁㈠崟 涓嶅彲浣跨敤
+		Integer orderState = order.getState();
+		if(CommonOrder.STATE_WQ == orderState) {
+			rewardOrder = false;
+		}
+		
+		
 		if (rewardOrder) {
 			try {
 				boolean newEdition = false;
@@ -297,16 +297,16 @@
 				String unit = null;
 				boolean canUse = false;
 
-				// 鐗堟湰鍖哄垎锛�2.1
+				// 鐗堟湰鍖哄垎锛�2.1  濂栧姳鍒稿�掕鏃�
 				if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
 					Date thirdCreateTime = order.getThirdCreateTime();
-					if (thirdCreateTime != null) {
+					Date accountTime = order.getAccountTime();
+					if (thirdCreateTime != null && accountTime != null) {
 						long downOrderTime = thirdCreateTime.getTime();
-						long limitDate = Long.parseLong("1571760000000"); // TODO
-																			// 鏃ユ湡寰呯‘瀹�2019-11-10
+						long limitDate = TimeUtil.parse(Constant.COUPON_REWARD_TIME).getTime();
 						if (downOrderTime > limitDate) {
 							newEdition = true;
-							Date endDay = DateUtil.plusDayDate(4, thirdCreateTime);
+							Date endDay = DateUtil.plusDayDate(Constant.COUPON_REWARD_LIMIT_DAY, accountTime);
 							long currentTime = java.lang.System.currentTimeMillis();
 							if (endDay.getTime() > currentTime) {
 								DateInfo dateInfo = DateUtil.dateDiff3(currentTime, endDay.getTime());
@@ -469,8 +469,7 @@
 		Date august = TimeUtil.parse("2019-08-01");
 
 		// 鏄惁瀛樺湪濂栧姳鍒�
-		boolean hasRewardCoupon = userSystemCouponService.getIncludeNotExchange(uid);
-		boolean exchangeCoupon = userSystemCouponService.getIncludeExchange(uid);
+		boolean hasRewardCoupon = userSystemCouponService.getValidRebateCoupon(uid);
 
 		// 闇�瑕佹煡璇㈡槸鍚︿负VIP鐨勭敤鎴稩D,鍙湁閭�璇疯鍗曟墠闇�瑕佹煡璇�
 		List<Long> needSelectVIPUidList = new ArrayList<>();
@@ -615,7 +614,7 @@
 			} else if (CommonOrder.STATE_SX == orderState) {
 				orderStateContent = "鏈粯娆�/宸查��娆�";
 			} else if (CommonOrder.STATE_WQ == orderState) {
-				orderStateContent = "宸茬淮鏉�";
+				orderStateContent = "宸插敭鍚�";
 				if (sourceType != null && sourceType == Constant.SOURCE_TYPE_TAOBAO) {
 					/* 璁㈠崟缁存潈 鍒ゆ柇鏄惁鍏ㄩ儴缁存潈 */
 					List<TaoBaoWeiQuanOrder> listWQ = taoBaoWeiQuanOrderMapper
@@ -633,11 +632,11 @@
 					} else {
 						// 2019.8.1 杩斿洖缁存潈淇℃伅
 						if (settleTime != null && august != null && settleTime.getTime() > august.getTime()) {
-							orderStateContent = "缁存潈鎴愬姛";
+							orderStateContent = "鍞悗鎴愬姛";
 							WeiQuanInfo weiQuanInfo = new WeiQuanInfo();
 							weiQuanInfo.setOldHongBao("楼" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString());
 							weiQuanInfo
-									.setWqHongBao("缁存潈锛�-楼" + weiQuanMoney.setScale(2, BigDecimal.ROUND_DOWN).toString());
+									.setWqHongBao("鍞悗锛�-楼" + weiQuanMoney.setScale(2, BigDecimal.ROUND_DOWN).toString());
 							hongBao = MoneyBigDecimalUtil.sub(hongBao, weiQuanMoney);
 							order.setWeiQuanInfo(weiQuanInfo);
 						}
@@ -771,17 +770,17 @@
 			} else {
 				// 濂栧姳璁㈠崟銆佸厤鍗� 浣跨敤璁板綍
 				if (sourceType == null) {
-					setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType, null,
-							signList, acceptData);
+					setSystemCouponRecord(order, hasRewardCoupon, hongBaoState, hongBaoType, null,
+							signList, uid, acceptData);
 				} else if (sourceType == Constant.SOURCE_TYPE_TAOBAO) {
-					setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType,
-							listRecordTB, signList, acceptData);
+					setSystemCouponRecord(order, hasRewardCoupon, hongBaoState, hongBaoType,
+							listRecordTB, signList, uid, acceptData);
 				} else if (sourceType == Constant.SOURCE_TYPE_JD) {
-					setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType,
-							listRecordJD, signList, acceptData);
+					setSystemCouponRecord(order, hasRewardCoupon, hongBaoState, hongBaoType,
+							listRecordJD, signList, uid, acceptData);
 				} else if (sourceType == Constant.SOURCE_TYPE_PDD) {
-					setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType,
-							listRecordPDD, signList, acceptData);
+					setSystemCouponRecord(order, hasRewardCoupon, hongBaoState, hongBaoType,
+							listRecordPDD, signList, uid, acceptData);
 				}
 			}
 

--
Gitblit v1.8.0