From c007868c62c7da5c9ce1bf0e77d9e5f8619826e4 Mon Sep 17 00:00:00 2001 From: yujian <yujian@123.com> Date: 星期三, 12 六月 2019 12:24:09 +0800 Subject: [PATCH] 查询默认有效调整 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v1/RecommendController.java | 65 +++++++++++++++++++++----------- 1 files changed, 42 insertions(+), 23 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 b110e19..6681e0a 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 @@ -92,6 +92,7 @@ import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService; import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService; import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService; +import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailService; import com.yeshi.fanli.service.inter.user.ShamUserService; import com.yeshi.fanli.service.inter.user.TBPidService; import com.yeshi.fanli.service.inter.user.UserCustomSettingsService; @@ -104,6 +105,7 @@ import com.yeshi.fanli.util.TaoBaoConstant; import com.yeshi.fanli.util.ThreadUtil; import com.yeshi.fanli.util.TimeUtil; +import com.yeshi.fanli.util.VersionUtil; import com.yeshi.fanli.util.cache.TaoBaoGoodsCacheUtil; import com.yeshi.fanli.util.factory.MonitorFactory; import com.yeshi.fanli.util.taobao.TaoBaoCouponUtil; @@ -223,6 +225,9 @@ @Resource private TaoBaoShopService taoBaoShopService; + + @Resource + private DaTaoKeGoodsDetailService daTaoKeGoodsDetailService; @RequestMapping(value = "getHonestList") public void getHonestList(AcceptData acceptData, PrintWriter out) { @@ -1602,8 +1607,8 @@ if ("ios".equalsIgnoreCase(platform)) { root.put("htmlLink", configService.get("index_html_link_ios")); } - - root.put("spikeGoods", getSpikeGoodsContent(acceptData)); + + root.put("spikeGoods", getSpikeGoodsContent(acceptData)); out.print(JsonUtil.loadTrueResult(root)); } catch (Exception e) { @@ -1687,8 +1692,8 @@ nextTime.set(Calendar.MILLISECOND, 0); JSONArray array = null; - String timekey = "spikeGoods_hour"; - String cachekey = "spikeGoodsList"; + String timekey = String.format("spikeGoods_hour-%s-%s", acceptData.getPlatform(), acceptData.getVersion()); + String cachekey = String.format("spikeGoodsList-%s-%s", acceptData.getPlatform(), acceptData.getVersion()); String timeValue = redisManager.getCommonString(timekey); if (timeValue == null || !timeValue.equals(hour + "")) { @@ -1699,7 +1704,7 @@ array = JSONArray.fromObject(cacheValue); } } - + JumpDetailV2 jumpDetail = jumpDetailV2Service.getByTypeCache("web"); if (array == null) { array = new JSONArray(); @@ -1714,30 +1719,41 @@ } /* 閬嶅巻鍒楄〃鏁版嵁 */ - for (QualityFactory qualityFactory : listGoods) { + for (QualityFactory qualityFactory : listGoods) { TaoBaoGoodsBrief taoBaoGoodsBrief = qualityFactory.getTaoBaoGoodsBrief(); if (taoBaoGoodsBrief == null) { continue; } - array.add(gson + JSONObject goods = new JSONObject(); + goods.put("goods", gson .toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null))); + goods.put("jumpDetail", jumpDetail); + JSONObject params = new JSONObject(); + params.put("url", configService.get("spike_goods_link") + "?id=" + taoBaoGoodsBrief.getAuctionId()); + goods.put("params", params); + + // 1.5.4鍙婁互鍚庤繑鍥� + if (VersionUtil.greaterThan_1_5_40(acceptData.getPlatform(), acceptData.getVersion())) { + array.add(goods); + } else { + array.add(goods.optJSONObject("goods")); + } } // 缂撳瓨鍗婁釜灏忔椂 redisManager.cacheCommonString(cachekey, array.toString(), 60 * 30); } Long endTime = nextTime.getTimeInMillis() - java.lang.System.currentTimeMillis(); - + JSONObject root = new JSONObject(); root.put("time", nextTime.getTimeInMillis()); - root.put("endTime", endTime > 0? endTime : 0); + root.put("endTime", endTime > 0 ? endTime : 0); root.put("listgoods", array); - - + JSONObject params = new JSONObject(); params.put("url", configService.get("spike_goods_link")); - JumpDetailV2 jumpDetail = jumpDetailV2Service.getByTypeCache("web"); + root.put("params", params); root.put("jumpDetail", jumpDetail); @@ -1924,6 +1940,12 @@ if (!StringUtil.isNullOrEmpty(tb.getPictUrlWhite())) finalImgList.add(0, tb.getPictUrlWhite()); + // 澶ф窐瀹㈠晢鍝佽繃婊� + try { + goods = daTaoKeGoodsDetailService.filterTaoBaoGoods(goods); + } catch (Exception e) { + LogHelper.errorDetailInfo(e); + } JSONObject goodsJson = new JSONObject(); goodsJson.put("auctionId", tb.getAuctionId()); goodsJson.put("imgList", finalImgList); @@ -1932,11 +1954,10 @@ goodsJson.put("price", tb.getReservePrice().toString()); goodsJson.put("zkPrice", tb.getZkPrice().toString()); - // 30澶╅攢閲� goodsJson.put("saleCount", TaoBaoUtil.getSaleCount(tb.getBiz30day())); goodsJson.put("salesCount", TaoBaoUtil.getSaleCount(tb.getBiz30day())); - + // 鍒嗕韩璧� BigDecimal shareMoney = taoBaoGoodsBriefService.getShareGoodsUserHongBao(tb); data.put("shareMoney", "楼" + shareMoney); @@ -2056,17 +2077,15 @@ } else { tbShopInfo.setUserType("0"); } - + String shopLink = tbShopInfo.getShopUrl(); if (StringUtil.isNullOrEmpty(shopLink)) { tbShopInfo.setShopUrl(TaoBaoUtil.getShopLink(tbShopInfo.getUserId())); } } - - // 搴楅摵 - if (("android".equalsIgnoreCase(acceptData.getPlatform()) && Integer.parseInt(acceptData.getVersion()) >= 40) - || ("ios".equalsIgnoreCase(acceptData.getPlatform()) - && Integer.parseInt(acceptData.getVersion()) >= 49)) { + + // 搴楅摵1.5.4鍙婁互鍚庣増鏈� + if (VersionUtil.greaterThan_1_5_40(acceptData.getPlatform(), acceptData.getVersion())) { TaoBaoShop shop = taoBaoShopService.getTaoBaoShop(goods.getAuctionId(), goods.getSellerId()); if (shop != null) { String shopLink = shop.getShopLink(); @@ -2079,7 +2098,7 @@ goodsJson.put("shopInfo", tbShopInfo); } - goodsJson.put("fanliValid",true);// 鏄惁鏈夎繑鍒� + goodsJson.put("fanliValid", true);// 鏄惁鏈夎繑鍒� // 鍒嗕韩璺緞 String shareUrl = String.format("%s?id=" + tb.getAuctionId(), Constant.systemCommonConfig.getAppShareInfoUrl()); @@ -2097,9 +2116,9 @@ data.put("shareUsers", listShareUser); data.put("couponUsers", listCouponUser); data.put("detailWebUrl", "http://apph5.yeshitv.com/apppage/goods_img.html?id=" + id); - + data.put("noRebateHelpLink", configService.get("no_rebate_help_link")); - + // 鍟嗗搧閾炬帴 String h5Url = String.format("http://%s%s?id=%s&appType=flq", configService.getH5Host(), Constant.systemCommonConfig.getShareGoodsPagePath(), tb.getAuctionId() + ""); -- Gitblit v1.8.0