From 554de444b87aab5f93cb1593a8095612cf9479a7 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期二, 09 六月 2020 17:34:30 +0800
Subject: [PATCH] 订单

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/TaoLiJinControllerV2.java |  332 ++++++++++++++++++++++++++-----------------------------
 1 files changed, 156 insertions(+), 176 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/TaoLiJinControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/TaoLiJinControllerV2.java
index 623f5b9..782558c 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/TaoLiJinControllerV2.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/TaoLiJinControllerV2.java
@@ -15,9 +15,9 @@
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
+import org.yeshi.utils.DateUtil;
 import org.yeshi.utils.JsonUtil;
 
-import com.fasterxml.jackson.core.util.VersionUtil;
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 import com.google.gson.JsonElement;
@@ -27,43 +27,44 @@
 import com.google.gson.TypeAdapter;
 import com.google.gson.stream.JsonReader;
 import com.google.gson.stream.JsonWriter;
+import com.yeshi.fanli.dto.ConfigParamsDTO;
 import com.yeshi.fanli.entity.accept.AcceptData;
 import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
-import com.yeshi.fanli.entity.bus.tlj.DeviceTaoLiJinRecord;
 import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail.TaoLiJinDetailTypeEnum;
-import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin;
-import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin.TaoLiJinOriginEnum;
+import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinNewbies;
 import com.yeshi.fanli.entity.bus.user.UserMoneyExtra;
-import com.yeshi.fanli.entity.bus.user.UserRank;
+import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
+import com.yeshi.fanli.entity.system.ConfigKeyEnum;
 import com.yeshi.fanli.entity.taobao.ShareHotGoods;
 import com.yeshi.fanli.entity.taobao.TLJBuyGoods;
+import com.yeshi.fanli.entity.taobao.TLJFreeBuyGoods;
 import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
 import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra;
-import com.yeshi.fanli.exception.tlj.UserTaoLiJinOriginException;
-import com.yeshi.fanli.exception.tlj.UserTaoLiJinRecordException;
+import com.yeshi.fanli.exception.user.UserInfoException;
 import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
 import com.yeshi.fanli.service.inter.config.ConfigService;
 import com.yeshi.fanli.service.inter.goods.ShareGoodsService;
 import com.yeshi.fanli.service.inter.goods.ShareGoodsTextTemplateService;
 import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
-import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
 import com.yeshi.fanli.service.inter.lable.QualityGoodsService;
 import com.yeshi.fanli.service.inter.money.UserMoneyExtraService;
 import com.yeshi.fanli.service.inter.monitor.BusinessEmergent110Service;
 import com.yeshi.fanli.service.inter.monitor.MonitorService;
+import com.yeshi.fanli.service.inter.order.OrderHongBaoMoneyComputeService;
+import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
+import com.yeshi.fanli.service.inter.redpack.UserTaoLiJinNewbiesService;
 import com.yeshi.fanli.service.inter.taobao.ShareHotGoodsService;
 import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
+import com.yeshi.fanli.service.inter.taobao.TLJFreeBuyGoodsService;
 import com.yeshi.fanli.service.inter.tlj.ConfigTaoLiJinService;
-import com.yeshi.fanli.service.inter.tlj.DeviceTaoLiJinRecordService;
 import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinDetailService;
 import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService;
 import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinRecordService;
-import com.yeshi.fanli.service.inter.user.UserExtraTaoBaoInfoService;
 import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
 import com.yeshi.fanli.service.inter.user.UserInfoService;
 import com.yeshi.fanli.service.inter.user.UserShareGoodsRecordService;
+import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
 import com.yeshi.fanli.util.Constant;
-import com.yeshi.fanli.util.StringUtil;
 import com.yeshi.fanli.util.TaoBaoConstant;
 import com.yeshi.fanli.util.TimeUtil;
 import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
@@ -73,7 +74,9 @@
 import com.yeshi.fanli.vo.goods.MoneyInfoVO;
 import com.yeshi.fanli.vo.goods.OtherInfo;
 import com.yeshi.fanli.vo.goods.taobao.TLJBuyHongBaoVO;
