From 6fdcc0c26dd33e87a024a69ed635d9aedb59cad6 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 07 一月 2020 12:02:50 +0800 Subject: [PATCH] 订单搜索引擎增量更新 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/CommonContentControllerV2.java | 36 +++++++++++++++++++++--------------- 1 files changed, 21 insertions(+), 15 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/CommonContentControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/CommonContentControllerV2.java index e8a3497..fcb29db 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/CommonContentControllerV2.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/CommonContentControllerV2.java @@ -15,6 +15,7 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import com.yeshi.fanli.dto.ConfigParamsDTO; import com.yeshi.fanli.dto.common.CommonContentNav; import com.yeshi.fanli.dto.common.CommonContentResult; import com.yeshi.fanli.dto.common.CommonContentTypeEnum; @@ -36,6 +37,7 @@ import com.yeshi.fanli.tag.PageEntity; import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.StringUtil; +import com.yeshi.fanli.util.VersionUtil; import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory; import com.yeshi.fanli.util.taobao.TaoBaoUtil; import com.yeshi.fanli.util.taobao.TaoKeApiUtil; @@ -147,7 +149,8 @@ String imei = acceptData.getImei(); result = guessLikeDeviceTB(idfa, imei, page); } else { - result = commonTemplateContentService.getContentList(type, cid, page, Constant.PAGE_SIZE); + // 澶ф窐瀹㈤〉鐮佸彧鑳戒负10,50,100,200 + result = commonTemplateContentService.getContentList(type, cid, page, 10); } JSONObject root = new JSONObject(); @@ -156,19 +159,20 @@ List<SwiperPicture> bannerList = new ArrayList<>(); root.put("bannerList", new Gson().toJson(bannerList)); } - + JSONArray array = new JSONArray(); Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create(); List<TaoBaoGoodsBrief> goodsList = result.getGoodsList(); - BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); - BigDecimal shareRate = hongBaoManageService.getShareRate(); + ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(), + acceptData.getVersion()); for (TaoBaoGoodsBrief taoBaoGoodsBrief : goodsList) { - GoodsDetailVO vo = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate, shareRate); + GoodsDetailVO vo = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, paramsDTO); if (type == CommonContentTypeEnum.mianDan)// 鍏嶅崟鍟嗗搧 { vo.getMoneyInfo().setFanliMoney("楼" + TaoBaoUtil.getAfterUseCouplePrice(taoBaoGoodsBrief)); vo.getMoneyInfo().setShareMoney("楼" + TaoBaoUtil.getAfterUseCouplePrice(taoBaoGoodsBrief)); + vo.getMoneyInfo().setMaxMoney(null); } array.add(gson.toJson(vo)); } @@ -207,12 +211,13 @@ List<JDGoods> goodsList = result.getGoodsList(); if (goodsList != null && goodsList.size() > 0) { - BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); - BigDecimal shareRate = hongBaoManageService.getShareRate(); Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create(); + ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(), + acceptData.getVersion()); + for (JDGoods goods : goodsList) { - array.add(gson.toJson(GoodsDetailVOFactory.convertJDGoods(goods, fanLiRate, shareRate))); + array.add(gson.toJson(GoodsDetailVOFactory.convertJDGoods(goods, paramsDTO))); } } } @@ -237,7 +242,7 @@ // 2銆侀《閮ㄨ疆鎾浘 List<SwiperPicture> bannerList = null; if (Constant.IS_TEST) { - bannerList = swiperPictureService.getByBannerCard("index_top"); + bannerList = swiperPictureService.getByBannerCardAndVersion("index_top",acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion())); } if (bannerList == null) { @@ -256,12 +261,13 @@ List<PDDGoodsDetail> goodsList = result.getGoodsList(); if (goodsList != null && goodsList.size() > 0) { - BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); - BigDecimal shareRate = hongBaoManageService.getShareRate(); Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create(); + ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(), + acceptData.getVersion()); + for (PDDGoodsDetail goods : goodsList) { - array.add(gson.toJson(GoodsDetailVOFactory.convertPDDGoods(goods, fanLiRate, shareRate))); + array.add(gson.toJson(GoodsDetailVOFactory.convertPDDGoods(goods, paramsDTO))); } } } @@ -270,10 +276,10 @@ data.put("count", count); out.print(JsonUtil.loadTrueResult(data)); } - - + /** * 鐚滀綘鍠滄-娣樺疂璁惧鎺ㄨ崘 + * * @param acceptData * @param page * @return @@ -281,7 +287,7 @@ @Cacheable(value = "commonContentCache", key = "#idfa+'-'+#imei+'-'+#page") private CommonContentResult guessLikeDeviceTB(String idfa, String imei, Integer page) { TaoBaoSearchResult searchResult = TaoKeApiUtil.guessDeviceLike(page, Constant.PAGE_SIZE, imei, idfa); - if (searchResult != null && searchResult.getTaoBaoGoodsBriefs() != null + if (searchResult != null && searchResult.getTaoBaoGoodsBriefs() != null && searchResult.getTaoBaoGoodsBriefs().size() > 0) { CommonContentResult result = new CommonContentResult(); result.setCount(searchResult.getPageEntity().getTotalCount()); -- Gitblit v1.8.0