From 88b54772dbcf5ecab1e2316e4e4626ac901b8908 Mon Sep 17 00:00:00 2001
From: yujian <yujian>
Date: 星期二, 22 一月 2019 15:58:24 +0800
Subject: [PATCH] 邀请码添加返回状态

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/UserAccountController.java |  113 ++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 76 insertions(+), 37 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/UserAccountController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/UserAccountController.java
index 83c6462..e6f5c50 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/UserAccountController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/UserAccountController.java
@@ -31,8 +31,8 @@
 import com.yeshi.fanli.service.inter.config.InviteGetMoneyService;
 import com.yeshi.fanli.service.inter.config.SystemService;
 import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
-import com.yeshi.fanli.service.inter.hongbao.HongBaoMessageService;
 import com.yeshi.fanli.service.inter.hongbao.HongBaoService;
+import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service;
 import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
 import com.yeshi.fanli.service.inter.order.LostOrderService;
 import com.yeshi.fanli.service.inter.order.OrderItemServcie;
@@ -43,12 +43,13 @@
 import com.yeshi.fanli.service.inter.user.AccountMessageService;
 import com.yeshi.fanli.service.inter.user.BindingAccountService;
 import com.yeshi.fanli.service.inter.user.ExtractService;
-import com.yeshi.fanli.service.inter.user.MoneyRecordService;
-import com.yeshi.fanli.service.inter.user.PassWordErrorRecordService;
 import com.yeshi.fanli.service.inter.user.ShamUserService;
+import com.yeshi.fanli.service.inter.user.SpreadUserImgService;
 import com.yeshi.fanli.service.inter.user.TBPidService;
 import com.yeshi.fanli.service.inter.user.UserAccountService;
 import com.yeshi.fanli.service.inter.user.UserInfoService;
+import com.yeshi.fanli.service.inter.user.UserShareGoodsRecordService;
+import com.yeshi.fanli.util.Constant;
 import com.yeshi.fanli.util.GsonUtil;
 import com.yeshi.fanli.util.RedisManager;
 import com.yeshi.fanli.util.StringUtil;
@@ -77,7 +78,7 @@
 	private HongBaoService hongBaoService;
 
 	@Resource
-	private MoneyRecordService moneyRecordService;
+	private HongBaoV2Service hongBaoV2Service;
 
 	@Resource
 	private BindingAccountService bindingAccountService;
@@ -86,16 +87,10 @@
 	private ExtractService extractService;
 
 	@Resource
-	private PassWordErrorRecordService passWordErrorRecordService;
-
-	@Resource
 	private ConfigService configService;
 
 	@Resource
 	private SystemService systemService;
-
-	@Resource
-	private HongBaoMessageService hongBaoMessageService;
 
 	@Resource
 	private ShamUserService shamUserService;
@@ -136,6 +131,12 @@
 	@Resource
 	private TaoBaoUnionConfigService taoBaoUnionConfigService;
 
+	@Resource
+	private SpreadUserImgService spreadUserImgService;
+
+	@Resource
+	private UserShareGoodsRecordService userShareGoodsRecordService;
+
 	private static final String PASSWORD_MAX_ERROR = "password_max_error";
 	private static final String EXTRACT_MIN_MONEY = "extract_min_money";
 	private static final String EXTRACT_MAX_MONEY = "extract_max_money";
