From f723205213f94e291f140425c0d670f43e213c96 Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期一, 02 九月 2019 10:48:05 +0800
Subject: [PATCH] 金币明细-文字修改

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java |   86 +++++++++++++++++++++++++++++-------------
 1 files changed, 59 insertions(+), 27 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 d0d61fd..4e8fee4 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
@@ -10,7 +10,9 @@
 
 import javax.annotation.Resource;
 
+import org.springframework.context.annotation.Lazy;
 import org.springframework.core.task.TaskExecutor;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.yeshi.utils.DateUtil;
@@ -105,6 +107,7 @@
 	private UserSystemCouponRecordService userSystemCouponRecordService;
 
 	@Resource
+	@Lazy
 	private HongBaoV2Service hongBaoV2Service;
 
 	@Resource
@@ -141,6 +144,7 @@
 	private CommonOrderCountService commonOrderCountService;
 	
 	@Resource
+	@Lazy
 	private PushCouponService pushCouponService;
 	
 	@Resource
@@ -245,7 +249,10 @@
 		// 缁撴潫鏃ユ湡
 		// 浠婂ぉ鍦ㄥ唴  鍑忓幓涓�澶�
 		String endDay = DateUtil.plusDay(expiryDay - 1, new Date());
-		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		if (endDay != null && endDay.trim().length() > 0) {
+			endDay += " 23:59:59";
+		}
 		Date endTime = format.parse(endDay);
 
 		UserSystemCoupon userCoupon = new UserSystemCoupon();
@@ -910,7 +917,7 @@
 		userRecordVO.setCouponEffect("杩斿埄楼" + hongBao.setScale(2, BigDecimal.ROUND_DOWN) + "宸茶繑" + percent + "%");
 
 		// 璧勯噾鏄庣粏
-		JumpDetailV2 welfareCore = jumpDetailV2Service.getByTypeCache("capitalDetails");
+		JumpDetailV2 welfareCore = jumpDetailV2Service.getByTypeCache("moneyDetails");
 		Map<String, Object> jumpWelfare = new HashMap<String, Object>();
 		jumpWelfare.put("jumpDetail", welfareCore);
 		Map<String, Object> jumpparms = new HashMap<String, Object>();
@@ -1374,7 +1381,10 @@
 			// 缁撴潫鏃ユ湡
 			// 浠婂ぉ鍦ㄥ唴  鍑忓幓涓�澶�
 			String endDay = DateUtil.plusDay(systemCoupon.getExpiryDay() - 1, new Date());
-			SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+			SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+			if (endDay != null && endDay.trim().length() > 0) {
+				endDay += " 23:59:59";
+			}
 			Date endTime = format.parse(endDay);
 
 			UserSystemCoupon userCoupon = new UserSystemCoupon();
@@ -1449,7 +1459,10 @@
 			
 			// 缁撴潫鏃ユ湡 浠婂ぉ鍦ㄥ唴  鍑忓幓涓�澶�
 			String endDay = DateUtil.plusDay(systemCoupon.getExpiryDay() - 1, new Date());
-			SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+			SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+			if (endDay != null && endDay.trim().length() > 0) {
+				endDay += " 23:59:59";
+			}
 			Date endTime = format.parse(endDay);
 			
 			UserSystemCoupon userCoupon = new UserSystemCoupon();
@@ -1586,7 +1599,10 @@
 			
 		//  璁$畻缁撴潫鏃ユ湡锛氫粖澶╁湪鍐�  鍑忓幓涓�澶�
 		String endDay = DateUtil.plusDay(expiryDay - 1, new Date());
-		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		if (endDay != null && endDay.trim().length() > 0) {
+			endDay += " 23:59:59";
+		}
 		Date endTime = format.parse(endDay);
 
 		UserSystemCoupon userCoupon = new UserSystemCoupon();
@@ -1754,9 +1770,11 @@
 					// 鍙娇鐢ㄣ�� 鍙禒閫�
 					userCouponVO.setState(UserSystemCoupon.STATE_USE_GIVE);
 
-					// 杩斿埄濂栧姳鍒�- 璺宠浆鑷冲凡鍒拌处-宸叉敹璐�
-					jumpLink.put("state", "2");
-					jumpLink.put("type", "1");
+					// 璁㈠崟鍒楄〃
+					jumpLink.put("state", "2"); // 宸叉敹璐�
+					jumpLink.put("type", "1");  // 杩斿埄璁㈠崟
+					jumpLink.put("title", "杩斿埄璁㈠崟"); // 鏍囬鍚�
+					jumpLink.put("goodsType", "0"); // 璁㈠崟鏉ユ簮
 					jumpBtn = new HashMap<String, Object>();
 					jumpBtn.put("params", jumpLink);
 					jumpBtn.put("jumpDetail", jumpDetailV2Service.getByTypeCache("order_screen_list"));
