From 5c4ecf9e8b47efbbf5d21c9e109be0a60cb7e26d Mon Sep 17 00:00:00 2001
From: yujian <yujian>
Date: 星期一, 08 四月 2019 15:15:09 +0800
Subject: [PATCH] 冲突解决

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java
index b064408..aa8ede9 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java
@@ -181,7 +181,15 @@
 			throw new UserSystemCouponException(1, "鍙傛暟涓嶆纭�");
 		}
 
-		SystemCoupon coupon = systemCouponService.getCouponByType(couponType);
+		SystemCoupon coupon = null;
+		if (couponType.equals(CouponTypeEnum.welfareFreeCoupon.name())) {
+			// 绂忓埄鍏嶅崟鍒�
+			coupon = systemCouponService.getCouponByType(couponType);
+		} else if (couponType.equals(CouponTypeEnum.rebatePercentCoupon.name())) {
+			// 濂栧姳鍒�10%
+			coupon = systemCouponService.getCouponByTypeAndPercent(couponType,new BigDecimal(10));
+		}
+		
 		if (coupon == null) {
 			throw new UserSystemCouponException(1, "鍒哥被鍨嬩笉姝g‘");
 		}
@@ -521,6 +529,7 @@
 	@Transactional
 	@Override
 	public List<UserSystemCouponVO> getOrderCouponList(Long uid) throws UserSystemCouponException, Exception {
+		
 		if (uid == null) {
 			throw new UserSystemCouponException(1, "鐢ㄦ埛鏈櫥褰�");
 		}
@@ -530,7 +539,7 @@
 		// 閫�鍥炲埜
 		sendBackTimeOutCoupon(uid);
 		// 娲诲姩棰嗗彇鍒�
-		receivedCoupon(uid);
+//		receivedCoupon(uid);
 
 		// 璁㈠崟鐩稿叧鐨勫埜
 		List<SystemCoupon> couponList = systemCouponService.getOrderCouponList();
@@ -560,7 +569,7 @@
 		sendBackTimeOutCoupon(uid);
 		
 		// 娲诲姩棰嗗彇鍒�
-		receivedCoupon(uid);
+//		receivedCoupon(uid);
 
 		// 鍟嗗搧鐩稿叧鐨勫埜
 		List<SystemCoupon> couponList = systemCouponService.getGoodsCouponList();
@@ -1222,8 +1231,8 @@
 	@Transactional
 	@Override
 	public void sendBackTimeOutCoupon(Long uid) {
-		// 瓒呰繃120绉� 鏈鍖归厤鐨勫埜
-		List<UserSystemCouponRecord> list = userSystemCouponRecordService.getCouponByUsingTimeOut(uid, 120L);
+		// 瓒呰繃10鍒嗛挓   鏈鍖归厤鐨勫埜
+		List<UserSystemCouponRecord> list = userSystemCouponRecordService.getCouponByUsingTimeOut(uid,600L);
 		if (list == null || list.size() == 0) {
 			return;
 		}
@@ -1447,7 +1456,7 @@
 
 			UserSystemCoupon userCoupon = new UserSystemCoupon();
 			userCoupon.setUid(uid);
-			userCoupon.setSource(UserSystemCoupon.SOURCE_CHOUJIANG);
+			userCoupon.setSource(UserSystemCoupon.SOURCE_NEWBIES);
 			userCoupon.setSystemCoupon(systemCoupon);
 			userCoupon.setState(UserSystemCoupon.STATE_CAN_USE);
 			userCoupon.setStateActivated(stateActivated);
@@ -1545,7 +1554,6 @@
 			}
 			
 			if (receive) {
-				
 				// 鎻掑叆璁板綍
 				PushCouponRecord pushCouponRecord = new PushCouponRecord();
 				pushCouponRecord.setPushCoupon(pushCoupon);

--
Gitblit v1.8.0