From ca7aa881987169d3d0202fe85d9f47d225111f33 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期五, 01 三月 2019 18:34:55 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java |  186 +++++++++++++++++++++++++++++++--------------
 1 files changed, 127 insertions(+), 59 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java
index b5f3d47..d4bf15b 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java
@@ -53,6 +53,7 @@
 import com.yeshi.fanli.entity.bus.user.ThreeSaleExtraInfo;
 import com.yeshi.fanli.entity.bus.user.UserActiveLog;
 import com.yeshi.fanli.entity.bus.user.UserInfo;
+import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
 import com.yeshi.fanli.entity.bus.user.WeiXinUser;
 import com.yeshi.fanli.entity.common.AdminUser;
 import com.yeshi.fanli.entity.common.Config;
@@ -248,6 +249,12 @@
 			// }
 			// });
 			if (find != null) {
+				if (find.getState() != UserInfo.STATE_NORMAL) {
+					out.print(JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER,
+							Constant.FORBIDDEN_USER_REASON_DESC));
+					return;
+				}
+
 				// 閭�璇峰叧绯荤敓鏁�
 				threeSaleSerivce.effective(find);
 				// 閲嶆柊璁$畻鐢ㄦ埛绛夌骇
@@ -585,11 +592,29 @@
 		}
 
 		data.put("moduleState", mySettings);
-
+		
+		int welfareCenterNews = 0;
+		UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(user.getId());
+		if (userInfoExtra != null && userInfoExtra.getCouponNews() != null) {
+			welfareCenterNews = userInfoExtra.getCouponNews();
+		}
+		data.put("welfareCenterNews", welfareCenterNews);
+		
+		
+		
 		out.print(JsonUtil.loadTrueResult(data));
