From 19ceb36ec4e57f25313662d08bc5cc918076b204 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 25 六月 2019 10:54:48 +0800
Subject: [PATCH] 添加分享爆款相关接口

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v1/RecommendController.java |   47 ++++++++++++++++++++++++++++++++++-------------
 1 files changed, 34 insertions(+), 13 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/RecommendController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/RecommendController.java
index c545e78..994164a 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/RecommendController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/RecommendController.java
@@ -80,6 +80,7 @@
 import com.yeshi.fanli.service.inter.goods.SuperRecommendSpecialService;
 import com.yeshi.fanli.service.inter.goods.TaoBaoCouponService;
 import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
+import com.yeshi.fanli.service.inter.goods.recommend.RecommendGoodsDeleteHistoryService;
 import com.yeshi.fanli.service.inter.homemodule.SpecialService;
 import com.yeshi.fanli.service.inter.homemodule.SuperSpecialService;
 import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
@@ -229,6 +230,9 @@
 
 	@Resource
 	private DaTaoKeGoodsDetailService daTaoKeGoodsDetailService;
+
+	@Resource
+	private RecommendGoodsDeleteHistoryService recommendGoodsDeleteHistoryService;
 
 	@RequestMapping(value = "getHonestList")
 	public void getHonestList(AcceptData acceptData, PrintWriter out) {
@@ -1309,14 +1313,24 @@
 
 				if (result != null && result.getTaoBaoGoodsBriefs() != null) {
 					// 绛涢��
-					List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
+					List<TaoBaoGoodsBriefExtra> goodsList = new ArrayList<>();
 
-					for (TaoBaoGoodsBrief goods : result.getTaoBaoGoodsBriefs()) {
-						if (!StringUtil.isNullOrEmpty(goods.getCouponInfo()) && goods.getCouponAmount() != null
-								&& goods.getCouponAmount().compareTo(new BigDecimal("5")) >= 0
-								&& goods.getBiz30day() > 1000 && !StringUtil.isNullOrEmpty(goods.getPictUrlWhite()))
-							goodsList.add(goods);
-					}
+					List<TaoBaoGoodsBrief> gList = recommendGoodsDeleteHistoryService
+							.filterGoods(acceptData.getDevice(), result.getTaoBaoGoodsBriefs());
+					// 璁惧鎺ㄨ崘
+					if (gList != null)
+						for (TaoBaoGoodsBrief goods : gList) {
+							if (!StringUtil.isNullOrEmpty(goods.getCouponInfo()) && goods.getCouponAmount() != null
+									&& goods.getCouponAmount().compareTo(new BigDecimal("5")) >= 0
+									&& goods.getBiz30day() > 1000
+									&& !StringUtil.isNullOrEmpty(goods.getPictUrlWhite())) {
+
+								TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods,
+										proportion.toString(), "");
+								extra.setRecommend(true);
+								goodsList.add(extra);
+							}
+						}
 					try {
 						monitorService.addClientAPIMonitor(MonitorFactory.createClientAPI(request, 0,
 								(int) (java.lang.System.currentTimeMillis() - startTime), "鎺ㄨ崘鏁伴噺:" + goodsList.size()));
@@ -1326,8 +1340,8 @@
 
 					Collections.shuffle(goodsList);
 					goodsList = goodsList.size() > 20 ? goodsList.subList(0, 20) : goodsList;
-					for (TaoBaoGoodsBrief goods : goodsList) {
-						array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods, proportion.toString(), "")));
+					for (TaoBaoGoodsBriefExtra goods : goodsList) {
+						array.add(gson.toJson(goods));
 					}
 				} else {
 					try {
@@ -1999,7 +2013,9 @@
 		String hongBao = null;
 
 		// 鑾峰彇鍒镐俊鎭�
-		if (!StringUtil.isNullOrEmpty(tb.getCouponInfo())) {
+		if (!StringUtil.isNullOrEmpty(tb.getCouponInfo()) && tb.getCouponAmount() != null
+				&& tb.getCouponAmount().compareTo(new BigDecimal(0)) > 0 && tb.getCouponEffectiveStartTime() != null
+				&& tb.getCouponEffectiveEndTime() != null) {
 			BigDecimal quanPrice = TaoBaoUtil.getAfterUseCouplePrice(tb);
 			JSONObject couponInfo = new JSONObject();
 			couponInfo.put("couponPrice", MoneyBigDecimalUtil.getWithNoZera(quanPrice).toString());
@@ -2017,7 +2033,9 @@
 					redisManager.saveCommonTaoToken(tb.getAuctionId(), token);
 				}
 			}
-			tb.setCouponLinkTaoToken(token);
+			// 娴嬭瘯
+			if (!Constant.IS_TEST)
+				tb.setCouponLinkTaoToken(token);
 
 			// 鏈嶅姟绔浆閾�
 			// if (convertInServer &&
@@ -2033,7 +2051,10 @@
 			couponInfo.put("couponTime", "浣跨敤鏈熼檺锛�" + tb.getCouponEffectiveStartTime().replace("-", ".") + "-"
 					+ tb.getCouponEffectiveEndTime().replace("-", "."));
 			// 鍒哥殑鍙d护
-			couponInfo.put("couponToken", token);
+
+			// 娴嬭瘯
+			if (!Constant.IS_TEST)
+				couponInfo.put("couponToken", token);
 			goodsJson.put("couponInfo", couponInfo);
 
 			if (tb.getBiz30day() >= 1000) {
@@ -2258,7 +2279,7 @@
 			e1.printStackTrace();
 		}
 
-		if (goodsList != null)
+		if (goodsList != null && goodsList.size() > 0)
 			goodsList.parallelStream().forEach(goods -> {
 
 				// 鑾峰彇璇︽儏

--
Gitblit v1.8.0