From 5f13dcc8eaac7cd26c0ec41bd1b3efbb70a08180 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 16 六月 2020 17:45:09 +0800
Subject: [PATCH] 云发单金额修改,增加获取电话号码接口

---
 fanli/src/main/java/com/yeshi/fanli/controller/admin/UserInfoAdminController.java |  524 ++++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 344 insertions(+), 180 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/admin/UserInfoAdminController.java b/fanli/src/main/java/com/yeshi/fanli/controller/admin/UserInfoAdminController.java
index eb21b3c..8317664 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/admin/UserInfoAdminController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/admin/UserInfoAdminController.java
@@ -2,6 +2,7 @@
 
 import java.io.PrintWriter;
 import java.lang.reflect.Type;
+import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Calendar;
@@ -12,6 +13,7 @@
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 
+import org.apache.commons.beanutils.PropertyUtils;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.yeshi.utils.IPUtil;
@@ -31,21 +33,28 @@
 import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode;
 import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode.ForbiddenUserIdentifyCodeTypeEnum;
 import com.yeshi.fanli.entity.bus.user.ThreeSale;
+import com.yeshi.fanli.entity.bus.user.UserActiveLog;
 import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
 import com.yeshi.fanli.entity.bus.user.UserInfo;
 import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
+import com.yeshi.fanli.entity.bus.user.UserInviteValidNum;
 import com.yeshi.fanli.entity.bus.user.UserRank;
+import com.yeshi.fanli.entity.bus.user.vip.TearcherInfo;
 import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo;
 import com.yeshi.fanli.entity.common.AdminUser;
+import com.yeshi.fanli.entity.dynamic.DynamicInfo;
 import com.yeshi.fanli.entity.integral.IntegralDetail;
 import com.yeshi.fanli.entity.money.UserMoneyDetail;
 import com.yeshi.fanli.entity.money.UserMoneyDetail.UserMoneyDetailTypeEnum;
 import com.yeshi.fanli.exception.user.ForbiddenUserIdentifyCodeException;
 import com.yeshi.fanli.exception.user.vip.UserVIPInfoException;
 import com.yeshi.fanli.log.LogHelper;
+import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
 import com.yeshi.fanli.service.inter.count.UserInfoCountService;
 import com.yeshi.fanli.service.inter.money.UserMoneyDetailService;
 import com.yeshi.fanli.service.inter.money.extract.BindingAccountService;
+import com.yeshi.fanli.service.inter.money.extract.ExtractService;
+import com.yeshi.fanli.service.inter.order.HongBaoV2Service;
 import com.yeshi.fanli.service.inter.user.ForbiddenUserIdentifyCodeService;
 import com.yeshi.fanli.service.inter.user.UserAccountService;
 import com.yeshi.fanli.service.inter.user.UserActiveLogService;
@@ -54,8 +63,11 @@
 import com.yeshi.fanli.service.inter.user.UserInfoService;
 import com.yeshi.fanli.service.inter.user.UserRankService;
 import com.yeshi.fanli.service.inter.user.integral.IntegralDetailService;
+import com.yeshi.fanli.service.inter.user.invite.ThreeSaleDetailService;
 import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
+import com.yeshi.fanli.service.inter.user.invite.UserInviteValidNumService;
 import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
+import com.yeshi.fanli.service.inter.user.vip.TearcherService;
 import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
 import com.yeshi.fanli.tag.PageEntity;
 import com.yeshi.fanli.util.Constant;
@@ -113,7 +125,28 @@
 	@Resource
 	private IntegralDetailService integralDetailService;
 	
