From 4ecde6bc2804a8cb286948b461cb9bdecd663554 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期五, 13 十二月 2019 17:13:12 +0800
Subject: [PATCH] 邀请统计

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackWinInviteServiceImpl.java |   62 ++++++++++++++++++++++++++++++-
 1 files changed, 60 insertions(+), 2 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackWinInviteServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackWinInviteServiceImpl.java
index 2f4db5e..6411fd8 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackWinInviteServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackWinInviteServiceImpl.java
@@ -1,6 +1,7 @@
 package com.yeshi.fanli.service.impl.redpack;
 
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
@@ -35,10 +36,12 @@
 import com.yeshi.fanli.util.Constant;
 import com.yeshi.fanli.util.MoneyBigDecimalUtil;
 import com.yeshi.fanli.util.StringUtil;
+import com.yeshi.fanli.util.TimeUtil;
 import com.yeshi.fanli.util.VersionUtil;
 import com.yeshi.fanli.util.annotation.RequestSerializableByKeyService;
 import com.yeshi.fanli.util.annotation.redpack.RedPackGetVersionLimit;
 import com.yeshi.fanli.util.factory.RedPackDetailFactory;
+import com.yeshi.fanli.vo.redpack.RedPackWinProgressVO;
 
 @Service
 public class RedPackWinInviteServiceImpl implements RedPackWinInviteService {
@@ -96,7 +99,7 @@
 	@Transactional(rollbackFor = Exception.class)
 	public void inviteSucceedReward(Long teamUid) throws Exception {
 		// 鏄惁鍦ㄤ笂绾夸箣鍚庣殑閭�璇峰叧绯�
-		ThreeSale threeSale = threeSaleSerivce.getByWorkerIdAndTime(teamUid, Constant.RED_PACK_REWARD_TIME);
+		ThreeSale threeSale = threeSaleSerivce.getByWorkerIdAndTime(teamUid, TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME));
 		if (threeSale == null)
 			return;
 
@@ -187,7 +190,7 @@
 			return;
 
 		// 楠岃瘉涓婁笅绾у叧绯�
-		ThreeSale threeSale = threeSaleSerivce.getByWorkerIdAndTime(teamUid, Constant.RED_PACK_REWARD_TIME);
+		ThreeSale threeSale = threeSaleSerivce.getByWorkerIdAndTime(teamUid, TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME));
 		if (threeSale == null || threeSale.getBoss().getId().longValue() != uid.longValue())
 			return;
 
@@ -331,4 +334,59 @@
 				money, "闃熷憳锛堝ソ鍙嬶級瀹屾垚绗笁闃舵杩炵画[绗�" + monthSpace + "涓湀]", new Gson().toJson(dto));
 	}
 
+	
+	@Override
+	public List<RedPackWinProgressVO> getInviteProgressByWorkerId(Long uid) {
+		List<RedPackWinProgressVO> listVO = new ArrayList<RedPackWinProgressVO>();
+		ThreeSale threeSale = threeSaleSerivce.selectByWorkerId(uid);
+		if (threeSale == null || threeSale.getSucceedTime() == null)
+			return listVO;
+		
+		UserInfo userInfo = userInfoService.selectByPKey(uid);
+		if (userInfo == null) 
+			return listVO;
+		
+		listVO.add(new RedPackWinProgressVO("鎴愬姛娉ㄥ唽", TimeUtil.formatDate(userInfo.getCreatetime())));
+		listVO.add(new RedPackWinProgressVO("纭珛閭�璇�", TimeUtil.formatDate(threeSale.getSucceedTime())));
+		
+		// 濂栧姳璁板綍
+		List<RedPackWinInvite> listWin = redPackWinInviteMapper.getWinListByBossIdAndTeamUid(threeSale.getBoss().getId(), uid);
+		if (listWin == null || listWin.size() == 0) 
+			return listVO;
+		
+		int month = 1;
+		for (RedPackWinInvite win: listWin) {
+			String time = TimeUtil.formatDate(win.getCreateTime());
+			BigDecimal money = win.getMoney().setScale(2);
+			if (win.getType() == RedPackWinInviteTypeEnum.oneStageReward) {
+				listVO.add(new RedPackWinProgressVO("绗竴闃舵", time, money.toString()));
+				continue;
+			} 
+			
+			if (win.getType() == RedPackWinInviteTypeEnum.twoStageReward) {
+				listVO.add(new RedPackWinProgressVO("绗簩闃舵", time, money.toString()));
+				continue;
+			} 
+			
+			if (win.getType() == RedPackWinInviteTypeEnum.twoStageReward) {
+				listVO.add(new RedPackWinProgressVO("绗笁闃舵绗�" + month + "涓湀", time, money.toString()));
+				month ++;
+				continue;
+			}
+		}
+		return listVO;
+	}
+	
+	
+	@Override
+	public List<RedPackWinInvite> getWinTopListByBossId(int page, int count, Long uid) {
+		return redPackWinInviteMapper.getWinTopListByBossId(count * (page-1), count, uid);
+	}
+	
+	
+	@Override
+	public long countWinTopListByBossId(Long uid) {
+		return redPackWinInviteMapper.countWinTopListByBossId(uid);
+	}
+	
 }

--
Gitblit v1.8.0