From 98b1a0affd69bbe63223c21fdd2c404e8bedfccb Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 20 五月 2020 17:25:08 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/div' into 2.1.2

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/user/invite/ThreeSaleSerivceImpl.java |   96 ++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 76 insertions(+), 20 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/invite/ThreeSaleSerivceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/invite/ThreeSaleSerivceImpl.java
index 119559b..b8c591e 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/invite/ThreeSaleSerivceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/invite/ThreeSaleSerivceImpl.java
@@ -208,7 +208,6 @@
 		}
 	}
 
-
 	@Override
 	public List<ThreeSale> listFirstTeamQuery(long start, int count, Long uid, Integer state, String startTime,
 			String endTime, Integer validState) {
@@ -258,21 +257,21 @@
 
 	@Override
 	public JSONObject getMyFirstTeam(long start, int count, Long uid) {
-		List<ThreeSale> list = threeSaleMapper.listFirstTeam(start, count, uid);
+		List<ThreeSale> list = threeSaleMapper.listFirstTeam(start, count, uid, null);
 		if (list == null) {
 			list = new ArrayList<ThreeSale>();
 		}
-		long countTotal = threeSaleMapper.countFirstTeam(uid);
+		long countTotal = threeSaleMapper.countFirstTeam(uid, null);
 		return organizeTeam(countTotal, list);
 	}
 
 	@Override
 	public JSONObject getMySecondTeam(long start, int count, Long uid) {
-		List<ThreeSale> list = threeSaleMapper.listSecondTeam(start, count, uid);
+		List<ThreeSale> list = threeSaleMapper.listSecondTeam(start, count, uid, null);
 		if (list == null) {
 			list = new ArrayList<ThreeSale>();
 		}
-		long countTotal = threeSaleMapper.countSecondTeam(uid);
+		long countTotal = threeSaleMapper.countSecondTeam(uid, null);
 		return organizeTeam(countTotal, list);
 	}
 
@@ -401,13 +400,12 @@
 		return threeSaleMapper.getSuccessRelationshipNum(uid);
 	}
 
-
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public void bindInviteRelationship(Long workerId, Long bossId) throws ThreeSaleException {
 		if (workerId == null || bossId == null)
 			throw new ThreeSaleException(1, "鐢ㄦ埛淇℃伅涓虹┖");
-		
+
 		// 鏂板缓绔嬬‘瀹氬叧绯�
 		ThreeSale threeSale = new ThreeSale();
 		threeSale.setBoss(new UserInfo(bossId));
@@ -429,7 +427,8 @@
 	@Transactional
 	private void inviteSuccess(Long workerId, Long bossId) {
 		if (!Constant.IS_TEST) {
-			UserInviteMQMsg msg = new UserInviteMQMsg(bossId, workerId, null, new Date(), UserInviteMQMsg.STATE_SUCCESS);
+			UserInviteMQMsg msg = new UserInviteMQMsg(bossId, workerId, null, new Date(),
+					UserInviteMQMsg.STATE_SUCCESS);
 			Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.inviteSuccess, msg);
 			producer.send(message);
 		}
@@ -442,19 +441,19 @@
 				} catch (Exception e) {
 					e.printStackTrace();
 				}
-				
+
 				try {
 					// 鐩存帴绮変笣閭�璇锋垚鍔�
 					UserInfo invitee = userInfoService.selectByPKey(workerId);
 					userInviteMsgNotificationService.directInviteSuccess(bossId, invitee.getNickName(),
 							invitee.getPortrait(), new Date());
-					
+
 					// 闂存帴绮変笣閭�璇锋垚鍔�
 					ThreeSale myBoss = threeSaleMapper.getMyBoss(bossId);
 					if (myBoss != null) {
 						UserInfo boss = userInfoService.selectByPKey(bossId);
-						userInviteMsgNotificationService.indirectInviteSuccess(myBoss.getBoss().getId(), 
-								boss.getNickName(),	invitee.getNickName(), invitee.getPortrait(), new Date());
+						userInviteMsgNotificationService.indirectInviteSuccess(myBoss.getBoss().getId(),
+								boss.getNickName(), invitee.getNickName(), invitee.getPortrait(), new Date());
 					}
 				} catch (Exception e) {
 					e.printStackTrace();
@@ -474,7 +473,6 @@
 		return threeSaleMapper.getByWorkerId(workerId);
 	}
 
