From 89cc3286104f6ceaf664fa23647be40a84fcd2c4 Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期三, 28 八月 2019 17:04:35 +0800
Subject: [PATCH] ios 版本1.65改为65

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java |   48 +++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 41 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 80019c7..684416c 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
@@ -310,6 +310,9 @@
 			return null;
 		}
 
+		// 杩囨湡鍒�
+		updateInvalidSate(uid);
+		
 		// 閫�鍥炲埜
 		sendBackTimeOutCoupon(uid);
 		
@@ -573,6 +576,9 @@
 			throw new UserSystemCouponException(1, "鐢ㄦ埛鏈櫥褰�");
 		}
 
+		// 杩囨湡鍒�
+		updateInvalidSate(uid);
+		
 		// 閫�鍥炲埜
 		sendBackTimeOutCoupon(uid);
 
@@ -598,6 +604,9 @@
 			throw new UserSystemCouponException(1, "鍟嗗搧ID涓虹┖");
 		}
 
+		// 杩囨湡鍒�
+		updateInvalidSate(uid);
+		
 		// 閫�鍥炲埜
 		sendBackTimeOutCoupon(uid);
 		
@@ -1224,10 +1233,7 @@
 		return userSystemCouponMapper.getCounponNowInvalid(count);
 	}
 	
-
 	
-
-
 	@Transactional
 	@Override
 	public boolean updateCouponRecordUsed(Long uid, String orderNo, BigDecimal payment, Long auctionId)
@@ -1600,9 +1606,14 @@
 	@Override
 	public List<UserSystemCouponVO> getCouponList(long start, int count, Long uid)
 			throws UserSystemCouponException, Exception {
+	
+		// 杩囨湡鍒�
+		updateInvalidSate(uid);
+		
 		// 閫�鍥炲埜
 		sendBackTimeOutCoupon(uid);
 
+		
 		List<UserSystemCouponVO> listVO = userSystemCouponMapper.getUserCouponVOList(start, count, uid);
 		if (listVO == null || listVO.size() == 0) {
 			return listVO;
@@ -1787,7 +1798,7 @@
 					Date useTime = userCouponVO.getUseTime();
 					if (useTime != null) {
 						Map<String, Object> remainDays = new HashMap<String, Object>();
-						remainDays.put("content", "浜�" + sdf.format(useTime) + "鎴愬姛璧犻��");
+						remainDays.put("content", "浜�" + sdf.format(useTime) + "璧犻��");
 						remainDays.put("fontColor", "#CCCCCC");
 						userCouponVO.setRemainDays(remainDays);
 					}
@@ -1795,7 +1806,7 @@
 					Date useTime = userCouponVO.getUseTime();
 					if (useTime != null) {
 						Map<String, Object> remainDays = new HashMap<String, Object>();
-						remainDays.put("content", "浜�" + sdf.format(useTime) + "鎴愬姛浣跨敤");
+						remainDays.put("content", "浜�" + sdf.format(useTime) + "浣跨敤");
 						remainDays.put("fontColor", "#CCCCCC");
 						userCouponVO.setRemainDays(remainDays);
 					}
@@ -1954,6 +1965,17 @@
 	}
 
 	
+	@Transactional
+	@Override
+	public void updateInvalidSate(Long uid) {
+		List<UserSystemCoupon> list = userSystemCouponMapper.getCounponNowInvalidByUid(uid);
+		if (list == null || list.size() == 0) {
+			return;
+		}
+		updateCounponInvalid(list);
+	}
+	
+	
 	@Override
 	public void updateCounponInvalid(List<UserSystemCoupon> list) {
 		if (list == null || list.size() == 0) {
@@ -1998,6 +2020,7 @@
 			}
 		}
 	}
+	
 	
 	/**
 	 * 閫�鍥炲埜 鍒濆鏁版嵁
@@ -2065,8 +2088,8 @@
 			couponRecord.setUpdateTime(new Date());
 			userSystemCouponRecordService.updateByPrimaryKeySelective(couponRecord);
 
-			UserSystemCoupon userSystemCoupon = couponRecord.getUserSystemCoupon();
 			// 鐘舵�佸垵濮嬪寲
+			UserSystemCoupon userSystemCoupon = couponRecord.getUserSystemCoupon();
 			userSystemCoupon.setState(UserSystemCoupon.STATE_CAN_USE);
 			userSystemCoupon.setUseTime(null);
 			userSystemCoupon.setUpdateTime(new Date());
@@ -2134,11 +2157,12 @@
 			if (systemCoupon == null)
 				continue;
 			
+			
+			// 閫�鍥炴秷鎭�
 			String couponName = systemCoupon.getName();
 			if (CouponTypeEnum.freeCouponGive == systemCoupon.getType())
 				couponName = "鍏嶅崟鍒�";
 			
-			// 閫�鍥炴秷鎭�
 			String beiZhu = "璇峰埌鎴戠殑-绂忓埄涓績鏌ョ湅";
 			SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm");
 			MsgOtherGiveContentDTO msgOther = new MsgOtherGiveContentDTO();
@@ -2154,6 +2178,9 @@
 	
 	@Override
 	public boolean getIncludeExchange(Long uid) {
+		// 杩囨湡鍒�
+		updateInvalidSate(uid);
+		
 		String percent = configService.get("exchange_rebate_percent");
 		if (StringUtil.isNullOrEmpty(percent)) 
 			percent = "35";
@@ -2166,6 +2193,9 @@
 	
 	@Override
 	public boolean getIncludeNotExchange(Long uid) {
+		// 杩囨湡鍒�
+		updateInvalidSate(uid);
+		
 		String percent = configService.get("exchange_rebate_percent");
 		if (StringUtil.isNullOrEmpty(percent)) 
 			percent = "35";
@@ -2178,6 +2208,10 @@
 	
 	@Override
 	public List<UserSystemCouponVO> listIncludeNotExchange(Long uid) throws Exception{
+		// 杩囨湡鍒�
+		updateInvalidSate(uid);
+		
+		// 閫�鍥炲埜
 		sendBackTimeOutCoupon(uid);
 		
 		String percent = configService.get("exchange_rebate_percent");

--
Gitblit v1.8.0