From d46dea27b6ec3e0fb32ec7d137699e9fc7d609b0 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期四, 12 十二月 2019 14:18:11 +0800
Subject: [PATCH] 订单补贴消息修改

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RedPackControllerV2.java |  136 +++++++++++++++++++++++++++++++++++----------
 1 files changed, 106 insertions(+), 30 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RedPackControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RedPackControllerV2.java
index 0179e53..2e3ba83 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RedPackControllerV2.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RedPackControllerV2.java
@@ -27,21 +27,29 @@
 import com.google.gson.stream.JsonWriter;
 import com.yeshi.fanli.entity.accept.AcceptData;
 import com.yeshi.fanli.entity.bus.user.UserInfo;
+import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
 import com.yeshi.fanli.entity.redpack.RedPackDetail.RedPackDetailTypeEnum;
 import com.yeshi.fanli.entity.redpack.RedPackExchange;
 import com.yeshi.fanli.entity.redpack.RedPackWinInvite;
 import com.yeshi.fanli.entity.redpack.RedPackWinInvite.RedPackWinInviteTypeEnum;
 import com.yeshi.fanli.exception.redpack.RedPackExchangeException;
 import com.yeshi.fanli.exception.redpack.RedPackGiveRecordException;
+import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
+import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
 import com.yeshi.fanli.service.inter.redpack.RedPackBalanceService;
 import com.yeshi.fanli.service.inter.redpack.RedPackConfigService;
 import com.yeshi.fanli.service.inter.redpack.RedPackDetailService;
 import com.yeshi.fanli.service.inter.redpack.RedPackExchangeService;
+import com.yeshi.fanli.service.inter.redpack.RedPackForbidService;
 import com.yeshi.fanli.service.inter.redpack.RedPackGiveRecordService;
 import com.yeshi.fanli.service.inter.redpack.RedPackWinInviteService;
+import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
 import com.yeshi.fanli.service.inter.user.UserInfoService;
+import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
 import com.yeshi.fanli.util.Constant;
+import com.yeshi.fanli.util.StringUtil;
 import com.yeshi.fanli.util.TimeUtil;
+import com.yeshi.fanli.util.UserInviteUtil;
 import com.yeshi.fanli.vo.redpack.RedPackDetailVO;
 import com.yeshi.fanli.vo.redpack.RedPackWinInviteVO;
 
@@ -59,19 +67,33 @@
 
 	@Resource
 	private RedPackDetailService redPackDetailService;
-	
-	@Resource	
+
+	@Resource
 	private RedPackGiveRecordService redPackGiveRecordService;
-	
-	@Resource	
+
+	@Resource
 	private RedPackExchangeService redPackExchangeService;
-	
-	@Resource	
+
+	@Resource
 	private RedPackWinInviteService redPackWinInviteService;
-	
-	@Resource	
+
+	@Resource
 	private UserInfoService userInfoService;