+import com.yeshi.fanli.vo.homemodule.BannerVO;
 import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
+import com.yeshi.fanli.vo.redpack.TaoLiJinWinDetailVO;
 import com.yeshi.fanli.vo.tlj.ReduceHongBao;
 import com.yeshi.fanli.vo.tlj.SpreadHongBao;
 import com.yeshi.fanli.vo.tlj.TaoLiJinDetailVO;
@@ -135,9 +138,6 @@
 	private QualityGoodsService qualityGoodsService;
 
 	@Resource
-	private DeviceTaoLiJinRecordService deviceTaoLiJinRecordService;
-
-	@Resource
 	private JumpDetailV2Service jumpDetailV2Service;
 
 	@Resource(name = "taskExecutor")
@@ -151,6 +151,15 @@
 
 	@Resource
 	private SwiperPictureService swiperPictureService;
+
+	@Resource
+	private UserTaoLiJinNewbiesService userTaoLiJinNewbiesService;
+
+	@Resource
+	private TLJFreeBuyGoodsService tljFreeBuyGoodsService;
+	
+	@Resource
+	private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService;
 
 	/**
 	 * 鑾峰彇娣樼ぜ閲戝垎浜褰�
@@ -377,147 +386,6 @@
 	}
 
 	/**
-	 * 绾㈠寘棰嗗彇璇︽儏
-	 * 
-	 * @param acceptData
-	 * @param uid
-	 * @param type
-	 * @param out
-	 */
-	@RequestMapping(value = "getHongbaoDetails", method = RequestMethod.POST)
-	public void getHongbaoDetails(AcceptData acceptData, Long uid, String type, PrintWriter out) {
-
-		if (StringUtil.isNullOrEmpty(type)) {
-			out.print(JsonUtil.loadFalseResult(1, "绫诲瀷涓嶈兘涓虹┖"));
-			return;
-		}
-
-		// 鐢ㄦ埛鏈櫥褰曟椂 璁惧棰嗗彇鏂扮孩鍖�
-		if (uid == null || uid <= 0) {
-			BigDecimal money = null;
-			DeviceTaoLiJinRecord deviceRecord = deviceTaoLiJinRecordService.getByDevice(acceptData.getDevice());
-			if (deviceRecord != null) {
-				// 宸查鍙�
-				money = deviceRecord.getMoney();
-			} else {
-				String value = configTaoLiJinService.getValueByKey("hongbao_newbies", null);
-				if (StringUtil.isNullOrEmpty(value)) {
-					out.print(JsonUtil.loadFalseResult(1, "绯荤粺绾㈠寘涓嶅瓨鍦�"));
-					return;
-				}
-				money = new BigDecimal(value);
-				deviceTaoLiJinRecordService.save(acceptData.getDevice(), money);
-			}
-
-			JSONObject data = new JSONObject();
-			data.put("icon", configTaoLiJinService.getValueByKey("taolijin_system_icon", null));
-			data.put("title", "鏂颁汉绾㈠寘");
-			data.put("content", "鑷喘鐩存帴鎶电幇锛屼紭鎯犵湡瀹炲彲瑙侊紒");
-			data.put("type", 1);
-			data.put("money", money.setScale(2).toString());
-			data.put("usage", "棰嗗彇鎴愬姛锛屽凡瀛樺叆鈥滄垜鐨�-鎺ㄥ箍绾㈠寘鈥�");
-			data.put("jumpName", "鍘讳娇鐢�");
-			data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("share_goods_hot"));
-			data.put("tip", configTaoLiJinService.getValueByKey("hongbao_newbies_tip", null));
-			data.put("rules", configTaoLiJinService.getValueByKey("newbies_rules_link", null));
-
-			out.print(JsonUtil.loadTrueResult(data));
-			return;
-		}
-
-		// 鐧诲綍鐢ㄦ埛
-		boolean isReceive = false;
-		JSONObject data = new JSONObject();
-		data.put("icon", configTaoLiJinService.getValueByKey("taolijin_system_icon", null));
-
-		if (type.equals(TaoLiJinOriginEnum.newbiesWin.name())) {
-			BigDecimal hasMoney = null;
-			UserTaoLiJinOrigin userTaoLiJin = userTaoLiJinOriginService.getByUidAndOrigin(uid, type);
-			if (userTaoLiJin != null) { // 宸查鍙�
-				hasMoney = userTaoLiJin.getMoney();
-			} else {
-				try {
-					UserTaoLiJinOrigin origin = userTaoLiJinOriginService.addNewbiesWinMoney(uid);
-					hasMoney = origin.getMoney();
-				} catch (UserTaoLiJinOriginException e) {
-					out.print(JsonUtil.loadFalseResult(e.getMsg()));
-					return;
-				}
-			}
-
-			data.put("title", "鏂颁汉绾㈠寘");
-			data.put("content", "鑷喘鐩存帴鎶电幇锛屼紭鎯犵湡瀹炲彲瑙侊紒");
-			data.put("type", 1);
-			data.put("money", hasMoney.setScale(2).toString());
-			data.put("usage", "棰嗗彇鎴愬姛锛屽凡瀛樺叆鈥滄垜鐨�-鎺ㄥ箍绾㈠寘鈥�");
-			data.put("jumpName", "鍘讳娇鐢�");
-			data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("share_goods_hot"));
-			data.put("tip", configTaoLiJinService.getValueByKey("hongbao_newbies_tip", null));
-			data.put("rules", configTaoLiJinService.getValueByKey("newbies_rules_link", null));
-
-		} else if (type.equals(TaoLiJinOriginEnum.rankWin.name())) {
-			boolean isRank = false;
-			BigDecimal hasMoney = null;
-			UserTaoLiJinOrigin userTaoLiJin = userTaoLiJinOriginService.getRankByThisMonth(uid, type);
-			if (userTaoLiJin != null) { // 宸查鍙�
-				isRank = true;
-				isReceive = true;
-				hasMoney = userTaoLiJin.getMoney();
-			} else {
-				isRank = false;
-				UserRank userRank = userInfoExtraService.gerUserRank(uid);
-				if (userRank != null) {
-					try {
-						UserTaoLiJinOrigin origin = userTaoLiJinOriginService.addRankWinMoney(uid, userRank);
-						hasMoney = origin.getMoney();
-						isRank = true;
-					} catch (UserTaoLiJinOriginException e) {
-						if (e.getCode() != 2) {
-							isRank = false;
-							out.print(JsonUtil.loadFalseResult(e.getMsg()));
-							return;
-						}
-					}
-				}
-			}
-
-			// 绛夌骇涓嶈冻
-			if (!isRank) {
-				data.put("title", "璐︽埛绛夌骇绂忓埄");
-				data.put("content", "鎺ㄥ箍绾㈠寘锛屽ソ鍙嬬鍒╋紒");
-				data.put("type", 2);
-				data.put("money", "鏈湀璐︽埛绛夌骇鏈揪鍒癨r\n缁х画鍔犳补");
-				data.put("jumpName", "鍘绘煡鐪�");
-				data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("user_rank"));
-				data.put("tip", configTaoLiJinService.getValueByKey("hongbao_rank_not_enough_tip", null));
-				data.put("rules", configTaoLiJinService.getValueByKey("rank_rules_link", null));
-				out.print(JsonUtil.loadTrueResult(data));
-				return;
-			} else {
-				data.put("title", "璐︽埛绛夌骇绂忓埄");
-				data.put("content", "鎺ㄥ箍绾㈠寘锛屽ソ鍙嬬鍒╋紒");
-				data.put("type", 1);
-				data.put("money", hasMoney.setScale(2).toString());
-				if (isReceive) {
-					data.put("usage", "鏈湀棰嗗彇锛屽凡瀛樺叆鈥滄垜鐨�-鎺ㄥ箍绾㈠寘鈥�");
-				} else {
-					data.put("usage", "棰嗗彇鎴愬姛锛屽凡瀛樺叆鈥滄垜鐨�-鎺ㄥ箍绾㈠寘鈥�");
-				}
-				data.put("jumpName", "鍘讳娇鐢�");
-				data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("share_goods_hot"));
-				data.put("tip", configTaoLiJinService.getValueByKey("hongbao_rank_tip", null));
-				data.put("rules", configTaoLiJinService.getValueByKey("rank_rules_link", null));
-			}
-
-		} else {
-			out.print(JsonUtil.loadFalseResult(1, "绫诲瀷涓嶅尮閰�"));
-			return;
-		}
-
-		out.print(JsonUtil.loadTrueResult(data));
-	}
-
-	/**
 	 * 鍒嗕韩鐖嗘鍟嗗搧-闄愪簬娣樼ぜ閲�
 	 * 
 	 * @param acceptData
@@ -604,11 +472,6 @@
 	 */
 	@RequestMapping(value = "getShareGoodsV2", method = RequestMethod.POST)
 	public void getShareGoodsV2(AcceptData acceptData, Long uid, PrintWriter out) {
-		if (uid == null || uid <= 0) {
-			out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛鏈櫥褰�"));
-			return;
-		}
-
 		String day = TimeUtil.getGernalTime(java.lang.System.currentTimeMillis());
 		List<ShareHotGoods> listHot = shareHotGoodsService.listByDay(day);
 		if (listHot == null) {
@@ -629,8 +492,9 @@
 			}
 		}
 