@@ -2019,7 +2037,10 @@
 			try {
 				Integer expiryDay =  systemCoupon.getExpiryDay();
 				String endDay = DateUtil.plusDay(expiryDay - 1, nowDate);
-				SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+				SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+				if (endDay != null && endDay.trim().length() > 0) {
+					endDay += " 23:59:59";
+				}
 				Date endTime = format.parse(endDay);
 				
 				UserSystemCoupon userCoupon = new UserSystemCoupon();
@@ -2145,16 +2166,10 @@
 		userSystemCoupon.setUseTime(null);
 		userSystemCoupon.setState(UserSystemCoupon.STATE_CAN_USE);
 		userSystemCoupon.setUpdateTime(new Date());
-		userSystemCouponMapper.updateByPrimaryKey(userSystemCoupon);
+		userSystemCouponMapper.updateByPrimaryKeySelective(userSystemCoupon);
 		
 		// 浣跨敤璁板綍
 		if  (record != null) {
-			UserSystemCouponRecord useRecordUpdate = new UserSystemCouponRecord();
-			useRecordUpdate.setId(record.getId());
-			useRecordUpdate.setState(UserSystemCouponRecord.STATE_WAIT_TIME_OUT);
-			useRecordUpdate.setUpdateTime(new Date());
-			userSystemCouponRecordService.updateByPrimaryKeySelective(useRecordUpdate);
-			
 			if (CouponTypeEnum.welfareFreeCoupon.name().equals(record.getCouponType())) {
 				userOtherMsgNotificationService.welfareCouponDrawBack(userSystemCoupon, record.getOrderNo());
 			} else if (CouponTypeEnum.freeCoupon.name().equals(record.getCouponType())) {
@@ -2166,27 +2181,44 @@
 	}
 	
 	
+	@Async()
 	@Transactional
 	@Override
 	public void sendBackTimeOutCoupon(Long uid) {
-		// 瓒呰繃10鍒嗛挓   鏈鍖归厤鐨勫埜
-		List<UserSystemCouponRecord> list = userSystemCouponRecordService.getCouponByUsingTimeOut(uid, 600L);
-		if (list == null || list.size() == 0) {
+		// 鍟嗗搧鐩稿叧鐨勫埜
+		List<SystemCoupon> couponList = systemCouponService.getGoodsCouponList();
+		if (couponList == null || couponList.size() == 0) {
 			return;
 		}
 
-		for (UserSystemCouponRecord couponRecord : list) {
-			// 鏇存柊鐘舵�侊細鍖归厤瓒呮椂
-			couponRecord.setState(UserSystemCouponRecord.STATE_WAIT_TIME_OUT);
-			couponRecord.setUpdateTime(new Date());
-			userSystemCouponRecordService.updateByPrimaryKeySelective(couponRecord);
+		List<Long> list = new ArrayList<Long>();
+		for (SystemCoupon systemCoupon: couponList) {
+			list.add(systemCoupon.getId());
+		}
+		
+		// 瓒呰繃10鍒嗛挓   鏈鍖归厤鐨勫厤鍗曞埜
+		List<UserSystemCoupon> listUserCoupon = userSystemCouponMapper.getCouponByUsingTimeOut(uid, list, 600L);
+		if (listUserCoupon == null || listUserCoupon.size() == 0) {
+			return;
+		}
 
+		for (UserSystemCoupon userCoupon : listUserCoupon) {
 			// 鐘舵�佸垵濮嬪寲
-			UserSystemCoupon userSystemCoupon = couponRecord.getUserSystemCoupon();
+			UserSystemCoupon userSystemCoupon = new UserSystemCoupon();
+			userSystemCoupon.setId(userCoupon.getId());
 			userSystemCoupon.setState(UserSystemCoupon.STATE_CAN_USE);
 			userSystemCoupon.setUseTime(null);
 			userSystemCoupon.setUpdateTime(new Date());
-			userSystemCouponMapper.updateByPrimaryKey(userSystemCoupon);
+			userSystemCouponMapper.updateByPrimaryKeySelective(userSystemCoupon);
+			
+			UserSystemCouponRecord record = userSystemCouponRecordService.getNearByUserCouponId(userCoupon.getId());
+			if (record != null) {
+				UserSystemCouponRecord couponRecord = new UserSystemCouponRecord();
+				couponRecord.setId(record.getId());
+				couponRecord.setUpdateTime(new Date());
+				couponRecord.setState(UserSystemCouponRecord.STATE_WAIT_TIME_OUT);
+				userSystemCouponRecordService.updateByPrimaryKeySelective(couponRecord);
+			}
 		}
 	}
 
@@ -2241,7 +2273,7 @@
 			userSystemCoupon.setUseTime(null);
 			userSystemCoupon.setState(UserSystemCoupon.STATE_CAN_USE);
 			userSystemCoupon.setUpdateTime(new Date());
-			userSystemCouponMapper.updateByPrimaryKey(userSystemCoupon);
+			userSystemCouponMapper.updateByPrimaryKeySelective(userSystemCoupon);
 			
 			// 浣跨敤璁板綍
 			UserSystemCouponRecord useRecord = userSystemCouponRecordService.getNearByUserCouponId(couponId);

--
Gitblit v1.8.0