From e6269b00183bf7f46c494fa15ab75d702d2764ab Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期四, 12 九月 2019 15:16:01 +0800
Subject: [PATCH] 红包口令  失效金额bug

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java |   45 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 44 insertions(+), 1 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 bcf2dbe..207fb6a 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
@@ -647,7 +647,44 @@
 
 		return list;
 	}
+	
 
+	@Override
+	public long countUsableFreeCouponForBuy (Long uid) {
+		if (uid == null) 
+			return 0;
+		
+		List<SystemCoupon> couponList = systemCouponService.getGoodsCouponList();
+		if (couponList == null || couponList.size() == 0)
+			return 0;
+		
+		List<Long> listCouponId = new ArrayList<Long>();
+		for (SystemCoupon systemCoupon : couponList) {
+			listCouponId.add(systemCoupon.getId());
+		}
+		
+		return userSystemCouponMapper.countUsableByUid(uid, listCouponId);
+	}
+	
+	
+	@Override
+	public long countUsableRewardCoupon (Long uid) {
+		if (uid == null) 
+			return 0;
+		
+		List<SystemCoupon> couponList = systemCouponService.getOrderCouponList();
+		if (couponList == null || couponList.size() == 0)
+			return 0;
+		
+		List<Long> listCouponId = new ArrayList<Long>();
+		for (SystemCoupon systemCoupon : couponList) {
+			listCouponId.add(systemCoupon.getId());
+		}
+		
+		return userSystemCouponMapper.countUsableByUid(uid, listCouponId);
+	}
+	
+	
 	@Transactional
 	@Override
 	public void useGoodsCoupon(Long uid, Long id, Long goodId, Integer sourceType) throws UserSystemCouponException, Exception {
@@ -1753,7 +1790,7 @@
 				
 				if (CouponTypeEnum.rebatePercentCoupon == type) {
 					userCouponVO.setState(UserSystemCoupon.STATE_GIVE_IN);
-					tips = configService.get("give_free_coupon_tips");
+					tips = configService.get("give_rebate_percent_coupon_tips");
 					tokenType = TokenTypeEnum.rebatePercentCoupon;
 				}
 				
@@ -2379,4 +2416,10 @@
 
 		return listCoupon;
 	}
+	
+	
+	@Override
+	public List<UserSystemCoupon> getFreeCouponByType(Long uid, String type) {
+		return userSystemCouponMapper.getFreeCouponByType(uid, type);
+	}
 }

--
Gitblit v1.8.0