-		BigDecimal fanLiRate = hongBaoManageService.getTLJShareRate(System.currentTimeMillis());
-		BigDecimal shareRate = hongBaoManageService.getTLJShareRate(System.currentTimeMillis());
+		ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
+				acceptData.getVersion());
+
 		for (ShareHotGoods hotGoods : listHot) {
 			TaoBaoGoodsBrief taoBaoGoodsBrief = hotGoods.getGoods();
 			if (taoBaoGoodsBrief == null) {
@@ -646,8 +510,8 @@
 				continue;
 			}
 
-			GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate, shareRate);
-			
+			GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, paramsDTO);
+
 			// 澶т簬1.6.5鐨勬墠浼氭樉绀虹鍒╀环
 			if (com.yeshi.fanli.util.VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) {
 				if (detailVO.getCouponPrice() != null && detailVO.getCouponPrice().compareTo(new BigDecimal(0)) > 0)
@@ -655,7 +519,7 @@
 				else
 					detailVO.setZkPrice(detailVO.getZkPrice().subtract(spreadMoney));
 			}
-			
+
 			// 鍘绘帀鏍囩
 			detailVO.setLabels(null);
 
@@ -721,7 +585,7 @@
 			}
 
 			// 璁$畻鎺ㄥ箍绾㈠寘
