From b843e1c35f5bd1d8497321c2ce139893998e89c9 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期二, 12 五月 2020 19:57:21 +0800
Subject: [PATCH] 队员统计

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java |   84 ++++++++++++++++++++++++++++++++----------
 1 files changed, 64 insertions(+), 20 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java
index acdc267..ff5e5ab 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java
@@ -32,7 +32,7 @@
 import com.yeshi.fanli.entity.bus.user.UserInviteValidNum;
 import com.yeshi.fanli.entity.bus.user.UserInviteValidRecord;
 import com.yeshi.fanli.entity.bus.user.WeiXinUser;
-import com.yeshi.fanli.entity.bus.user.vip.TeamDailyRecord;
+import com.yeshi.fanli.entity.bus.user.invite.TeamDailyRecord;
 import com.yeshi.fanli.entity.bus.user.vip.TeamUserLevelStatistic;
 import com.yeshi.fanli.entity.bus.user.vip.TearcherInfo;
 import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
@@ -995,28 +995,72 @@
 				highVIP.put("total", statistic.getHighFirstCount() + statistic.getHighSecondCount());
 				superVIP.put("total", statistic.getSuperFirstCount() + statistic.getSuperSecondCount());
 			}
-			// 缁熻杈句汉
-			long darenToday = threeSaleSerivce.countFirstTeamByDate(uid, 1)	+ threeSaleSerivce.countSecondTeamByDate(uid, 1);
-			long darenMonth = threeSaleSerivce.countFirstTeamByDate(uid, 2)	+ threeSaleSerivce.countSecondTeamByDate(uid, 2);
+			
+
+			int darenToday = 0;
+			int highVIPToday = 0;
+			int superVIPToday = 0;
+			String createId = teamDailyRecordService.createId(uid, new Date());
+			TeamDailyRecord record = teamDailyRecordService.getById(createId);
+			if (record != null) {
+				if (record.getFirstDaRen() != null) 
+					darenToday += record.getFirstDaRen();
+				if (record.getSecondDaRen() != null)
+					darenToday += record.getSecondDaRen();			
+				if (record.getFirstHighVIP() != null)
+					highVIPToday += record.getFirstHighVIP();
+				if (record.getSecondHighVIP() != null)
+					highVIPToday += record.getSecondHighVIP();
+				if (record.getFirstSuperVIP() != null)
+					superVIPToday += record.getFirstSuperVIP();
+				if (record.getSecondSuperVIP() != null)
+					superVIPToday += record.getSecondSuperVIP();
+			}
+			
+			
+			// 鑾峰彇褰撴湀绗竴澶╁拰鏈�鍚庝竴澶� 
+			Calendar cale = Calendar.getInstance();
+	        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");  
+	        String firstday, lastday;  
+	        // 鑾峰彇鍓嶆湀鐨勭涓�澶�  
+	        cale = Calendar.getInstance();  
+	        cale.add(Calendar.MONTH, 0);  
+	        cale.set(Calendar.DAY_OF_MONTH, 1);  
+	        firstday = format.format(cale.getTime());  
+	        // 鑾峰彇鍓嶆湀鐨勬渶鍚庝竴澶�  
+	        cale = Calendar.getInstance();  
+	        cale.add(Calendar.MONTH, 1);  
+	        cale.set(Calendar.DAY_OF_MONTH, 0);  
+	        lastday = format.format(cale.getTime());  
+			
+	        int darenMonth = 0;
+			int highVIPMonth = 0;
+			int superVIPMonth = 0;
+			Date date = new Date();
+			Date minTime = TimeUtil.parseYYYYMMDD(firstday);
+			Date maxTime = TimeUtil.parseYYYYMMDD_HHMMSS(lastday + " 23:59:59");
+			List<TeamDailyRecord> listMonth = teamDailyRecordService.sumGroupByYearMonth(uid, minTime, maxTime);
+			if (listMonth != null && listMonth.size() > 0) {
+				TeamDailyRecord teamRecord = listMonth.get(0);
+				if (teamRecord.getFirstDaRen() != null) 
+					darenMonth += teamRecord.getFirstDaRen();
+				if (teamRecord.getSecondDaRen() != null)
+					darenMonth += teamRecord.getSecondDaRen();			
+				if (teamRecord.getFirstHighVIP() != null)
+					highVIPMonth += teamRecord.getFirstHighVIP();
+				if (teamRecord.getSecondHighVIP() != null)
+					highVIPMonth += teamRecord.getSecondHighVIP();
+				if (teamRecord.getFirstSuperVIP() != null)
+					superVIPMonth += teamRecord.getFirstSuperVIP();
+				if (teamRecord.getSecondSuperVIP() != null)
+					superVIPMonth += teamRecord.getSecondSuperVIP();
+			}
+			// 杈句汉
 			daren.put("today", darenToday);
 			daren.put("month", darenMonth);
-
-			SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
-			String today = sd.format(new Date());
-			// 褰撴湀1鍙�
-			Calendar calendar1 = Calendar.getInstance();
-			calendar1.set(Calendar.DAY_OF_MONTH, 1);
-			Date minTime = sd.parse(sd.format(calendar1.getTime()));
-
-			int highVIPToday = 0;
-			int highVIPMonth = 0;
-			 // TODO 缁熻楂樼骇浼氬憳鏁伴噺
+			// 楂樼骇浼氫細鍛�
 			highVIP.put("today", highVIPToday);
 			highVIP.put("month", highVIPMonth);
-			
-			
-			int superVIPToday = 0;
-			int superVIPMonth = 0;
 			 // 缁熻瓒呯骇浼氬憳鏁伴噺
 			superVIP.put("today", superVIPToday);
 			superVIP.put("month", superVIPMonth);
@@ -1234,7 +1278,7 @@
 			TeamDailyRecord monthRecord = new TeamDailyRecord(0,0,0);
 			TeamDailyRecord totalityRecord = new TeamDailyRecord(0,0,0);
 			
-			List<TeamDailyRecord> list = teamDailyRecordService.getbyUid(uid);
+			List<TeamDailyRecord> list = teamDailyRecordService.getByUid(uid);
 			if (list != null && list.size() > 0) {
 				for (TeamDailyRecord record: list) {
 					Date statisticDay = record.getCountDay();

--
Gitblit v1.8.0