-
+	@Resource
+	private UserInviteValidNumService userInviteValidNumService;
+	
+	@Resource
+	private ThreeSaleSerivce threeSaleSerivce;
+	
+	@Resource
+	private ExtractService extractService;
+	
+	@Resource
+	private HongBaoV2Service hongBaoV2Service;
+	
+	@Resource
+	private TearcherService tearcherService;
+	
+	@Resource
+	private ThreeSaleDetailService threeSaleDetailService;
+	
+	@Resource
+	private HongBaoV2CountService hongBaoV2CountService;
+	
+	
 	/**
 	 * 鏌ヨ鐢ㄦ埛淇℃伅鍒楄〃 姝e父鐢ㄦ埛/寮傚父鐢ㄦ埛
 	 * 
@@ -135,8 +168,8 @@
 	 */
 	@RequestMapping(value = "query")
 	public void query(String callback, Integer pageIndex, Integer pageSize, String key, Integer keyType, Integer rank,Integer userType,
-			Integer days, String startTime, String endTime, Integer orderMode, Integer type, PrintWriter out) {
-
+			Integer days, String startTime, String endTime, Integer orderMode, Integer type,String level,
+			Integer activeCode, PrintWriter out) {
 		try {
 			if (type == null) {
 				JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鐢ㄦ埛绫诲瀷type涓嶈兘涓虹┖"));
@@ -184,14 +217,14 @@
 			}
 
 			List<UserInfoVO> userList = userInfoService.query((pageIndex - 1) * pageSize, pageSize, type, key, keyType,
-					userRank, days, startTime, endTime, orderField, orderMode,userType);
+					userRank, days, startTime, endTime, orderField, orderMode,userType, level, activeCode);
 
 			if (userList == null || userList.size() == 0) {
 				JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏆傛棤鐩稿叧鏁版嵁"));
 				return;
 			}
 
-			long count = userInfoService.queryCount(type, key, keyType, userRank, days, startTime, endTime,userType);
+			long count = userInfoService.queryCount(type, key, keyType, userRank, days, startTime, endTime,userType, level, activeCode);
 
 			int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
 			PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
@@ -203,15 +236,298 @@
 			JSONObject data = new JSONObject();
 			data.put("pe", pe);
 			data.put("resultList", gson.toJson(userList));
-
 			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
-
 		} catch (Exception e) {
 			e.printStackTrace();
 			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"));
 		}
 	}
 