+		
 		final UserInfo uuser = user;
 		ThreadUtil.run(new Runnable() {
 			public void run() {
+
+				try {
+					// 鑾峰彇閭�璇风爜锛氳嫢鏃犻個璇风爜涓斿瓨鍦ㄦ湁鏁堢殑闃熷憳鍏崇郴 鍒欒嚜鍔ㄧ敓鎴愰個璇风爜
+					userInfoExtraService.getUserInviteCode(uuser.getId());
+				} catch (UserInfoExtraException e) {
+					e.printStackTrace();
+				}
+
 				LogHelper.userInfo(GsonUtil.toJsonExpose(uuser));
 				uuser.setLastLoginIp(remotIP);
 				uuser.setLastLoginTime(java.lang.System.currentTimeMillis());
@@ -881,7 +906,7 @@
 		}
 
 		String minMoney = configService.get(EXTRACT_MIN_MONEY); // 鍗曠瑪鎻愮幇鐨勬渶灏忛噾棰�
-		String maxMoney = configService.get(EXTRACT_MAX_MONEY); // 鍗曠瑪鎻愮幇鐨勬渶澶ч噾棰�
+		String maxDayMoney = configService.get("extract_money_day"); // 姣忔棩鏈�澶ф彁鐜伴噾棰�
 		int maxDayCount = Integer.parseInt(configService.get("extract_count_day"));
 		ExtractRecord extractRecord = extractRecordService.getExtractRecordByUid(uid);
 		boolean canExtract = true;
@@ -890,9 +915,9 @@
 			canExtract = false;
 			errorMsg = String.format("姣忔棩鏈�澶氭彁鐜�%s娆�", maxDayCount + "");
 		} else if (extractRecord != null
-				&& extractRecord.getMoney().add(money).compareTo(new BigDecimal(maxMoney)) > 0) {
+				&& extractRecord.getMoney().add(money).compareTo(new BigDecimal(maxDayMoney)) > 0) {
 			canExtract = false;
-			errorMsg = String.format("姣忔棩鏈�澶氭彁鐜�%s鍏�", maxMoney);
+			errorMsg = String.format("姣忔棩鏈�澶氭彁鐜�%s鍏�", maxDayMoney);
 		} else if (new BigDecimal(minMoney).compareTo(money) > 0) {
 			canExtract = false;
 			errorMsg = String.format("姣忔鏈�浣庢彁鐜�%s鍏�", minMoney);
@@ -1283,6 +1308,12 @@
 			HttpServletRequest request, int type, PrintWriter out) {
 		UserInfo user = userInfoService.getUserById(uid);
 		if (user == null) {
+			user = userInfoService.getUserByIdWithMybatis(uid);
+			if (user != null && user.getState() != UserInfo.STATE_NORMAL) {
+				out.print(JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC));
+				return;
+			}
+
 			out.print(JsonUtil.loadFalseResult("鐢ㄦ埛涓嶅瓨鍦�"));
 			return;
 		}
@@ -1832,28 +1863,91 @@
 	@RequestMapping(value = "getMyTeam", method = RequestMethod.POST)
 	public void getMyTeam(AcceptData acceptData, long page, long uid, long type, PrintWriter out) {
 
-		int pageSize = Constant.PAGE_SIZE;
+		try {
+			int pageSize = Constant.PAGE_SIZE;
 
-		JSONObject resultData = new JSONObject();
-		if (type == 1) {
-			resultData = threeSaleSerivce.getMyFirstTeam((page - 1) * pageSize, pageSize, uid);
-		} else if (type == 2) {
-			resultData = threeSaleSerivce.getMySecondTeam((page - 1) * pageSize, pageSize, uid);
+			JSONObject resultData = new JSONObject();
+			if (type == 1) {
+				resultData = threeSaleSerivce.getMyFirstTeam((page - 1) * pageSize, pageSize, uid);
+			} else if (type == 2) {
+				resultData = threeSaleSerivce.getMySecondTeam((page - 1) * pageSize, pageSize, uid);
+			}
+
+			// 瀹夊崜绯荤粺杩斿洖鎵�鏈夋暟鎹�
+			String platform = acceptData.getPlatform();
+			if ("android".equalsIgnoreCase(platform)) {
+				long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
+				long firstTeamTotal = threeSaleSerivce.countFirstTeam(uid, null);
+
+				long secondTeam = threeSaleSerivce.countSecondTeam(uid, 1);
+				long secondTeamTotal = threeSaleSerivce.countSecondTeam(uid, null);
+
+				JSONObject bossData = null;
+				ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
+				if (threeSale != null) {
+					bossData = new JSONObject();
+					UserInfo boss = threeSale.getBoss();
+					if (boss != null) {
+						bossData.put("nickName", boss.getNickName());
+						bossData.put("portrait", boss.getPortrait());
+					}
+
+					SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
+					Long createTime = threeSale.getCreateTime();
+					Date inviteTime = new Date(createTime);
+					bossData.put("inviteTime", "閭�璇锋椂闂�: " + sdf.format(inviteTime));
+				}
+
+				String helpLink = configService.get("team_help_url");
+				if (helpLink == null) {
+					helpLink = "";
+				}
+
+				boolean hasCode = false;
+				String inviteCode = userInfoExtraService.getUserInviteCode(uid);
+				if (inviteCode != null && inviteCode.trim().length() > 0) {
+					hasCode = true; // 宸叉湁閭�璇风爜
+				} else {
+					// 閭�璇锋縺娲婚摼鎺�
+					resultData.put("activationlink", configService.get("invite_activation_url"));
+				}
+				resultData.put("hasCode", hasCode);
+
+				resultData.put("helpLink", helpLink);
+				resultData.put("firstTeam", firstTeam);
+				resultData.put("firstTeamTotal", firstTeamTotal);
+				resultData.put("secondTeam", secondTeam);
+				resultData.put("secondTeamTotal", secondTeamTotal);
+				resultData.put("boss", bossData);
+			}
+			out.print(JsonUtil.loadTrueResult(resultData));
+		} catch (UserInfoExtraException e) {
+			out.print(JsonUtil.loadFalseResult(e.getMsg()));
+		} catch (Exception e) {
+			out.print(JsonUtil.loadFalseResult("缁熻澶辫触"));
+			e.printStackTrace();
 		}
 
-		// 瀹夊崜绯荤粺杩斿洖鎵�鏈夋暟鎹�
-		String platform = acceptData.getPlatform();
-		if ("android".equalsIgnoreCase(platform)) {
+	}
+
+	/**
+	 * 鐢ㄦ埛闃熷憳缁熻 1.4.1
+	 * 
+	 * @param acceptData
+	 * @param id
+	 * @param out
+	 */
+	@RequestMapping(value = "countMyTeam", method = RequestMethod.POST)
+	public void countMyTeam(AcceptData acceptData, long uid, PrintWriter out) {
+		try {
 			long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
 			long firstTeamTotal = threeSaleSerivce.countFirstTeam(uid, null);
 
 			long secondTeam = threeSaleSerivce.countSecondTeam(uid, 1);
 			long secondTeamTotal = threeSaleSerivce.countSecondTeam(uid, null);
-
-			JSONObject bossData = null;
+			JSONObject bossData = new JSONObject();
 			ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
 			if (threeSale != null) {
-				bossData = new JSONObject();
 				UserInfo boss = threeSale.getBoss();
 				if (boss != null) {
 					bossData.put("nickName", boss.getNickName());
@@ -1866,6 +1960,8 @@
 				bossData.put("inviteTime", "閭�璇锋椂闂�: " + sdf.format(inviteTime));
 			}
 
+			JSONObject resultData = new JSONObject();
+
 			String helpLink = configService.get("team_help_url");
 			if (helpLink == null) {
 				helpLink = "";
@@ -1876,54 +1972,26 @@
 			resultData.put("secondTeam", secondTeam);
 			resultData.put("secondTeamTotal", secondTeamTotal);
 			resultData.put("boss", bossData);
-		}
-		out.print(JsonUtil.loadTrueResult(resultData));
-	}
 
-	/**
-	 * 鐢ㄦ埛闃熷憳缁熻 1.4.1
-	 * 
-	 * @param acceptData
-	 * @param id
-	 * @param out
-	 */
-	@RequestMapping(value = "countMyTeam", method = RequestMethod.POST)
-	public void countMyTeam(AcceptData acceptData, long uid, PrintWriter out) {
-
-		long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
-		long firstTeamTotal = threeSaleSerivce.countFirstTeam(uid, null);
-
-		long secondTeam = threeSaleSerivce.countSecondTeam(uid, 1);
-		long secondTeamTotal = threeSaleSerivce.countSecondTeam(uid, null);
-		JSONObject bossData = new JSONObject();
-		ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
-		if (threeSale != null) {
-			UserInfo boss = threeSale.getBoss();
-			if (boss != null) {
-				bossData.put("nickName", boss.getNickName());
-				bossData.put("portrait", boss.getPortrait());
+			boolean hasCode = false;
+			String inviteCode = userInfoExtraService.getUserInviteCode(uid);
+			if (inviteCode != null && inviteCode.trim().length() > 0) {
+				hasCode = true; // 宸叉湁閭�璇风爜
+			} else {
+				// 閭�璇锋縺娲婚摼鎺�
+				resultData.put("activationlink", configService.get("invite_activation_url"));
 			}
+			resultData.put("hasCode", hasCode);
 
-			SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
-			Long createTime = threeSale.getCreateTime();
-			Date inviteTime = new Date(createTime);
-			bossData.put("inviteTime", "閭�璇锋椂闂�: " + sdf.format(inviteTime));
+			out.print(JsonUtil.loadTrueResult(resultData));
+
+		} catch (UserInfoExtraException e) {
+			out.print(JsonUtil.loadFalseResult(e.getMsg()));
+		} catch (Exception e) {
+			out.print(JsonUtil.loadFalseResult("缁熻澶辫触"));
+			e.printStackTrace();
 		}
 
-		JSONObject resultData = new JSONObject();
-
-		String helpLink = configService.get("team_help_url");
-		if (helpLink == null) {
-			helpLink = "";
-		}
-		resultData.put("helpLink", helpLink);
-		resultData.put("firstTeam", firstTeam);
-		resultData.put("firstTeamTotal", firstTeamTotal);
-		resultData.put("secondTeam", secondTeam);
-		resultData.put("secondTeamTotal", secondTeamTotal);
-		resultData.put("boss", bossData);
-
-		out.print(JsonUtil.loadTrueResult(resultData));
 	}
 
 	/**

--
Gitblit v1.8.0