-	
+
+	@Resource
+	private UserInfoExtraService userInfoExtraService;
+
+	@Resource
+	private JumpDetailV2Service jumpDetailV2Service;
+
+	@Resource
+	private SwiperPictureService swiperPictureService;
+
+	@Resource
+	private UserSystemCouponService userSystemCouponService;
+
+	@Resource
+	private RedPackForbidService redPackForbidService;
 
 	/**
 	 * 缁熻
@@ -97,6 +119,7 @@
 		BigDecimal thisMonthUse = zero;
 		BigDecimal lastMonthUse = zero;
 		BigDecimal balance = redPackBalanceService.getBalance(uid);
+		;
 		if (balance == null) {
 			balance = zero;
 		} else {
@@ -131,10 +154,10 @@
 		tips.add("浣犱篃鍙互閫夋嫨浣跨敤绾㈠寘锛屼韩鍙楃粰鍔涙姌鎵c��");
 		String giveMin = redPackConfigService.getValueByKey("give_money_min");
 		String giveMax = redPackConfigService.getValueByKey("give_money_max");
-		
+
 		// 姝e湪鎻愮幇閲戦
 		BigDecimal extractingMoney = redPackExchangeService.countMoneyByUidAndState(uid, RedPackExchange.STATE_INIT);
-		
+
 		JSONObject data = new JSONObject();
 		data.put("balance", balance.setScale(2).toString());
 		data.put("helpLink", redPackConfigService.getValueByKey("desc_help_link"));
@@ -142,15 +165,15 @@
 		data.put("giveMax", giveMax);
 		data.put("giveDesc", "娉�:绾㈠寘璧犻�侀噾棰濊嚦灏�" + giveMin + "鍏冭嚦澶�" + giveMax + "鍏�");
 
-		if (extractingMoney != null && extractingMoney.compareTo(zero) > 0) 
+		if (extractingMoney != null && extractingMoney.compareTo(zero) > 0)
 			data.put("extractingInfo", "鎻愮幇涓細楼" + extractingMoney.setScale(2));
-		
+
 		data.put("extractShortage", tips);
 		data.put("extractMin", redPackConfigService.getValueByKey("extract_money_min"));
 		data.put("extractMax", redPackConfigService.getValueByKey("extract_money_max"));
 		data.put("extractBanlenMin", redPackConfigService.getValueByKey("extract_banlen_min"));
 		data.put("extractDesc", "娉細3涓伐浣滄棩鍐呭畬鎴愬鏍革紝绾㈠寘鎻愮幇鎴愬姛鍚庡皢浼氳繘鍏ュ埌浣欓銆�");
-		
+
 		data.put("useLink", redPackConfigService.getValueByKey("use_link"));
 
 		data.put("todayWin", todayWin.setScale(2).toString());
@@ -237,7 +260,6 @@
 			}
 		});
 
-
 		Gson gson = gsonBuilder.create();
 
 		JSONObject data = new JSONObject();
@@ -269,10 +291,9 @@
 		}
 	}
 
-	
-	
 	/**
 	 * 杞崲绾㈠寘涓虹湡瀹為噾閽�
+	 * 
 	 * @param acceptData
 	 * @param uid
 	 * @param amount
@@ -292,26 +313,33 @@
 			out.print(JsonUtil.loadFalseResult(1, e.getMsg()));
 		}
 	}
-	
-	
-	
-	@RequestMapping(value = "getRewardList", method = RequestMethod.POST)
-	public void getRewardList(AcceptData acceptData, Integer page, Long uid, PrintWriter out) {
+
+	/**
+	 * 绾㈠寘閭�璇疯繘搴�
+	 * 
+	 * @param acceptData
+	 * @param page
+	 * @param uid
+	 * @param out
+	 */
+	@RequestMapping(value = "getRewardList")
+	public void getRewardList(AcceptData acceptData, Integer page, Long uid, String callback, PrintWriter out) {
 		if (uid == null || uid <= 0) {
 			out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛鏈櫥褰�"));
 			return;
 		}
-		
+
 		if (page == null || page < 1) {
 			out.print(JsonUtil.loadFalseResult(1, "椤电爜涓嶆纭�"));
 			return;
 		}
-		
+
 		List<RedPackWinInviteVO> list = new ArrayList<RedPackWinInviteVO>();
-		
-		List<RedPackWinInvite> listRecord = redPackWinInviteService.getRewardList((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid);
+
+		List<RedPackWinInvite> listRecord = redPackWinInviteService.getRewardList((page - 1) * Constant.PAGE_SIZE,
+				Constant.PAGE_SIZE, uid);
 		if (listRecord != null && !listRecord.isEmpty()) {
-			for (RedPackWinInvite record: listRecord) {
+			for (RedPackWinInvite record : listRecord) {
 				UserInfo user = null;
 				RedPackWinInviteVO winVO = new RedPackWinInviteVO();
 				RedPackWinInviteTypeEnum type = record.getType();
@@ -327,10 +355,58 @@
 				list.add(winVO);
 			}
 		}
-		
+
 		JSONObject data = new JSONObject();
+		data.put("winMoney", redPackWinInviteService.getRewardMoney(uid).setScale(2));
 		data.put("count", redPackWinInviteService.countRewardRecord(uid));
-	    data.put("list", JsonUtil.getApiCommonGson().toJson(list));
-	    out.print(JsonUtil.loadTrueResult(data));		
+		data.put("list", JsonUtil.getApiCommonGson().toJson(list));
+		if (!StringUtil.isNullOrEmpty(callback)) {
+			out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
+		} else {
+			out.print(JsonUtil.loadTrueResult(data));
+		}
 	}
+
+	/**
+	 * 鐢ㄦ埛鍩虹淇℃伅
+	 * 
+	 * @param acceptData
+	 * @param uid
+	 * @param out
+	 */
+	@RequestMapping(value = "getBasicInfo")
+	public void getBasicInfo(AcceptData acceptData, Long uid, String callback, PrintWriter out) {
+		if (uid == null || uid <= 0) {
+			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "鐢ㄦ埛鏈櫥褰�"));
+			return;
+		}
+
+		JSONObject data = new JSONObject();
+		data.put("balance", redPackBalanceService.getBalance(uid));
+		data.put("ruleLink", redPackConfigService.getValueByKey("invite_reward_rule_link"));
+		data.put("shareLink", UserInviteUtil.getShareUrl(uid));
+		data.put("redPackLock", redPackForbidService.verifyForbid(uid));
+
+		String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
+		if ( !StringUtil.isNullOrEmpty(inviteCode)) {
+			data.put("inviteCode", inviteCode);
+		} else {
+			data.put("inviteCode", "");
+		}
+		
+		// 璧犻�佸厤鍗曞埜
+		long freeCouponCount = userSystemCouponService.countGiveFreeCoupon(uid);
+		// 濂栧姳鍒�
+		long rewardCouponCount = userSystemCouponService.countUsableRewardCoupon(uid);
+
+		data.put("freeCouponCount", freeCouponCount);
+		data.put("rewardCouponCount", rewardCouponCount);
+
+		if (!StringUtil.isNullOrEmpty(callback)) {
+			out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
+		} else {
+			out.print(JsonUtil.loadTrueResult(data));
+		}
+	}
+
 }

--
Gitblit v1.8.0