-			BigDecimal spreadMoney = TaoBaoUtil.getGoodsHongBaoMoney(taoBaoGoodsBrief, proportion);
+			BigDecimal spreadMoney = TaoBaoUtil.getGoodsHongBaoMoney(taoBaoGoodsBrief, proportion,true);
 
 			// 鎺ㄥ箍绾㈠寘 涓嶈兘灏忎簬1
 			if (spreadMoney.compareTo(new BigDecimal(1.0)) < 0) {
@@ -755,14 +619,15 @@
 		data.put("count", array.size());
 		data.put("list", array);
 		if (page == 1) {
-			List<SwiperPicture> bannerList = swiperPictureService.getByBannerCard("zigoulijian_banner");
+			List<BannerVO> bannerList = swiperPictureService.getByBannerCardAndVersion("zigoulijian_banner",
+					acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()));
 
 			if (bannerList != null && bannerList.size() > 0)
 				data.put("topPicture", bannerList.get(0).getSrc());
 			else
 				data.put("topPicture", "");
 
-			data.put("ruleUrl", configService.get("zigoulijian_rule"));
+			data.put("ruleUrl", configService.get(ConfigKeyEnum.zigoulijianRule.getKey()));
 		}
 		out.print(JsonUtil.loadTrueResult(data));
 	}
