From 684779576c02c13cb2a18a7d93e88da7e57fd4b8 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期二, 31 三月 2020 11:25:13 +0800
Subject: [PATCH] 2.1 需求

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserAccountControllerV2.java |  150 ++++++++++++++-----------------------------------
 1 files changed, 43 insertions(+), 107 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserAccountControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserAccountControllerV2.java
index 888c7b1..4a9cf1d 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserAccountControllerV2.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserAccountControllerV2.java
@@ -539,79 +539,7 @@
 			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "鐢ㄦ埛鏈櫥褰�"));
 			return;
 		}
-
-		UserInfo userInfo = userInfoService.selectByPKey(uid);
-		if (userInfo == null) {
-			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "璇ョ敤鎴蜂笉瀛樺湪"));
-			return;
-		}
-
-		// 鐪侀挶 -鑷喘浜х敓杩斿埄
-
-		List<Integer> list = new ArrayList<Integer>();
-		list.add(BanLiShopOrder.STATE_SUCCESS);
-		BigDecimal payMoney = new BigDecimal(userVipConfigService.getValueByKey("require_order_pay"));
-
-		BigDecimal finishGoldCoin = integralDetailService.getCumulativeMoney(uid);
 		
-//		long finishTeam = hongBaoV2CountService.countValidOrderTeamUserByUid(uid,
-//				TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME), payMoney);
-//	
-		long finishTeam = 0L;
-		long vipBegin = TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME);
-		List<ThreeSale> listThreeSale = threeSaleSerivce.getValidWorkerIdsByTime(uid, vipBegin);
-		if (listThreeSale != null && listThreeSale.size() > 0) {
-			for (ThreeSale three: listThreeSale) {
-				UserInfo worker = three.getWorker();
-				if (worker == null || worker.getId() == null) {
-					continue;
-				}
-				// 1銆侀個璇峰叧绯绘垚鍔熷悗锛�2銆佸崟锛堝垎浜� + 鑷喘锛夊疄浠樻澶т簬1鍏�
-				long countValid = hongBaoV2CountService.countValidOrderByUidAndTime(worker.getId(), three.getSucceedTime(), payMoney);
-				if (countValid > 0) {
-					finishTeam ++;
-				}
-			}
-		}
-		
-		long finishHongBao = banLiShopOrderService.countByUidAndState(uid, list);
-		BigDecimal finishMoney = hongBaoV2CountService.getRewardMoneyBySelf(uid);
-
-		long limitTeam = 0;
-
-		// 鍖哄垎鑰佺敤鎴峰拰鏂扮敤鎴�
-		String limtDate = userVipConfigService.getValueByKey("vip_execute_time");
-		Date executeDate = null;
-		try {
-			SimpleDateFormat format = new SimpleDateFormat("yyyy-mm-dd");
-			executeDate = format.parse(limtDate);
-		} catch (ParseException e) {
-			e.printStackTrace();
-		}
-
-		UserInfoExtra extra = userInfoExtraService.getUserInfoExtra(uid);
-		if (extra != null
-				&& (extra.getFirstLoginTime() == null || extra.getFirstLoginTime().getTime() < executeDate.getTime())) {
-			limitTeam = (Long.parseLong(userVipConfigService.getValueByKey("require_invite_num_old_user")));
-		} else {
-			limitTeam = (Long.parseLong(userVipConfigService.getValueByKey("require_invite_num_new_user")));
-		}
-		long limitHongBao = (Long.parseLong(userVipConfigService.getValueByKey("require_shop_buy")));
-		BigDecimal limitMoney = (new BigDecimal(userVipConfigService.getValueByKey("require_fan_money")));
-		BigDecimal limitgoldCoin = (new BigDecimal(userVipConfigService.getValueByKey("require_gold_coin")));
-
-		if (finishGoldCoin.compareTo(limitgoldCoin) >= 0 && finishTeam >= limitTeam && finishHongBao >= limitHongBao
-				&& finishMoney.compareTo(limitMoney) >= 0) {// 鏉′欢绗﹀悎
-			;
-		} else {
-			if (!StringUtil.isNullOrEmpty(callback)) {
-				out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("鏈揪鍒板紑閫氭潯浠�")));
-			} else {
-				out.print(JsonUtil.loadFalseResult("鏈揪鍒板紑閫氭潯浠�"));
-			}
-			return;
-		}
-		// 寮�閫�
 		try {
 			userVIPInfoService.applyVIP(uid);
 		} catch (UserVIPInfoException e) {
@@ -624,9 +552,9 @@
 		}
 
 		if (!StringUtil.isNullOrEmpty(callback)) {
-			out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("")));
+			out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("鐢宠鎴愬姛锛屾鍦ㄥ彈鐞嗕腑")));
 		} else {
-			out.print(JsonUtil.loadTrueResult(""));
+			out.print(JsonUtil.loadTrueResult("鐢宠鎴愬姛锛屾鍦ㄥ彈鐞嗕腑"));
 		}
 	}
 
