From 89cc8f054c27f70fcfe16f14554a8a12e0c19e23 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期三, 18 十二月 2019 09:22:31 +0800
Subject: [PATCH] 邀请统计

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java |   57 ++++++++++++++++++++++++++++++---------------------------
 1 files changed, 30 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 1483a50..c9f73e0 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
@@ -877,35 +877,35 @@
 			throw new UserSystemCouponException(1, "浜诧紝寰堥仐鎲撅紝璇ヨ鍗曞凡涓嶈兘浣跨敤杩斿埄濂栧姳鍒竳");
 		
 		CommonOrderVO orderVO = listVo.get(0);
-		// 鐗堟湰鍖哄垎锛�2.1
-		if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
+		
+		// 2.1鏂扮増
+		Date thirdCreateTime = orderVO.getThirdCreateTime();
+		Date accountTime = orderVO.getAccountTime();
+		if (thirdCreateTime == null || accountTime == null) 
+			throw new UserSystemCouponException(1, "璇ヨ鍗曚笉鑳戒娇鐢ㄥ鍔卞埜");
+		
+		long downOrderTime = thirdCreateTime.getTime();
+		long limitDate = TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME);
+		if (downOrderTime > limitDate) {
 			boolean valid = false;
-			Date thirdCreateTime = orderVO.getThirdCreateTime();
-			Date accountTime = orderVO.getAccountTime();
-			if (thirdCreateTime != null && accountTime != null) {
-				long downOrderTime = thirdCreateTime.getTime();
-				long limitDate = TimeUtil.parse(Constant.COUPON_REWARD_TIME).getTime();
-				if (downOrderTime > limitDate) {
-					Date endDay = DateUtil.plusDayDate(Constant.COUPON_REWARD_LIMIT_DAY, accountTime);
-					long currentTime = java.lang.System.currentTimeMillis();
-					if (endDay.getTime() > currentTime) {
-						DateInfo dateInfo = DateUtil.dateDiff3(currentTime, endDay.getTime());
-						if (dateInfo != null) {
-							if (dateInfo.getDay() > 0)
-								valid = true;
+			Date endDay = DateUtil.plusDayDate(Constant.COUPON_REWARD_LIMIT_DAY, accountTime);
+			long currentTime = java.lang.System.currentTimeMillis();
+			if (endDay.getTime() > currentTime) {
+				DateInfo dateInfo = DateUtil.dateDiff3(currentTime, endDay.getTime());
+				if (dateInfo != null) {
+					if (dateInfo.getDay() > 0)
+						valid = true;
 
-							if (!valid && dateInfo.getHour() > 0)
-								valid = true;
+					if (!valid && dateInfo.getHour() > 0)
+						valid = true;
 
-							if (!valid && dateInfo.getMinute() > 0)
-								valid = true;
+					if (!valid && dateInfo.getMinute() > 0)
+						valid = true;
 
-							if (!valid && dateInfo.getSecond() > 0)
-								valid = true;
-						}
-					}
+					if (!valid && dateInfo.getSecond() > 0)
+						valid = true;
 				}
-			} 
+			}
 			
 			if (!valid)
 				throw new UserSystemCouponException(1, "璇ヨ鍗曚笉鑳戒娇鐢ㄥ鍔卞埜");
@@ -2075,12 +2075,13 @@
 		}
 
 		Date nowDate = new Date();
+		Date endTime = DateUtil.plusDayDate(Constant.GIVE_DAYS, nowDate);
 		// 鎻掑叆璧犻�佽褰�
 		UserSystemCouponGiveRecord giveRecord = new UserSystemCouponGiveRecord();
 		giveRecord.setCouponId(id);
 		giveRecord.setGiveUid(uid);
 		giveRecord.setGiveTime(nowDate);
-		giveRecord.setEndTime(DateUtil.plusDayDate(Constant.GIVE_DAYS, nowDate));
+		giveRecord.setEndTime(endTime);
 		userSystemCouponGiveRecordService.insertSelective(giveRecord);
 
 		// 鍒涘缓璁板綍
@@ -2089,7 +2090,7 @@
 		tokenRecord.setIdentify(giveRecord.getId() + "");
 		tokenRecord.setType(tokenTypeEnum);
 		tokenRecord.setStartTime(nowDate);
-		tokenRecord.setEndTime(DateUtil.plusDayDate(Constant.TOKEN_DAYS, nowDate));
+		tokenRecord.setEndTime(endTime);
 		tokenRecord.setState(0);
 		tokenRecordService.insertSelective(tokenRecord);
 
@@ -2125,6 +2126,8 @@
 		msg.setUserSystemCouponId(id);
 		msg.setCouponType(type.name());
 		Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.systemCouponDrawback, msg);
+		// 寤惰繜涓�鍒嗛挓
+		message.setStartDeliverTime(endTime.getTime() + 1000 * 60);
 		try {
 			producer.send(message);
 		} catch (Exception e) {
@@ -2317,7 +2320,7 @@
 	}
 
 	@Override
-	@RequestSerializableByKeyService(key = "#id")
+	@RequestSerializableByKeyService(key = "#couponId")
 	@Transactional(rollbackFor = Exception.class)
 	public void sendBackByGiveId(Long couponId) {
 		if (couponId == null)

--
Gitblit v1.8.0