From 88c7df1d5089d8e39f356a68eaccc18f308e190c Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期二, 24 三月 2020 12:10:07 +0800
Subject: [PATCH] Merge branch 'div' into div-1

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPInfoServiceImpl.java |   69 ++++++++++++++++------------------
 1 files changed, 32 insertions(+), 37 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPInfoServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPInfoServiceImpl.java
index c2b9f69..7068387 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPInfoServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPInfoServiceImpl.java
@@ -92,14 +92,12 @@
 	@Lazy
 	@Resource
 	private UserSystemCouponService userSystemCouponService;
-	
+
 	@Resource
 	private UserVIPPreInfoService userVIPPreInfoService;
-	
+
 	@Resource
 	private MsgAccountDetailService msgAccountDetailService;
-	
-	
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
@@ -271,8 +269,14 @@
 
 	@Override
 	public boolean isVIP(Long uid) {
+		return isVIP(uid, System.currentTimeMillis());
+	}
+
+	@Override
+	public boolean isVIP(Long uid, Long time) {
 		UserVIPInfo userInfo = userVIPInfoMapper.selectByPrimaryKey(uid);
-		if (userInfo != null && userInfo.getState() == UserVIPInfo.STATE_SUCCESS)
+		if (userInfo != null && userInfo.getState() == UserVIPInfo.STATE_SUCCESS
+				&& userInfo.getSuccessTime().getTime() < time)
 			return true;
 		else
 			return false;
@@ -315,29 +319,26 @@
 
 		// 1銆佺洿鎺ョ矇涓濓紙浠� 2020 骞� 1 鏈� 1 鏃ヨ捣鐩存帴绮変笣浜х敓鏈夋晥璁㈠崟锛�
 		BigDecimal payMoney = new BigDecimal(userVipConfigService.getValueByKey("require_order_pay"));
-//		long teamNum = hongBaoV2CountService.countValidOrderTeamUserByUid(uid,
-//				TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME), payMoney);
+		// long teamNum =
+		// hongBaoV2CountService.countValidOrderTeamUserByUid(uid,
+		// TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME), payMoney);
 		long teamNum = 0L;
 		long vipBegin = TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME);
 		List<ThreeSale> listThreeSale = threeSaleSerivce.getValidWorkerIdsByTime(uid, vipBegin);
 		if (listThreeSale != null && listThreeSale.size() > 0) {
-			for (ThreeSale three: listThreeSale) {
+			for (ThreeSale three : listThreeSale) {
 				UserInfo worker = three.getWorker();
 				if (worker == null || worker.getId() == null) {
 					continue;
 				}
 				// 1銆侀個璇峰叧绯绘垚鍔熷悗锛�2銆佸崟锛堝垎浜� + 鑷喘锛夊疄浠樻澶т簬1鍏�
-				long countValid = hongBaoV2CountService.countValidOrderByUidAndTime(worker.getId(), three.getSucceedTime(), payMoney);
+				long countValid = hongBaoV2CountService.countValidOrderByUidAndTime(worker.getId(),
+						three.getSucceedTime(), payMoney);
 				if (countValid > 0) {
-					teamNum ++;
+					teamNum++;
 				}
 			}
 		}
-		
-		
-		
-		
-		
 
 		// 鍖哄垎鑰佺敤鎴峰拰鏂扮敤鎴�
 		String limtDate = userVipConfigService.getValueByKey("vip_execute_time");
@@ -450,18 +451,17 @@
 		}
 	}
 
-	
 	@Transactional(rollbackFor = Exception.class)
 	@Override
 	public void applyVIPNew(Long uid) throws UserVIPInfoException {
 		UserVIPPreInfo latestProcess = userVIPPreInfoService.getLatestProcessInfo(uid);
 		if (latestProcess == null || latestProcess.getProcess() != UserVIPPreInfo.PROCESS_2) {
 			throw new UserVIPInfoException(1, "璇ョ敤鎴疯繕涓嶆槸楂樼骇浼氬憳");
-		} 
-		
+		}
+
 		if (!verifyVipNew(uid))
 			throw new UserVIPInfoException(1, "绯荤粺楠岃瘉锛氫笉婊¤冻鍗囩骇鏉′欢");
-		
+
 		UserVIPInfo userInfo = userVIPInfoMapper.selectByPrimaryKeyForUpdate(uid);
 		if (userInfo == null) {
 			userInfo = new UserVIPInfo();
@@ -479,8 +479,7 @@
 		info.setState(UserVIPInfo.STATE_VERIFING);
 		info.setUpdateTime(new Date());
 		userVIPInfoMapper.updateByPrimaryKeySelective(info);
-		
-		
+
 		MsgAccountDetail detail = new MsgAccountDetail();
 		detail.setTitle("灏婃暚鐨勯珮绾т細鍛橈紝绯荤粺宸叉敹鍒颁綘鐨勮秴绾т細鍛樺崌绾х敵璇凤紝姝e湪鍙楃悊涓�");
 		detail.setBeiZhu("濡傛湁鐤戦棶璇疯仈绯绘垜鐨�-浜哄伐瀹㈡湇");
@@ -495,9 +494,7 @@
 			e.printStackTrace();
 		}
 	}