@@ -660,16 +588,7 @@
 		long limitShare = 0;
 		long limitFirst = 0;
 		long limitSecond = 0;
-		String school = "鏉挎牀瀛﹂櫌";
-		String platformSubsidy = "琛ヨ创杩斾剑 ";
-		String teamSubsidy = "浼氬憳涓撳睘";
-		String teamReward = "瓒呯骇浼氬憳涓撳睘";
 		if (level == UserInviteLevelEnum.actived ||  level == UserInviteLevelEnum.noActive) {
-			// TODO 姣斾緥
-			school += "杈句汉鐝�";
-			platformSubsidy += "<label style=\"color:#E5005C;\">52.5%</label>";
-			
-			
 			String zigou = userVipConfigService.getValueByKey("vip_pre_3_zigou_order_count");
 			if (!StringUtil.isNullOrEmpty(zigou)) {
 				limitZiGou = Long.parseLong(zigou);
@@ -687,13 +606,6 @@
 				limitSecond = Long.parseLong(second);
 			}
 		} else if (level == UserInviteLevelEnum.vipPre1) {
-			
-			// TODO 姣斾緥
-			school += "鏅�氱彮";
-			platformSubsidy += "<label style=\"color:#E5005C;\">60%</label>";
-			teamSubsidy = "浼氬憳涓撳睘鏈�楂�<label style=\"color:#E5005C;\">7.5%</label>";
-			
-						
 			String zigou = userVipConfigService.getValueByKey("vip_pre_7_zigou_order_count");
 			if (!StringUtil.isNullOrEmpty(zigou)) {
 				limitZiGou = Long.parseLong(zigou);
@@ -711,10 +623,6 @@
 				limitSecond = Long.parseLong(second);
 			}
 		} else if (level == UserInviteLevelEnum.vipPre2 || level == UserInviteLevelEnum.vipApply) {
-			school += "楂樼骇鐝�";
-			platformSubsidy += "<label style=\"color:#E5005C;\">70%</label>";
-			teamSubsidy = "浼氬憳涓撳睘鏈�楂�<label style=\"color:#E5005C;\">15%</label>";
-			
 			String zigou = userVipConfigService.getValueByKey("vip_pre_10_zigou_order_count");
 			if (!StringUtil.isNullOrEmpty(zigou)) {
 				limitZiGou = Long.parseLong(zigou);
@@ -733,19 +641,15 @@
 			}
 		} else if (level == UserInviteLevelEnum.vip || level == UserInviteLevelEnum.tearcherApply) {
 			// TODO 姣斾緥
-			school += "瓒呯骇鐝�";
-			platformSubsidy += "<label style=\"color:#E5005C;\">115%</label>";
-			teamSubsidy = "浼氬憳涓撳睘鏈�楂�<label style=\"color:#E5005C;\">22.5%</label>";
-			teamReward = "瓒呯骇浼氬憳涓撳睘鏈�楂�<label style=\"color:#E5005C;\">40%</label>";
 			
 		} else if (level == UserInviteLevelEnum.tearcher) {
 			// TODO
 		}
 		
-		// 閭�璇疯鍗�
+		// 鑷喘璁㈠崟
 		long doneZiGou = hongBaoV2CountService.counOrderByUidAndOrderType(uid, Constant.VIP_ORDER_PAY,
 				HongBaoV2.TYPE_ZIGOU);
