From 43ae450db3ce85b425169e4fcef6ac7c25407f52 Mon Sep 17 00:00:00 2001 From: yujian <yujian@123.com> Date: 星期一, 28 十月 2019 09:47:37 +0800 Subject: [PATCH] 2.0.2 --- fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandShopCaheServiceImpl.java | 60 ++++++++++++++++++++++++++++++++++-------------------------- 1 files changed, 34 insertions(+), 26 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandShopCaheServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandShopCaheServiceImpl.java index 4351f19..f8c3247 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandShopCaheServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandShopCaheServiceImpl.java @@ -43,16 +43,11 @@ if (taoBaoShop == null) return true; - Date date = new Date(); BrandShopCahe brandShop = new BrandShopCahe(); brandShop.setBrandId(brandId); brandShop.setShop(ShopInfoVOFactory.convertTaoBaoShop(taoBaoShop)); - brandShop.setCreateTime(date); + brandShop.setCreateTime(new Date()); brandShopCaheDao.insert(brandShop); - - // 鍒犻櫎搴楅摵 - brandShopCaheDao.removeByDate(brandId, 11, date); - return false; } @@ -65,16 +60,13 @@ */ @Override public void addBrandShopJD(BrandInfo brandInfo, JDShopInfo shopInfo) { - Date date = new Date(); ShopInfoVO shopInfoVO = ShopInfoVOFactory.convertJDShop(shopInfo); shopInfoVO.setShopIcon(brandInfo.getIcon()); BrandShopCahe brandShop = new BrandShopCahe(); brandShop.setBrandId(brandInfo.getId()); brandShop.setShop(shopInfoVO); - brandShop.setCreateTime(date); + brandShop.setCreateTime(new Date()); brandShopCaheDao.save(brandShop); - - brandShopCaheDao.removeByDate(brandInfo.getId(), 20, date); } @@ -96,36 +88,34 @@ pddfilter.setPageSize(100); pddfilter.setSortType(6); pddfilter.setMerchantType(3); + PDDGoodsResult result = PinDuoDuoApiUtil.searchGoods(pddfilter); - if (result != null) { + if (result != null && result.getGoodsList() != null && result.getGoodsList().size() > 0) { + boolean addShop = true; List<PDDGoodsDetail> goodsList = result.getGoodsList(); - if (goodsList != null && goodsList.size() > 0) { - for (PDDGoodsDetail goods : goodsList) { - String mallName = goods.getMallName(); - if(goods.getMallId() != null && !StringUtil.isNullOrEmpty(mallName) && mallName.contains(brandInfo.getName())){ - shopInfoVO = new ShopInfoVO(); - shopInfoVO.setId(goods.getMallId().toString()); - shopInfoVO.setShopName(mallName); - break; - } + for (PDDGoodsDetail goods : goodsList) { + // 鍖呭惈搴楅摵id 銆佸寘鍚搧鐗屽悕绉� + String mallName = goods.getMallName(); + if(addShop && !StringUtil.isNullOrEmpty(mallName) && mallName.contains(brandInfo.getName()) + && goods.getMallId() != null){ + shopInfoVO = new ShopInfoVO(); + shopInfoVO.setId(goods.getMallId().toString()); + shopInfoVO.setShopName(mallName); + addShop = false; + break; } } } - if (shopInfoVO != null) { shopInfoVO.setShopIcon(brandInfo.getIcon()); shopInfoVO.setUserType(30); shopInfoVO.setShopLink("https://mobile.yangkeduo.com/mall_page.html?mall_id=" + shopInfoVO.getId()); - - Date date = new Date(); BrandShopCahe brandShop = new BrandShopCahe(); brandShop.setBrandId(brandInfo.getId()); brandShop.setShop(shopInfoVO); - brandShop.setCreateTime(date); + brandShop.setCreateTime(new Date()); brandShopCaheDao.insert(brandShop); - - brandShopCaheDao.removeByDate(brandInfo.getId(), 30, date); } } @@ -135,4 +125,22 @@ public List<BrandShopCahe> getByBrandId(Long brandId){ return brandShopCaheDao.getByBrandId(brandId); } + + + @Override + public void removeAgoByDate(Date createTime) { + brandShopCaheDao.removeAgoByDate(createTime); + } + + @Override + public void removeByBrandId(Long brandId) { + brandShopCaheDao.removeByBrandId(brandId); + } + + @Override + public void removeByDateAndType(Long brandId, int type, Date date) { + brandShopCaheDao.removeByDate(brandId, type, date); + } + + } -- Gitblit v1.8.0