@@ -155,14 +156,14 @@
 	@RequestMapping(value = "login")
 	public void login(AcceptData acceptData, String code, String vcode, String phone, boolean wxinstall,
 			String tbOpenid, String tbNickName, String tbPortrait, int loginType, Boolean first, HttpSession session,
-			PrintWriter out) {
+			HttpServletRequest request, PrintWriter out) {
 		System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
 		if (system == null) {
 			out.print(JsonUtil.loadFalseResult("绯荤粺涓嶅瓨鍦�"));
 			return;
 		}
 
-		if (loginType == 3)// 楠岃瘉鐭俊楠岃瘉鐮�
+		if (loginType == 3 && !Constant.IS_TEST)// 楠岃瘉鐭俊楠岃瘉鐮�
 		{
 			String oldVcode = redisManager.getSMSVCode(phone, SMSHistory.TYPE_LOGIN);
 			if (StringUtil.isNullOrEmpty(oldVcode) || !oldVcode.equalsIgnoreCase(vcode)) {
@@ -178,7 +179,7 @@
 		tbUserInfo.setTbName(tbNickName);
 		tbUserInfo.setTbPic(tbPortrait);
 		try {
-			LoginResult result = userAccountService.login(session, first, system.getAppid(), code, phone, tbUserInfo,
+			LoginResult result = userAccountService.login(request, first, system.getAppid(), code, phone, tbUserInfo,
 					wxinstall, loginType);
 			if (result == null)
 				LogHelper.error("login-result涓虹┖鍊�");
@@ -197,6 +198,11 @@
 			root.put("data", data);
 			out.print(JsonUtil.loadTrueResult(root));
 		} catch (UserAccountException e) {
+			try {
+				LogHelper.cookieLog("鐧诲綍鍑洪敊:" + e.getCode() + "-" + e.getMessage());
+			} catch (Exception e1) {
+				e1.printStackTrace();
+			}
 			out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
 		}
 	}
@@ -321,11 +327,35 @@
 				out.print(JsonUtil.loadFalseResult(1, "鑾峰彇寰俊鐢ㄦ埛淇℃伅澶辫触"));
 				return;
 			}
-			user = userAccountService.getUserInfoByWXUnionId(system.getAppid(), weiXinUser.getUnionid());
+			try {
+				user = userAccountService.getUserInfoByWXUnionId(system.getAppid(), weiXinUser.getUnionid());
+			} catch (UserAccountException e) {
+				try {
+					LogHelper.errorDetailInfo(e, null, "鑾峰彇鐢ㄦ埛淇℃伅鍑洪敊");
+				} catch (Exception e1) {
+					e1.printStackTrace();
+				}
+			}
 		} else if (!StringUtil.isNullOrEmpty(tbOpenid)) {
-			user = userAccountService.getUserInfoByTaoBaoOpenId(system.getAppid(), tbOpenid);
+			try {
+				user = userAccountService.getUserInfoByTaoBaoOpenId(system.getAppid(), tbOpenid);
+			} catch (UserAccountException e) {
+				try {
+					LogHelper.errorDetailInfo(e);
+				} catch (Exception e1) {
+					e1.printStackTrace();
+				}
+			}
 		} else if (!StringUtil.isNullOrEmpty(phone)) {
-			user = userAccountService.getUserInfoByPhone(system.getAppid(), phone);
+			try {
+				user = userAccountService.getUserInfoByPhone(system.getAppid(), phone);
+			} catch (UserAccountException e) {
+				try {
+					LogHelper.errorDetailInfo(e);
+				} catch (Exception e1) {
+					e1.printStackTrace();
+				}
+			}
 		}
 
 		if (user == null) {
@@ -716,9 +746,7 @@
 			redisManager.removeCommonString(key);
 		}
 	}
-	
-	
-	
+
 	@RequestMapping(value = "bindalipaywithverifynew")
 	public void bindAlipayWithVerifyNew(AcceptData acceptData, Long uid, String name, String account, PrintWriter out) {
 
@@ -764,7 +792,8 @@
 				"PERMIT_CHECK_PERM_IDENTITY_THEFT", "PERMIT_NON_BANK_LIMIT_PAYEE", "EXCEED_LIMIT_UNRN_DM_AMOUNT" };
 		try {
 			BindingAccount bindingAccount = bindingAccountService.changeAlipayBindingWithVerify(uid, name, account);
-			out.print(JsonUtil.loadTrue(0, JsonUtil.getGson().toJson(bindingAccount), "绯荤粺宸叉垚鍔熻浆璐�0.1鍏冨埌鎻愮幇璐﹀彿涓紝鎻愮幇璐﹀彿楠岃瘉閫氳繃锛屾伃鍠滀綘锛佸彲浠ユ彁鐜颁簡銆�"));
+			out.print(JsonUtil.loadTrue(0, JsonUtil.getGson().toJson(bindingAccount),
+					"绯荤粺宸叉垚鍔熻浆璐�0.1鍏冨埌鎻愮幇璐﹀彿涓紝鎻愮幇璐﹀彿楠岃瘉閫氳繃锛屾伃鍠滀綘锛佸彲浠ユ彁鐜颁簡銆�"));
 		} catch (AlipayTransferException e1) {
 			if (e1.getSubCode().equalsIgnoreCase("PAYEE_NOT_EXIST")) {
 				String msg = "绯荤粺鏈兘鎴愬姛杞处0.1鍏冿紝鎻愮幇璐﹀彿淇℃伅鏈夎锛岃鏍稿鍚庨噸鏂板~鍐欍��";
@@ -808,7 +837,6 @@
 			redisManager.removeCommonString(key);
 		}
 	}