-		// 閭�璇疯鍗�
+		// 鍒嗕韩璁㈠崟
 		long doneShare = hongBaoV2CountService.counOrderByUidAndOrderType(uid, Constant.VIP_ORDER_PAY,
 				HongBaoV2.TYPE_SHARE_GOODS);
 		
@@ -776,12 +680,44 @@
 		typeList.add(UserMoneyDetailTypeEnum.systemEqualize);
 		typeList.add(UserMoneyDetailTypeEnum.subsidy);
 		BigDecimal earnMoney = userMoneyDetailService.statisticUserTypeMoneyWithDate(uid, typeList, start, now).abs();
-		
 		if (level != UserInviteLevelEnum.vip) {
 			BigDecimal rate = new BigDecimal("0.409");
 			saveMoney = MoneyBigDecimalUtil.mul2(saveMoney, rate);
 			earnMoney = MoneyBigDecimalUtil.mul2(earnMoney, rate);
 		}
+		
+		String school = "鏉挎牀瀛﹂櫌";
+		String platformSubsidy = "琛ヨ创杩斾剑 ";
+		String teamSubsidy = "浼氬憳涓撳睘";
+		String teamReward = "瓒呯骇浼氬憳涓撳睘";
+		
+		// 杈句汉鐗�
+		JSONObject jsonrRed1 = new JSONObject();
+		jsonrRed1.put("platformSubsidy", platformSubsidy + "<label style=\"color:#E5005C;\">52.5%</label>");
+		jsonrRed1.put("school", school + "<label style=\"color:#E5005C;\">杈句汉鐝�</label>");
+		jsonrRed1.put("teamSubsidy", teamSubsidy);
+		jsonrRed1.put("teamReward", teamReward);
+		
+		
+		JSONObject jsonrRed2 = new JSONObject();
+		jsonrRed2.put("platformSubsidy", platformSubsidy + "<label style=\"color:#E5005C;\">60%</label>");
+		jsonrRed2.put("school", school + "<label style=\"color:#E5005C;\">鏅�氱彮</label>");
+		jsonrRed2.put("teamSubsidy", teamSubsidy + "鏈�楂�<label style=\"color:#E5005C;\">7.5%</label>");
+		jsonrRed2.put("teamReward", teamReward);
+		
+
+		JSONObject jsonrRed3 = new JSONObject();
+		jsonrRed3.put("platformSubsidy", platformSubsidy + "<label style=\"color:#E5005C;\">70%</label>");
+		jsonrRed3.put("school", school + "<label style=\"color:#E5005C;\">楂樼骇鐝�</label>");
+		jsonrRed3.put("teamSubsidy", teamSubsidy + "鏈�楂�<label style=\"color:#E5005C;\">15%</label>");
+		jsonrRed3.put("teamReward", teamReward);
+		
+
+		JSONObject jsonrRed4 = new JSONObject();
+		jsonrRed4.put("platformSubsidy", platformSubsidy + "<label style=\"color:#E5005C;\">115%</label>");
+		jsonrRed4.put("school", school + "<label style=\"color:#E5005C;\">瓒呯骇鐝�</label>");
+		jsonrRed4.put("teamSubsidy", teamSubsidy + "鏈�楂�<label style=\"color:#E5005C;\">22.5%</label>");
+		jsonrRed4.put("teamReward", teamReward + "鏈�楂�<label style=\"color:#E5005C;\">40%</label>");
 		
 		
 		JSONObject json = new JSONObject();
@@ -805,12 +741,12 @@
 		json.put("limitFirst", limitFirst);
 		json.put("limitSecond", limitSecond);
 		
-		// 鏂囧瓧鍐呭
-		json.put("platformSubsidy", platformSubsidy);
-		json.put("school", school);
-		json.put("teamSubsidy", teamSubsidy);
-		json.put("teamReward", teamReward);
-
+		// 宸插畬鎴�
+		json.put("master", jsonrRed1);
+		json.put("vip1", jsonrRed2);
+		json.put("vip2", jsonrRed3);
+		json.put("vip3", jsonrRed4);
+		
 		// 浜哄伐瀹㈡湇閾炬帴
 		json.put("csdLink", configService.get(ConfigKeyEnum.customerServiceLink.getKey()));
 		

--
Gitblit v1.8.0