-	 
 	@Override
 	public ThreeSale selectByWorkerId(Long workerId) {
 		return threeSaleMapper.selectSuccessByWorkerId(workerId);
@@ -492,24 +490,53 @@
 
 	@Override
 	public List<ThreeSale> listFirstTeam(long start, int count, Long uid) {
-		return threeSaleMapper.listFirstTeam(start, count, uid);
+		return threeSaleMapper.listFirstTeam(start, count, uid, null);
 	}
 
 	@Override
 	public List<ThreeSale> listSecondTeam(long start, int count, Long uid) {
-		return threeSaleMapper.listSecondTeam(start, count, uid);
+		return threeSaleMapper.listSecondTeam(start, count, uid, null);
 	}
-	
+
+	@Override
+	public List<ThreeSale> listFirstTeam(long start, int count, Long uid, List<Long> listId) {
+		return threeSaleMapper.listFirstTeam(start, count, uid, listId);
+	}
+
+	@Override
+	public List<ThreeSale> listSecondTeam(long start, int count, Long uid, List<Long> listId) {
+		return threeSaleMapper.listSecondTeam(start, count, uid, listId);
+	}
+
 	@Override
 	public long countFirstTeam(Long uid) {
-		return threeSaleMapper.countFirstTeam(uid);
+		return threeSaleMapper.countFirstTeam(uid, null);
 	}
 
 	@Override
 	public long countSecondTeam(Long uid) {
-		return threeSaleMapper.countSecondTeam(uid);
+		return threeSaleMapper.countSecondTeam(uid, null);
 	}
-	
+
+	@Override
+	public long countFirstTeam(Long uid, List<Long> listId) {
+		return threeSaleMapper.countFirstTeam(uid, listId);
+	}
+
+	@Override
+	public long countSecondTeam(Long uid, List<Long> listId) {
+		return threeSaleMapper.countSecondTeam(uid, listId);
+	}
+
+	@Override
+	public long countFirstTeamByDate(Long uid, int dayType) {
+		return threeSaleMapper.countFirstTeamByDate(uid, dayType);
+	}
+
+	@Override
+	public long countSecondTeamByDate(Long uid, int dayType) {
+		return threeSaleMapper.countSecondTeamByDate(uid, dayType);
+	}
 
 	@Override
 	public ThreeSale selectLatestByWorkerIdAndState(Long workerId, int state) {
@@ -552,8 +579,37 @@
 
 	@Override
 	public List<ThreeSale> getMyBossDeepList(Long uid) {
-		//TODO 闇�瑕佹洿鍔犵畝渚跨殑鏂瑰紡澶勭悊
+		// TODO 闇�瑕佹洿鍔犵畝渚跨殑鏂瑰紡澶勭悊
 		return getMyBossDeepList(uid, 100);
 	}
 
+	@Override
+	public Long getTopBoss(Long uid) {
+		Long bossUid = null;
+		UserInfo boss = getBoss(uid);
+		while (boss != null) {
+			bossUid = boss.getId();
+			boss = getBoss(boss.getId());
+		}
+		return bossUid;
+	}
+
+	@Override
+	public List<ThreeSale> listAll(Date minTime, Date maxTime, int page, int pageSize) {
+		return threeSaleMapper.listAll(minTime == null ? null : minTime.getTime(),
+				maxTime == null ? null : maxTime.getTime(), (page - 1) * pageSize, pageSize);
+	}
+
+	@Override
+	public long countAll(Date minTime, Date maxTime) {
+		return threeSaleMapper.countAll(minTime == null ? null : minTime.getTime(),
+				maxTime == null ? null : maxTime.getTime());
+	}
+
+	
+	@Override
+	public List<Long> getAllBossId(){
+		return threeSaleMapper.getAllBossId();
+	}
+
 }

--
Gitblit v1.8.0