From 77829918c503b0ba87e8a8864a25611035a388e7 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 14 四月 2020 17:01:01 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/money/UserMoneyDetailServiceImpl.java |   54 ++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 42 insertions(+), 12 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/money/UserMoneyDetailServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/money/UserMoneyDetailServiceImpl.java
index 4f10898..4f6aaea 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/money/UserMoneyDetailServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/money/UserMoneyDetailServiceImpl.java
@@ -39,16 +39,18 @@
 	}
 
 	@Override
-	public List<UserMoneyDetailHistoryVO> listUserMoneyDetailForClient(Long uid, Long userMoneyDetailId, Date maxTime) {
+	public List<UserMoneyDetailHistoryVO> listUserMoneyDetailForClient(Long uid, Long userMoneyDetailId, Integer type, Date maxTime) {
 		List<UserMoneyDetailHistoryVO> finalList = new ArrayList<>();
 		List<UserMoneyDetail> list = null;
 		if (userMoneyDetailId == null) {// 棣栨璇锋眰
 			if (maxTime == null)// 娌℃湁绛涢�夋椂闂�
 			{
-				list = userMoneyDetailMapper.selectByMaxCreateTime(uid,
-						new Date(System.currentTimeMillis() + 1000 * 60 * 60L), 20);
+				Date date = new Date(System.currentTimeMillis() + 1000 * 60 * 60L);
+				list = userMoneyDetailMapper.selectByMaxCreateTime(uid,	date, 20, type);
+				System.out.println("maxTime == null");
 			} else {// 绛涢�変簡鏃堕棿
-				list = userMoneyDetailMapper.selectByMaxCreateTime(uid, maxTime, 20);
+				System.out.println("maxTime != null");
+				list = userMoneyDetailMapper.selectByMaxCreateTime(uid, maxTime, 20, type);
 			}
 
 			if (list != null && list.size() > 0) {
@@ -72,7 +74,7 @@
 		} else {// 浜屾璇锋眰
 
 			int size = 21;
-			List<UserMoneyDetail> tempList = userMoneyDetailMapper.selectByUidWithIndexId(uid, userMoneyDetailId, size);
+			List<UserMoneyDetail> tempList = userMoneyDetailMapper.selectByUidWithIndexId(uid, userMoneyDetailId, size, type);
 			Set<Date> dateSet = new HashSet<>();// 鐢ㄤ簬鍌ㄥ瓨鏄惁鍦ㄥ悓涓�鏃堕棿涓婇潰锛堢簿纭埌绉掞級
 			if (tempList.size() > 0) {
 				for (UserMoneyDetail umd : tempList) {
@@ -83,7 +85,7 @@
 				while (dateSet.size() == 1 && tempList2.size() != tempList.size() && size < 40) {// 鍙湁涓�涓椂闂寸偣鐨勬暟鎹�
 					tempList = tempList2;
 					size += 10;
-					tempList2 = userMoneyDetailMapper.selectByUidWithIndexId(uid, userMoneyDetailId, size);
+					tempList2 = userMoneyDetailMapper.selectByUidWithIndexId(uid, userMoneyDetailId, size, type);
 					dateSet.clear();
 					for (UserMoneyDetail umd : tempList2) {
 						dateSet.add(umd.getCreateTime());
@@ -191,18 +193,19 @@
 	}
 
 	@Override
-	public long countUserMoneyDetailForClient(Long uid, Long userMoneyDetailId, Date maxTime) {
+	public long countUserMoneyDetailForClient(Long uid, Long userMoneyDetailId,Integer type, Date maxTime) {
+		//TODO 澧炲姞type绛涢��
 		long monthCount = 0L;
 		long detailCount = 0L;
 		// 鏈�氳繃鏃堕棿绛涢�夛紝鏌ヨ鎵�鏈�
 		if (maxTime == null) {
-			detailCount = userMoneyDetailMapper.selectCountByUid(uid);
+			detailCount = userMoneyDetailMapper.selectCountByUid(uid, type);
 			// 鐢ㄤ簬琛ㄧず褰撳墠鎵�鏈�
 			monthCount = userMoneyDetailMapper.selectMonthCountByUid(uid,
-					new Date(System.currentTimeMillis() + 1000 * 60 * 60L));
+					new Date(System.currentTimeMillis() + 1000 * 60 * 60L), type);
 		} else {// 閫氳繃鏃堕棿绛涢�変簡鐨勶紝闇�瑕佹煡璇㈡墍鏈�
-			detailCount = userMoneyDetailMapper.selectCountByUidAndMaxCreateTime(uid, maxTime);
-			monthCount = userMoneyDetailMapper.selectMonthCountByUid(uid, maxTime);
+			detailCount = userMoneyDetailMapper.selectCountByUidAndMaxCreateTime(uid, maxTime, type);
+			monthCount = userMoneyDetailMapper.selectMonthCountByUid(uid, maxTime, type);
 		}
 
 		return monthCount + detailCount;
@@ -226,14 +229,41 @@
 			for (UserMoneyDetailTypeEnum type : typeList) {
 				list.add(type.name());
 			}
-		BigDecimal money = userMoneyDetailMapper.getTotalMoneyByTypeAndUidWithDate(uid, list, minDate, maxDate);
+		BigDecimal money = userMoneyDetailMapper.getTotalMoneyByTypeAndUidWithDate(uid, list, minDate, maxDate, null);
 		return money == null ? new BigDecimal(0) : money;
 	}
 
+	@Override
+	public BigDecimal statisticUserTypeMoneyWithDate(Long uid, List<UserMoneyDetailTypeEnum> typeList, Date minDate,
+			Date maxDate, Integer show) {
+		List<String> list = new ArrayList<>();
+		if (typeList != null)
+			for (UserMoneyDetailTypeEnum type : typeList) {
+				list.add(type.name());
+			}
+		BigDecimal money = userMoneyDetailMapper.getTotalMoneyByTypeAndUidWithDate(uid, list, minDate, maxDate, show);
+		return money == null ? new BigDecimal(0) : money;
+	}
+	
 	@Override
 	public UserMoneyDetail selectByTypeAndUidAndIdentifyCode(UserMoneyDetailTypeEnum type, Long uid,
 			Long sourceIdentifyId) {
 		return userMoneyDetailMapper.selectByTypeAndUidAndIdentifyCode(type, uid, sourceIdentifyId);
 	}
 
+	
+	@Override
+	public List<UserMoneyDetail> listQuery(int page, int pageSize, String key, Integer keyType) {
+		return userMoneyDetailMapper.listQuery((page - 1) * pageSize, pageSize, key, keyType);
+	}
+
+	@Override
+	public long countQuery(String key, Integer keyType) {
+		 Long count = userMoneyDetailMapper.countQuery(key, keyType);
+		 if (count == null) {
+			 count = 0L;
+		 }
+		 return count;
+	}
+	
 }

--
Gitblit v1.8.0