-	
-	
-	
+
 	@Transactional(rollbackFor = Exception.class)
 	@Override
 	public void passVIPApplyNew(Long uid) throws UserVIPInfoException {
@@ -508,15 +505,15 @@
 		if (userVIPInfo.getState() != UserVIPInfo.STATE_VERIFING) {
 			throw new UserVIPInfoException(2, "鐢宠鏈浜庡鏍哥姸鎬�");
 		}
-		
+
 		UserVIPPreInfo latestProcess = userVIPPreInfoService.getLatestProcessInfo(uid);
 		if (latestProcess == null || latestProcess.getProcess() != UserVIPPreInfo.PROCESS_2) {
 			throw new UserVIPInfoException(1, "璇ョ敤鎴疯繕涓嶆槸楂樼骇浼氬憳");
-		} 
-		
+		}
+
 		if (!verifyVipNew(uid))
 			throw new UserVIPInfoException(1, "绯荤粺楠岃瘉锛氫笉婊¤冻鍗囩骇鏉′欢");
-		
+
 		// 棰濆淇℃伅
 		UserInfoExtra userInfoExtra = userInfoExtraService.getByUidForUpdate(uid);
 		if (userInfoExtra == null)
@@ -540,7 +537,7 @@
 		detail.setCreateTime(new Date());
 		detail.setUniqueKey("VIP-" + uid);
 		integralDetailService.insertSelective(detail);
-				
+
 		try {
 			// 濂栧姳鍒�
 			BigDecimal percent = new BigDecimal(configService.get(ConfigKeyEnum.exchangeRebatePercent.getKey()));
@@ -558,15 +555,13 @@
 			throw new UserVIPInfoException(1, "鍒歌禒閫佸け璐�");
 		}
 
-		
 		// 娑堟伅
 		MsgAccountVipDTO msgDto = new MsgAccountVipDTO();
 		msgDto.setStatus("宸插皢浣犵殑璐︽埛鐢遍珮绾т細鍛樺崌绾т负瓒呯骇浼氬憳");
 		msgDto.setEquity("浠庢敹鍒版湰娑堟伅璧凤紝浣犲皢鑾峰緱鍏ㄩ儴瓒呯骇浼氬憳鏉冪泭");
 		msgAccountDetailService.addMsgVIP(uid, "鎭枩浣狅紒缁忎汉宸ュ鏍镐綘婊¤冻鍗囩骇瓒呯骇浼氬憳鏉′欢", "濡傛湁鐤戦棶璇疯仈绯绘垜鐨�-浜哄伐瀹㈡湇", msgDto);
 	}
-	
-	
+
 	/**
 	 * 楠岃瘉鏄惁绗﹀悎VIP
 	 * @param uid
@@ -582,15 +577,14 @@
 		// 闃熷憳
 		long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
 		long secondTeam = threeSaleSerivce.countSecondTeam(uid, 1);
-		
+
 		if (countZiGou >= Constant.VIP_PROCESS_3_ZIGOU || countShare >= Constant.VIP_PROCESS_3_SHARE
 				|| (firstTeam >= Constant.VIP_PROCESS_3_TEAM && secondTeam >= Constant.VIP_PROCESS_3_TEAM_SECOND)) {
 			return true;
-		} 
+		}
 		return false;
 	}
-	
-	
+
 	@Transactional(rollbackFor = Exception.class)
 	@Override
 	public void rejectVIPApplyNew(Long uid, String reason) throws UserVIPInfoException {
@@ -607,11 +601,12 @@
 		info.setState(UserVIPInfo.STATE_INVALID);
 		info.setUpdateTime(new Date());
 		userVIPInfoMapper.updateByPrimaryKeySelective(info);
-		
+
 		// 娑堟伅
 		MsgAccountVipDTO msgDto = new MsgAccountVipDTO();
 		msgDto.setStatus("浣犵殑璐﹀彿浠嶆槸楂樼骇浼氬憳");
 		msgDto.setReason(reason);
 		msgAccountDetailService.addMsgVIP(uid, "寰堟姳姝夛紒缁忎汉宸ュ鏍镐綘鏈弧瓒虫垨涓嶇鍚堝崌绾ц秴绾т細鍛樼殑鏉′欢", "濡傛湁鐤戦棶璇疯仈绯绘垜鐨�-浜哄伐瀹㈡湇", msgDto);
 	}
+
 }

--
Gitblit v1.8.0