-	
 
 	/**
 	 * 鑾峰彇鐢ㄦ埛璧勯噾璇︽儏
@@ -819,6 +847,7 @@
 	 */
 	@RequestMapping(value = "getusermoney")
 	public void getMoneyDetail(AcceptData acceptData, Long uid, PrintWriter out) {
+
 		UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
 		if (user == null) {
 			out.print(JsonUtil.loadFalseResult(2, "鐢ㄦ埛涓嶅瓨鍦�"));
@@ -834,32 +863,42 @@
 		}
 
 		BigDecimal moneyLastMonth = inviteGetMoneyService.getMoneyLastMonth(uid + "");
-		BigDecimal unOpenmoney = hongBaoService.getUnOpenHongBaoByUid(uid);
-		BigDecimal totalFanMoney = hongBaoService.getMyTotalHongBaoByUid(user.getId());
+		BigDecimal unOpenmoney = hongBaoV2Service.getUnRecievedFanLiMoney(uid);
+		BigDecimal totalFanMoney = hongBaoV2Service.getTotalFanLiMoney(uid);
 		JSONObject data = new JSONObject();
+		int spreadImgCount = spreadUserImgService.countUserSpreadImg(uid);
+		long shareCount = userShareGoodsRecordService.countShareRecordByUid(uid);
+
 		// IOS绔暟瀛楁寜鐓у瓧绗︿覆澶勭悊
 		if ("ios".equalsIgnoreCase(acceptData.getPlatform()) && Integer.parseInt(acceptData.getVersion()) > 33) {
 			data.put("moneyToday", moneyToday.setScale(2, BigDecimal.ROUND_DOWN).toString());
 			data.put("moneyMonth", moneyMonth.setScale(2, BigDecimal.ROUND_DOWN).toString());
-			data.put("moneyLastMonth", moneyLastMonth.toString());
-			data.put("money", user.getMyHongBao().toString());
-			data.put("unGetMoney", unOpenmoney.toString());
-			data.put("totalFanLiMoney", totalFanMoney.toString());// 绱杩斿埄
-			data.put("totalTiChengMoney", hongBaoService.getTotalTiChengMoney(uid).toString());// 绱鎻愭垚
-			data.put("totalUnGetTiChengMoney", hongBaoService.getUnGetTiChengMoney(uid).toString()); // 鏈埌璐︽彁鎴�
+			data.put("moneyLastMonth", moneyLastMonth.setScale(2, BigDecimal.ROUND_DOWN).toString());
+			data.put("money", user.getMyHongBao().setScale(2, BigDecimal.ROUND_DOWN).toString());
+			data.put("unGetMoney", unOpenmoney.setScale(2, BigDecimal.ROUND_DOWN).toString());
+			data.put("totalFanLiMoney", totalFanMoney.setScale(2, BigDecimal.ROUND_DOWN).toString());// 绱杩斿埄
+			data.put("totalTiChengMoney",
+					hongBaoV2Service.getTotalTiChengMoney(uid).setScale(2, BigDecimal.ROUND_DOWN).toString());// 绱鎻愭垚
+			data.put("totalUnGetTiChengMoney",
+					hongBaoV2Service.getUnGetTiChengMoney(uid).setScale(2, BigDecimal.ROUND_DOWN).toString()); // 鏈埌璐︽彁鎴�
 			// 灞曠ず鎻愭垚鏁版嵁
-			data.put("showTiCheng", hongBaoService.getTotalTiChengCount(uid) > 0);
+			if (configService.iosOnLining(Integer.parseInt(acceptData.getVersion())))
+				data.put("showTiCheng", false);
+			else
+				data.put("showTiCheng", spreadImgCount + shareCount > 0);
 		} else {
 			data.put("moneyToday", moneyToday.setScale(2, BigDecimal.ROUND_DOWN));
 			data.put("moneyMonth", moneyMonth.setScale(2, BigDecimal.ROUND_DOWN));
-			data.put("moneyLastMonth", moneyLastMonth);
-			data.put("money", user.getMyHongBao());
-			data.put("unGetMoney", unOpenmoney);
-			data.put("totalFanLiMoney", totalFanMoney);// 绱杩斿埄
-			data.put("totalTiChengMoney", hongBaoService.getTotalTiChengMoney(uid));// 绱鎻愭垚
-			data.put("totalUnGetTiChengMoney", hongBaoService.getUnGetTiChengMoney(uid)); // 鏈埌璐︽彁鎴�
+			data.put("moneyLastMonth", moneyLastMonth.setScale(2, BigDecimal.ROUND_DOWN));
+			data.put("money", user.getMyHongBao().setScale(2, BigDecimal.ROUND_DOWN));
+			data.put("unGetMoney", unOpenmoney.setScale(2, BigDecimal.ROUND_DOWN));
+			data.put("totalFanLiMoney", totalFanMoney.setScale(2, BigDecimal.ROUND_DOWN));// 绱杩斿埄
+			data.put("totalTiChengMoney",
+					hongBaoV2Service.getTotalTiChengMoney(uid).setScale(2, BigDecimal.ROUND_DOWN));// 绱鎻愭垚
+			data.put("totalUnGetTiChengMoney",
+					hongBaoV2Service.getUnGetTiChengMoney(uid).setScale(2, BigDecimal.ROUND_DOWN)); // 鏈埌璐︽彁鎴�
 			// 灞曠ず鎻愭垚鏁版嵁
-			data.put("showTiCheng", hongBaoService.getTotalTiChengCount(uid) > 0);
+			data.put("showTiCheng", spreadImgCount + shareCount > 0);
 		}
 
 		user.setNoOpenHongBao(unOpenmoney);

--
Gitblit v1.8.0