From da36dbefcd945cc85d170c5c2e78682d13497f97 Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期一, 26 八月 2019 17:46:24 +0800
Subject: [PATCH] Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java |   58 +++++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 35 insertions(+), 23 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 2036d47..616bd92 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
@@ -1838,20 +1838,24 @@
 				userCouponVO.setCouponEffect("璧犻�佷腑");
 				userCouponVO.setCouponRule(systemCoupon.getRemark());
 				String tips = null;
+				
+				TokenTypeEnum tokenType = null;
 				if (CouponTypeEnum.freeCouponGive == type) {
 					userCouponVO.setState(UserSystemCoupon.STATE_GIVE_IN);
 					tips = configService.get("give_free_coupon_tips");
+					tokenType = TokenTypeEnum.freeCoupon;
 				}
 				
 				if (CouponTypeEnum.rebatePercentCoupon == type) {
 					userCouponVO.setState(UserSystemCoupon.STATE_GIVE_IN);
 					tips = configService.get("give_free_coupon_tips");
+					tokenType = TokenTypeEnum.rebatePercentCoupon;
 				}
 				
-				if (!StringUtil.isNullOrEmpty(tips)) {
+				if (!StringUtil.isNullOrEmpty(tips) && tokenType != null) {
 					UserSystemCouponGiveRecord record = userSystemCouponGiveRecordService.getRecordByUidAndCouponId(uid, userCouponVO.getId());
 					if (record != null) {
-						TokenRecord tokenRecord = tokenRecordService.getNearByTypeAndIdentify(CouponTypeEnum.freeCoupon.name(), record.getId().toString());
+						TokenRecord tokenRecord = tokenRecordService.getNearByTypeAndIdentify(tokenType.name(), record.getId().toString());
 						if (tokenRecord != null && !StringUtil.isNullOrEmpty(tokenRecord.getToken())) {
 							String projectChineseName = Constant.systemCommonConfig.getProjectChineseName();
 							while(tips.contains("{APP鍚嶇О}")) {
@@ -1870,28 +1874,40 @@
 						}
 					} 
 				} 
-			} else if (give && UserSystemCoupon.STATE_END_USE == state) {
-				userCouponVO.setCouponRule(systemCoupon.getRemark());
-				if (CouponTypeEnum.freeCouponGive == type) {
-					userCouponVO.setState(UserSystemCoupon.STATE_GIVE_END);
+			} else if (UserSystemCoupon.STATE_END_USE == state) {
+				
+				if (give) {
+					userCouponVO.setCouponRule(systemCoupon.getRemark());
+					if (CouponTypeEnum.freeCouponGive == type) {
+						userCouponVO.setState(UserSystemCoupon.STATE_GIVE_END);
+					}
+					
+					if (CouponTypeEnum.rebatePercentCoupon == type) {
+						userCouponVO.setState(UserSystemCoupon.STATE_GIVE_END);
+					}
+					
+					Date useTime = userCouponVO.getUseTime();
+					if (useTime != null) {
+						Map<String, Object> remainDays = new HashMap<String, Object>();
+						remainDays.put("content", "浜�" + sdf.format(useTime) + "鎴愬姛璧犻��");
+						remainDays.put("fontColor", "#CCCCCC");
+						userCouponVO.setRemainDays(remainDays);
+					}
+				} else {
+					Date useTime = userCouponVO.getUseTime();
+					if (useTime != null) {
+						Map<String, Object> remainDays = new HashMap<String, Object>();
+						remainDays.put("content", "浜�" + sdf.format(useTime) + "鎴愬姛浣跨敤");
+						remainDays.put("fontColor", "#CCCCCC");
+						userCouponVO.setRemainDays(remainDays);
+					}
 				}
 				
-				if (CouponTypeEnum.rebatePercentCoupon == type) {
-					userCouponVO.setState(UserSystemCoupon.STATE_GIVE_END);
-				}
-				
-				Date useTime = userCouponVO.getUseTime();
-				if (useTime != null) {
-					Map<String, Object> remainDays = new HashMap<String, Object>();
-					remainDays.put("content", "浜�" + sdf.format(useTime) + "鎴愬姛璧犻��");
-					remainDays.put("fontColor", "#999999");
-					userCouponVO.setRemainDays(remainDays);
-				}
 			}else if (UserSystemCoupon.STATE_OVERDUE == state) {
 				if (endTime != null) {
 					Map<String, Object> remainDays = new HashMap<String, Object>();
 					remainDays.put("content", "浜�" + sdf.format(endTime) + "杩囨湡");
-					remainDays.put("fontColor", "#999999");
+					remainDays.put("fontColor", "#CCCCCC");
 					userCouponVO.setRemainDays(remainDays);
 				}
 				
@@ -2032,11 +2048,7 @@
 		userCouponVO.setCouponTerm(couponTerm);
 		
 		Map<String, Object> remainDays = new HashMap<String, Object>();
-		
-		try {
-			remainDays.put("content", "鍓╀綑" + DateUtil.dateDiff2(new Date(), record.getGiveTime()) + "杩囨湡");
-		} catch (Exception e) {
-		}
+		remainDays.put("content", "鍓╀綑23鏃�59鍒嗚繃鏈�");
 		remainDays.put("fontColor", "#F14242");
 		userCouponVO.setRemainDays(remainDays);
 		

--
Gitblit v1.8.0