@@ -788,6 +653,8 @@
 				.excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
 
 		BigDecimal proportion = TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE;
+		ConfigParamsDTO paramsDTO = new ConfigParamsDTO(proportion, proportion, Constant.MAX_REWARD_RATE,
+				hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP));
 		for (TLJBuyGoods hotGoods : listHot) {
 			TaoBaoGoodsBrief taoBaoGoodsBrief = hotGoods.getGoods();
 			if (taoBaoGoodsBrief == null) {
@@ -795,14 +662,14 @@
 			}
 
 			// 璁$畻鎺ㄥ箍绾㈠寘
-			BigDecimal spreadMoney = TaoBaoUtil.getGoodsHongBaoMoney(taoBaoGoodsBrief, proportion);
+			BigDecimal spreadMoney = TaoBaoUtil.getGoodsHongBaoMoney(taoBaoGoodsBrief, proportion,true);
 
 			// 鎺ㄥ箍绾㈠寘 涓嶈兘灏忎簬1
 			if (spreadMoney.compareTo(new BigDecimal(1.0)) < 0) {
 				continue;
 			}
 
-			GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, proportion, proportion);
+			GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, paramsDTO);
 
 			// 澶т簬1.6.5鐨勬墠浼氭樉绀虹鍒╀环
 			if (com.yeshi.fanli.util.VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) {
@@ -841,14 +708,15 @@
 		data.put("count", array.size());
 		data.put("list", array);
 		if (page == 1) {
-			List<SwiperPicture> bannerList = swiperPictureService.getByBannerCard("zigoulijian_banner");
+			List<BannerVO> bannerList = swiperPictureService.getByBannerCardAndVersion("zigoulijian_banner",
+					acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()));
 
 			if (bannerList != null && bannerList.size() > 0)
 				data.put("topPicture", bannerList.get(0).getSrc());
 			else
 				data.put("topPicture", "");
 
-			data.put("ruleUrl", configService.get("zigoulijian_rule"));
+			data.put("ruleUrl", configService.get(ConfigKeyEnum.zigoulijianRule.getKey()));
 		}
 		out.print(JsonUtil.loadTrueResult(data));
 	}
@@ -863,17 +731,129 @@
 	 */
 	@RequestMapping(value = "giveTLJ", method = RequestMethod.POST)
 	public void giveTLJ(AcceptData acceptData, Long uid, BigDecimal amount, PrintWriter out) {
+		out.print(JsonUtil.loadFalseResult(1, "鎶辨瓑锛屾帹骞跨孩鍖呯浉鍏冲姛鑳藉凡涓嬬嚎锛�"));
+	}
+
+	/**
+	 * 鏂颁汉绾㈠寘璇︽儏
+	 * 
+	 * @param acceptData
+	 * @param uid
+	 * @param out
+	 */
+	@RequestMapping(value = "getWinDetail", method = RequestMethod.POST)
+	public void getWinDetail(AcceptData acceptData, Long uid, PrintWriter out) {
 		if (uid == null || uid <= 0) {
 			out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛鏈櫥褰�"));
 			return;
 		}
 
 		try {
-			String tips = userTaoLiJinRecordService.giveTaolijin(uid, amount);
-			out.print(JsonUtil.loadTrueResult(tips));
-		} catch (UserTaoLiJinRecordException e) {
-			out.print(JsonUtil.loadFalseResult(1, e.getMsg()));
+			TaoLiJinWinDetailVO winDetail = userTaoLiJinNewbiesService.receiveReward(uid);
+			if (winDetail == null) {
+				out.print(JsonUtil.loadFalseResult(1, "绾㈠寘宸茶鎶㈠厜"));
+				return;
+			}
+
+			// 2銆侀《閮ㄨ疆鎾浘
+			List<BannerVO> oldtopPicList = swiperPictureService.getByBannerCardAndVersion(
+					"redpack_win_detail_banner", acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()));
+			List<BannerVO> topPicList = new ArrayList<>();
+			if (oldtopPicList != null && oldtopPicList.size() > 0)
+				topPicList.addAll(oldtopPicList);
+
+			JSONObject data = new JSONObject();
+			data.put("detail", JsonUtil.getApiCommonGson().toJson(winDetail));
+			data.put("banner", JsonUtil.getApiCommonGson().toJson(topPicList));
+			out.print(JsonUtil.loadTrueResult(data));
+		} catch (Exception e) {
+			out.print(JsonUtil.loadFalseResult(1, "绾㈠寘宸茶鎶㈠厜鍟�"));
 		}
 	}
 
