From a6f34b99ee20e528b766c8ed5a61bd9c5aa0e7ae Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期六, 16 十一月 2019 18:10:33 +0800 Subject: [PATCH] 淘宝相似商品推荐接口优化,根据商品ID搜索商品基本信息优化 --- fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandGoodsCaheServiceImpl.java | 19 ++++++++++++++----- 1 files changed, 14 insertions(+), 5 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandGoodsCaheServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandGoodsCaheServiceImpl.java index 6153184..d6be2b0 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandGoodsCaheServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandGoodsCaheServiceImpl.java @@ -68,6 +68,10 @@ * @return */ private int addBrandGoodsTB(BrandInfo brandInfo) { + String shopKey = brandInfo.getShopKey(); + if (StringUtil.isNullOrEmpty(shopKey)) + shopKey = brandInfo.getName(); + String searchKey = brandInfo.getSearchKey(); if (StringUtil.isNullOrEmpty(searchKey)) searchKey = brandInfo.getName(); @@ -94,8 +98,8 @@ // 娣诲姞搴楅摵 String shopTitle = goods.getShopTitle(); if (addShop && !StringUtil.isNullOrEmpty(shopTitle) && shopTitle.contains("鏃楄埌搴�") - && shopTitle.contains(brandInfo.getName())) { - addShop = brandShopCaheService.addBrandShopTB(brandInfo.getId(), goods.getAuctionId(), + && shopTitle.toLowerCase().contains(shopKey.toLowerCase())) { + addShop = brandShopCaheService.addBrandShopTB(brandInfo, goods.getAuctionId(), goods.getSellerId()); } @@ -129,6 +133,10 @@ * @return */ private int addBrandGoodsJD(BrandInfo brandInfo) { + String shopKey = brandInfo.getShopKey(); + if (StringUtil.isNullOrEmpty(shopKey)) + shopKey = brandInfo.getName(); + String searchKey = brandInfo.getSearchKey(); if (StringUtil.isNullOrEmpty(searchKey)) searchKey = brandInfo.getName(); @@ -140,6 +148,8 @@ // 鍒犻櫎搴楅摵 brandShopCaheService.removeByDateAndType(brandInfo.getId(), 20, date); + + boolean addShop = true; for (int i=0; i < 2;i ++) { if ("1".equals(way)) { @@ -162,7 +172,6 @@ } if (result != null && result.getGoodsList() != null && result.getGoodsList().size() > 0) { - boolean addShop = true; List<JDGoods> goodsList = result.getGoodsList(); for (JDGoods goods : goodsList) { BrandGoodsCahe brandGoods = new BrandGoodsCahe(); @@ -177,9 +186,9 @@ if (addShop && shopInfo != null) { // 鍖呭惈璇ュ搧鐗屽悕绉� String shopName = shopInfo.getShopName(); - if (!StringUtil.isNullOrEmpty(shopName) && shopName.contains(brandInfo.getName())) { - brandShopCaheService.addBrandShopJD(brandInfo, shopInfo); + if (!StringUtil.isNullOrEmpty(shopName) && shopName.toLowerCase().contains(shopKey.toLowerCase())) { addShop = false; + brandShopCaheService.addBrandShopJD(brandInfo, shopInfo); } } -- Gitblit v1.8.0