+	/**
+	 * 鐢ㄦ埛鍩虹淇℃伅鏌ヨ
+	 * @param callback
+	 * @param pageIndex
+	 * @param pageSize
+	 * @param key
+	 * @param keyType
+	 * @param rank
+	 * @param userType
+	 * @param days
+	 * @param startTime
+	 * @param endTime
+	 * @param type
+	 * @param level
+	 * @param activeCode
+	 * @param out
+	 */
+	@RequestMapping(value = "queryInfo")
+	public void queryInfo(String callback, Integer pageIndex, Integer pageSize, String key, Integer keyType, Integer rank,Integer userType,
+			Integer days, String startTime, String endTime, Integer state,String level,
+			Integer activeCode, PrintWriter out) {
+		try {
+			if (pageIndex == null)
+				pageIndex = 1;
+
+			if (pageSize == null)
+				pageSize = Constant.PAGE_SIZE;
+
+			String userRank = null;
+			if (rank != null) {
+				switch (rank) {
+				case 1:
+					userRank = "闈掗摐";
+					break;
+				case 2:
+					userRank = "鐧介摱";
+					break;
+				case 3:
+					userRank = "榛勯噾";
+					break;
+				case 4:
+					userRank = "閾傞噾";
+					break;
+				default:
+					break;
+				}
+			}
+
+			List<UserInfoVO> userList = userInfoService.queryInfo((pageIndex - 1) * pageSize, pageSize, state, key, keyType,
+					userRank, days, startTime, endTime, userType, level, activeCode);
+
+			if (userList == null || userList.size() == 0) {
+				JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏆傛棤鐩稿叧鏁版嵁"));
+				return;
+			}
+
+			long count = userInfoService.countInfo(state, key, keyType, userRank, days, startTime, endTime,userType, level, activeCode);
+
+			int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
+			PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
+
+			GsonBuilder gsonBuilder = new GsonBuilder();
+			gsonBuilder.serializeNulls();
+			Gson gson = gsonBuilder.create();
+
+			JSONObject data = new JSONObject();
+			data.put("pe", pe);
+			data.put("resultList", gson.toJson(userList));
+			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
+		} catch (Exception e) {
+			e.printStackTrace();
+			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"));
+		}
+	}
+	
+	
+	/**
+	 * 璧勯噾缁熻
+	 * @param callback
+	 * @param uid
+	 * @param out
+	 */
+	@RequestMapping(value = "statisticsMoney")
+	public void statisticsMoney(String callback, Long uid, PrintWriter out) {
+		try {
+			UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
+			if (user == null) {
+				JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("璇ョ敤鎴稩D涓嶅瓨鍦�"));
+				return;
+			}
+			
+			Date minDate = null;
+			Date maxDate = null;
+			long timeStamp = System.currentTimeMillis();
+			Calendar calendar = Calendar.getInstance();
+			calendar.setTimeInMillis(timeStamp);
+			List<UserMoneyDetailTypeEnum> typeList = new ArrayList<>();
+			typeList.add(UserMoneyDetailTypeEnum.extract);
+			typeList.add(UserMoneyDetailTypeEnum.extractNew);
+			typeList.add(UserMoneyDetailTypeEnum.extractVerify);
+			typeList.add(UserMoneyDetailTypeEnum.extractVerifyNew);
+			typeList.add(UserMoneyDetailTypeEnum.extractReject);
+			typeList.add(UserMoneyDetailTypeEnum.extractAutoWX);
+			minDate = new Date(0L);
+			maxDate = new Date(timeStamp);
+			// 绱鎴愬姛鎻愮幇
+			BigDecimal totalExtractMoney = userMoneyDetailService.statisticUserTypeMoneyWithDate(uid, typeList, minDate,
+					maxDate, 1).abs();
+			// 鎻愮幇涓噾棰�
+			BigDecimal extractingMoney = extractService.sumVerifyingMoney(uid);
+			
+			// 鍏ㄩ儴鏈埌璐�
+			minDate = new Date(0);
+			maxDate = new Date(timeStamp);
+			BigDecimal unRecievedMoney = hongBaoV2Service.getUnRecievedMoneyWithCreateTime(uid, minDate, maxDate);
+			
+			JSONObject data = new JSONObject();
+			data.put("totalExtractMoney", totalExtractMoney);
+			data.put("extractingMoney", extractingMoney);
+			data.put("balanceMoney", user.getMyHongBao());
+			data.put("unRecievedMoney", unRecievedMoney);
+			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
+		} catch (Exception e) {
+			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"));
+			e.printStackTrace();
+		}
+	}
+	
+	
+	/**
+	 * 鏉冪泭缁熻
+	 * @param callback
+	 * @param uid
+	 * @param out
+	 */
+	@RequestMapping(value = "statisticsGoldCoin")
+	public void statisticsEquity(String callback, Long uid, PrintWriter out) {
+		try {
+			int goldCoin = 0;
+			UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
+			if (userInfoExtra != null) {
+				goldCoin = userInfoExtra.getGoldCoin();
+			}
+			
+			JSONObject data = new JSONObject();
+			data.put("goldCoin", goldCoin);
+			data.put("exchangeGoldCoin",new BigDecimal(integralDetailService.sumUseGoldCoin(uid)).abs());
+			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
+		} catch (Exception e) {
+			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"));
+			e.printStackTrace();
+		}
+	}
+	
+	
+	/**
+	 *  鐢ㄦ埛绮変笣缁熻
+	 * 
+	 * @param callback
+	 * @param pageIndex
+	 * @param pageSize
+	 * @param id
+	 * @param out
+	 */
+	@RequestMapping(value = "countTeamFans")
+	public void countTeamFans(String callback, Long uid, PrintWriter out) {
+		JSONObject data = new JSONObject();
+		
+		// 瀵煎笀
+		String tearcherName = "";
+		TearcherInfo tearcherInfo = tearcherService.selectByUid(uid);
+		if (tearcherInfo != null) {
+			tearcherName = tearcherInfo.getNickName();
+		}
+		data.put("tearcherName", tearcherName); 
+		
+		// 閭�璇蜂汉
+		String bossName = "";
+		UserInfo boss = threeSaleSerivce.getBoss(uid);
+		if (boss != null) {
+			bossName =  boss.getNickName();
+		}
+		data.put("bossName", bossName); 
+		
+		// 閭�璇风矇涓�
+		int doneFirst = 0;
+		int doneSecond = 0;
+		UserInviteValidNum userInviteValidNum = userInviteValidNumService.selectByPrimaryKey(uid);
+		if (userInviteValidNum != null) {
+			doneFirst = userInviteValidNum.getNumFirst() == null ? 0 : userInviteValidNum.getNumFirst();
+			doneSecond = userInviteValidNum.getNumSecond() == null ? 0 : userInviteValidNum.getNumSecond();
+		}
+		data.put("doneFirst", doneFirst); 
+		data.put("doneSecond", doneSecond); 
+		
+		// 涔濅唬绮変笣鏁伴噺
+		data.put("nineFans", threeSaleDetailService.countByBossUidAndMaxLevel(uid, 9)); 
+		
+		// 鏈夋晥绮変笣
+		data.put("first", threeSaleSerivce.countFirstTeam(uid)); 
+		data.put("second", threeSaleSerivce.countSecondTeam(uid)); 
+		JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
+	}
+	
+	
+	
+	/**
+	 * 鐢ㄦ埛璇︾粏淇℃伅
+	 * @param callback
+	 * @param uid
+	 * @param out
+	 */
+	@RequestMapping(value = "getInfoDetail")
+	public void getInfoDetail(String callback, Long uid, PrintWriter out) {
+		
+		UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
+		UserInfoVO userInfoVO = new UserInfoVO();
+		userInfoVO.setPhone(user.getPhone());
+		userInfoVO.setState(user.getState());
+		userInfoVO.setCreatetime(user.getCreatetime());
+		
+		UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
+		if (userInfoExtra != null) {
+			if (!StringUtil.isNullOrEmpty(userInfoExtra.getMark())) {
+				userInfoVO.setMark( userInfoExtra.getMark());
+			}
+			userInfoVO.setInviteCode(userInfoExtra.getInviteCode());
+			userInfoVO.setInviteCodeVip(userInfoExtra.getInviteCodeVip());
+		}
+		
+		// 鏈�杩戜竴娆′笅鍗曟椂闂�
+		Date lastOrderTime = hongBaoV2CountService.getLastHongBaoTime(uid);
+		if (lastOrderTime != null) {
+			userInfoVO.setLastOrderTime(lastOrderTime.getTime());
+		}
+		
+		// 鏈�杩戠櫥褰曟椂闂�
+		UserActiveLog userActiveLog = userActiveLogService.getUserLatestActiveInfo(uid);
+		if (userActiveLog != null) {
+			userInfoVO.setLastLoginTime(userActiveLog.getCreateTime().getTime());
+		}
+		
+		// 鏄剧ず鐢ㄦ埛寰俊 娣樺疂 鑰佺増鏈瓨鍦�
+		String wxUnionId = user.getWxUnionId();
+		if (wxUnionId == null || wxUnionId.trim().length() == 0) {
+			user.setWxName(null);
+		}
+		user.setWxName(user.getWxUnionId());
+		
+
+		// 鏄惁缁戝畾鏀粯瀹濓紙璐拱 + 鍒嗕韩鏉冮檺锛�
+		UserExtraTaoBaoInfo extraTaoBaoInfo = userExtraTaoBaoInfoService.getByUid(uid);
+		  String taoBaoUid = extraTaoBaoInfo.getTaoBaoUid();
+		  String specialId = extraTaoBaoInfo.getSpecialId();
+		  String relationId = extraTaoBaoInfo.getRelationId();
+		if (StringUtil.isNullOrEmpty(taoBaoUid) || StringUtil.isNullOrEmpty(specialId)
+				|| StringUtil.isNullOrEmpty(relationId)) {
+			userInfoVO.setTbName(null);
+			userInfoVO.setTaoBaoUid(null);
+		} else {
+			userInfoVO.setTbName(extraTaoBaoInfo.getTaoBaoNickName());
+			userInfoVO.setTaoBaoUid(extraTaoBaoInfo.getTaoBaoUid());
+		}
+
+		/* 缁戝畾鏀舵璐﹀彿淇℃伅 */
+		List<BindingAccount> account = bindingAccountService.getBindingAccountByUid(uid);
+		if (account != null && account.size() > 0) {
+			BindingAccount bindingAccount = account.get(0);
+			Integer type = bindingAccount.getType();
+			if (type != null && type == 1) {
+				// 鏀粯瀹�
+				userInfoVO.setAccountAlipay(bindingAccount.getAccount());
+				userInfoVO.setAccountName(bindingAccount.getName());
+				userInfoVO.setAccountBindId(bindingAccount.getId());
+			} else if (type != null && type == 2) {
+				// 寰俊
+				userInfoVO.setAccountWX(bindingAccount.getAccount());
+				userInfoVO.setAccountNameWX(bindingAccount.getName());
+				userInfoVO.setAccountBindIdWX(bindingAccount.getId());
+			}
+		}
+		JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(userInfoVO));
+	}
+	
+	
 	/**
 	 * 缁熻浠婃棩鐢ㄦ埛鎬绘儏鍐�
 	 * 
@@ -289,9 +605,7 @@
 			long monthUser = userInfoCountService.countNewUser(null, 1);
 			data.put("todayUser", todayUser);
 			data.put("monthUser", monthUser);
-
 			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
-
 		} catch (Exception e) {
 			e.printStackTrace();
 			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"));
@@ -416,7 +730,6 @@
 	@RequestMapping(value = "deleteUser")
 	public void delete(String callback, String idArray, HttpServletRequest request,  PrintWriter out) {
 		try {
-			
 			AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
 			if (admin == null) {
 				out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("褰撳墠璐︽埛澶辨晥,璇烽噸鏂扮櫥闄嗐��")));
@@ -460,7 +773,6 @@
 	@RequestMapping(value = "forbiddenUser")
 	public void forbiddenUser(String callback, Long uid, HttpServletRequest request, PrintWriter out) {
 		try {
-
 			if (uid == null) {
 				JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("璇蜂紶閫掓纭暟鎹�"));
 				return;
@@ -480,9 +792,7 @@
 
 			String reason = "鍚庡彴灏佺锛屾搷浣滀汉锛�" + admin.getId() + "-" + admin.getName();
 			userAccountService.forbiddenUserAll(uid, reason);
-
 			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("鐢ㄦ埛灏佺鎴愬姛"));
-
 		} catch (Exception e) {
 			e.printStackTrace();
 			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔澶辫触"));
@@ -499,7 +809,6 @@
 	@RequestMapping(value = "relieveForbiddenUser")
 	public void relieveForbiddenUser(String callback, Long uid, PrintWriter out) {
 		try {
-
 			if (uid == null) {
 				JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("璇蜂紶閫掓纭暟鎹�"));
 				return;
@@ -546,9 +855,7 @@
 						forbiddenUserIdentifyCodeService.delete(forbiddenUserIdentifyCode);
 				}
 			}
-
 			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("鐢ㄦ埛瑙e皝鎴愬姛"));
-
 		} catch (Exception e) {
 			e.printStackTrace();
 			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔澶辫触"));
@@ -573,9 +880,7 @@
 			}
 
 			forbiddenUserIdentifyCodeService.saveForbiddenInfo(code, type);
-
 			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("淇敼鎴愬姛"));
-
 		} catch (ForbiddenUserIdentifyCodeException e) {
 			e.printStackTrace();
 			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
@@ -585,157 +890,7 @@
 		}
 	}
 
-	/**
-	 * 鍒犻櫎闃熷憳鍏崇郴
-	 * 
-	 * @param callback
-	 * @param id
-	 * @param out
-	 */
-	@RequestMapping(value = "deleteThreeSale")
-	public void deleteThreeSale(String callback, Long id, PrintWriter out) {
-		try {
-
-			if (id == null) {
-				JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("璇蜂紶閫掓纭暟鎹�"));
-				return;
-			}
-
-			int count = threeSaleService.deleteByPrimaryKey(id);
-
-			if (count > 0) {
-				JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("鍒犻櫎鎴愬姛"));
-			} else {
-				JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鍒犻櫎澶辫触"));
-			}
-
-		} catch (Exception e) {
-			e.printStackTrace();
-			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"));
-		}
-	}
-
-	@RequestMapping(value = "queryMyFirstTeams")
-	public void queryMyFirstTeams(String callback, Integer pageIndex, Integer pageSize, String key, Long bossId,
-			PrintWriter out) {
-		try {
-
-			if (bossId == null) {
-				JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("璇蜂紶閫掓纭暟鎹�"));
-				return;
-			}
-
-			if (pageIndex == null)
-				pageIndex = 1;
-
-			if (pageSize == null)
-				pageSize = Constant.PAGE_SIZE;
-
-			List<ThreeSale> firstTeamList = threeSaleService.queryMyFirstTeamList((pageIndex - 1) * pageSize, pageSize,
-					key, bossId);
-			if (firstTeamList == null || firstTeamList.size() == 0) {
-				JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏆傛棤涓�搴﹂槦鍛�"));
-				return;
-			}
-
-			/* 鑾峰彇閭�璇风敤鎴峰ご鍍� 銆佹樀绉� */
-			for (ThreeSale threeSale : firstTeamList) {
-				UserInfo worker = threeSale.getWorker();
-				if (worker == null) {
-					worker = new UserInfo();
-					threeSale.setWorker(worker);
-				} else {
-					Long id = worker.getId();
-
-					UserInfo currentInfo = userInfoService.selectByPKey(id);
-					if (currentInfo != null) {
-						worker.setNickName(currentInfo.getNickName());
-						worker.setPortrait(currentInfo.getPortrait());
-					}
-				}
-			}
-
-			long count = threeSaleService.queryCountMyFirstTeamList(key, bossId);
-
-			int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
-			PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
-
-			GsonBuilder gsonBuilder = new GsonBuilder();
-			gsonBuilder.serializeNulls();
-			Gson gson = gsonBuilder.create();
-
-			JSONObject data = new JSONObject();
-			data.put("pe", pe);
-			data.put("list", gson.toJson(firstTeamList));
-
-			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
-
-		} catch (Exception e) {
-			e.printStackTrace();
-			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"));
-		}
-	}
-
-	@RequestMapping(value = "queryMySecondTeams")
-	public void queryMySecondTeams(String callback, Integer pageIndex, Integer pageSize, String key, Long bossId,
-			PrintWriter out) {
-		try {
-
-			if (bossId == null) {
-				JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("璇蜂紶閫掓纭暟鎹�"));
-				return;
-			}
-
-			if (pageIndex == null)
-				pageIndex = 1;
-
-			if (pageSize == null)
-				pageSize = Constant.PAGE_SIZE;
-
-			List<ThreeSale> firstTeamList = threeSaleService.queryMySecondTeamList((pageIndex - 1) * pageSize, pageSize,
-					key, bossId);
-			if (firstTeamList == null || firstTeamList.size() == 0) {
-				JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏆傛棤浜屽害闃熷憳"));
-				return;
-			}
-
-			/* 鑾峰彇閭�璇风敤鎴峰ご鍍� 銆佹樀绉� */
-			for (ThreeSale threeSale : firstTeamList) {
-				UserInfo worker = threeSale.getWorker();
-				if (worker == null) {
-					worker = new UserInfo();
-					threeSale.setWorker(worker);
-				} else {
-					Long id = worker.getId();
-
-					UserInfo currentInfo = userInfoService.selectByPKey(id);
-					if (currentInfo != null) {
-						worker.setNickName(currentInfo.getNickName());
-						worker.setPortrait(currentInfo.getPortrait());
-					}
-				}
-			}
-
-			long count = threeSaleService.queryCountMySecondTeamList(key, bossId);
-
-			int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
-			PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
-
-			GsonBuilder gsonBuilder = new GsonBuilder();
-			gsonBuilder.serializeNulls();
-			Gson gson = gsonBuilder.create();
-
-			JSONObject data = new JSONObject();
-			data.put("pe", pe);
-			data.put("list", gson.toJson(firstTeamList));
-
-			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
-
-		} catch (Exception e) {
-			e.printStackTrace();
-			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"));
-		}
-	}
+	 
 
 	/**
 	 * 闃熷憳鍏崇郴
@@ -749,7 +904,7 @@
 	 */
 	@RequestMapping(value = "getRelationList")
 	public void getRelationList(String callback, Integer pageIndex, Integer pageSize, Long uid, Integer type,
-			Integer state, String startTime, String endTime, PrintWriter out) {
+			Integer state, String startTime, String endTime, Integer validState, PrintWriter out) {
 
 		if (pageIndex == null || pageIndex < 1) {
 			pageIndex = 1;
@@ -781,11 +936,11 @@
 			} else if (type == 1) {
 				// 涓�绾х敤鎴�
 				listQuery = threeSaleService.listFirstTeamQuery((pageIndex - 1) * pageSize, pageSize, uid, state,
-						startTime, endTime);
+						startTime, endTime, validState);
 			} else if (type == 2) {
 				// 浜岀骇鐢ㄦ埛
 				listQuery = threeSaleService.listSecondTeamQuery((pageIndex - 1) * pageSize, pageSize, uid, state,
-						startTime, endTime);
+						startTime, endTime, validState);
 			}
 
 			if (listQuery == null || listQuery.size() == 0) {
@@ -794,6 +949,14 @@
 			}
 
 			for (ThreeSale threeSale : listQuery) {
+				// 鐢ㄦ埛淇℃伅
+				UserInfo boss = threeSale.getBoss();
+				threeSale.setBoss(userInfoService.selectByPKey(boss.getId()));
+				
+				UserInfo worker = threeSale.getWorker();
+				threeSale.setWorker(userInfoService.selectByPKey(worker.getId()));
+				
+				
 				Integer expire = threeSale.getExpire();
 				if (threeSale.getState()) {
 					threeSale.setExpire(1); // 閭�璇锋垚鍔�
@@ -805,6 +968,7 @@
 					}
 				}
 			}