+	/**
+	 * 鏂颁汉鍏嶅崟鍒楄〃
+	 * @param acceptData
+	 * @param uid
+	 * @param out
+	 */
+	@RequestMapping(value = "gerFreeList")
+	public void gerFreeList(String callback, AcceptData acceptData, int page, Long uid, PrintWriter out) {
+		if (uid == null || uid <= 0) {
+			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "鐢ㄦ埛鏈櫥褰�"));
+			return;
+		}
+
+		String day = TimeUtil.getGernalTime(java.lang.System.currentTimeMillis());
+		List<TLJFreeBuyGoods> listFree = tljFreeBuyGoodsService.listByDay(day);
+		if (listFree == null) {
+			listFree = new ArrayList<TLJFreeBuyGoods>();
+		}
+
+		JSONArray array = new JSONArray();
+		Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
+				.excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
+
+		ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
+				acceptData.getVersion());
+
+		for (TLJFreeBuyGoods freeGoods : listFree) {
+			TaoBaoGoodsBrief goods = freeGoods.getGoods();
+			if (goods == null)
+				continue;
+
+			// 璁$畻鍒稿悗浠� 1<= n <= 2
+			BigDecimal couplePrice = TaoBaoUtil.getAfterUseCouplePrice(goods);
+			if (couplePrice.compareTo(new BigDecimal(1.0)) < 0 && couplePrice.compareTo(new BigDecimal(2.0)) > 0)
+				continue;
+
+			GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO);
+
+			// 涓撳睘鏍囩
+			List<ClientTextStyleVO> labels = new ArrayList<ClientTextStyleVO>();
+			labels.add(new ClientTextStyleVO("鏂颁汉涓撳睘", "#FE0014"));
+			labels.add(new ClientTextStyleVO("瀹炰粯0鍏�", "#FF9600"));
+			detailVO.setLabels(labels);
+			array.add(gson.toJson(detailVO));
+		}
+
+		if (page > 1)
+			array.clear();
+
+		JSONObject data = new JSONObject();
+		data.put("count", array.size());
+		data.put("list", array);
+		if (page == 1) {
+			try {
+				data.put("portrait", userInfoService.getUserInfo(uid).getPortrait());
+			} catch (UserInfoException e) {
+				JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, e.getMsg()));
+				return;
+			}
+
+			String state = "宸茶繃鏈�";
+			BigDecimal balance = new BigDecimal(0);
+			UserTaoLiJinNewbies winDetail = userTaoLiJinNewbiesService.selectByPrimaryKey(uid);
+			if (winDetail != null) {
+				balance = winDetail.getMoney();
+				if (winDetail.getEndTime().getTime() > java.lang.System.currentTimeMillis()) {
+					try {
+						String remaining = DateUtil.dateDiff2(new Date(), winDetail.getEndTime());
+						if (!remaining.equals("0鍒�"))
+							state = "鍓�" + remaining + "杩囨湡";
+					} catch (Exception e) {
+						e.printStackTrace();
+					}
+				}
+			}
+
+			String rule = configTaoLiJinService.getValueByKey("new_user_free_buy_list_rule");
+			rule = rule.replace("{閾炬帴}", configService.get(ConfigKeyEnum.customerServiceLink.getKey()));
+
+			data.put("state", state);
+			data.put("balance", "鏂颁汉绾㈠寘锛�" + balance.setScale(2) + "鍏�");
+			data.put("rule", rule);
+		}
+		JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
+	}
 }

--
Gitblit v1.8.0