+			
 
 			long count = 0;
 			if (type == 0) {
@@ -812,10 +976,10 @@
 				count = threeSaleService.countSuperiorQuery(state, uid);
 			} else if (type == 1) {
 				// 涓�绾х敤鎴�
-				count = threeSaleService.countFirstTeamQuery(uid, state, startTime, endTime);
+				count = threeSaleService.countFirstTeamQuery(uid, state, startTime, endTime, validState);
 			} else if (type == 2) {
 				// 浜岀骇鐢ㄦ埛
-				count = threeSaleService.countSecondTeamQuery(uid, state, startTime, endTime);
+				count = threeSaleService.countSecondTeamQuery(uid, state, startTime, endTime, validState);
 			}
 
 			int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
@@ -874,9 +1038,7 @@
 			JSONObject data = new JSONObject();
 			data.put("pe", pe);
 			data.put("result_list", gson.toJson(userMoneyDetailsList));
-
 			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
-
 		} catch (Exception e) {
 			e.printStackTrace();
 			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏌ヨ澶辫触"));
@@ -1429,7 +1591,6 @@
 					continue;
 				}
 				
-				
 				UserInfo user = userInfoService.selectByPKey(userInfo.getId());
 				if (user != null) {
 					detail.setUserInfo(user);
@@ -1437,10 +1598,8 @@
 			}
 
 			long count = userMoneyDetailService.countQuery(key, keyType);
-
 			int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
 			PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
-
 			
 			GsonBuilder gsonBuilder = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss");
 			gsonBuilder.registerTypeAdapter(UserMoneyDetailTypeEnum.class, new JsonSerializer<UserMoneyDetailTypeEnum>() {
@@ -1454,7 +1613,6 @@
 				}
 			});
 			Gson gson = gsonBuilder.create();
-			 
 			
 			JSONObject data = new JSONObject();
 			data.put("pe", pe);
@@ -1465,4 +1623,10 @@
 			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏌ヨ澶辫触"));
 		}
 	}
+	
+	
+	
+	
+
+			
 }

--
Gitblit v1.8.0