From c338aa60df58bee9f4c25afedf94fe6930a119c1 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 29 七月 2020 19:01:56 +0800 Subject: [PATCH] SpringContext中的循环任务优化,添加业务监控 --- fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandShopCaheServiceImpl.java | 23 ++++++++++++++++------- 1 files changed, 16 insertions(+), 7 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 e4a0d27..a01b3d9 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 @@ -14,7 +14,7 @@ import com.yeshi.fanli.dto.pdd.PDDSearchFilter; import com.yeshi.fanli.entity.brand.BrandInfo; import com.yeshi.fanli.entity.brand.BrandShopCahe; -import com.yeshi.fanli.entity.taobao.TaoBaoShop; +import com.yeshi.common.entity.taobao.TaoBaoShop; import com.yeshi.fanli.service.inter.brand.BrandShopCaheService; import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService; import com.yeshi.fanli.util.StringUtil; @@ -38,14 +38,17 @@ * @return */ @Override - public boolean addBrandShopTB(Long brandId, Long auctionId, Long sellerId) { + public boolean addBrandShopTB(BrandInfo brandInfo, Long auctionId, Long sellerId) { TaoBaoShop taoBaoShop = taoBaoShopService.getTaoBaoShop(auctionId, sellerId); if (taoBaoShop == null) return true; + ShopInfoVO shopInfoVO = ShopInfoVOFactory.convertTaoBaoShop(taoBaoShop); + shopInfoVO.setShopIcon(brandInfo.getIcon()); + BrandShopCahe brandShop = new BrandShopCahe(); - brandShop.setBrandId(brandId); - brandShop.setShop(ShopInfoVOFactory.convertTaoBaoShop(taoBaoShop)); + brandShop.setBrandId(brandInfo.getId()); + brandShop.setShop(shopInfoVO); brandShop.setCreateTime(new Date()); brandShopCaheDao.insert(brandShop); return false; @@ -77,8 +80,12 @@ * @return */ @Override - public void addBrandShopPDD(BrandInfo brandInfo) { - String searchKey = brandInfo.getSearchKey(); + public int addBrandShopPDD(BrandInfo brandInfo) { + String shopKey = brandInfo.getShopKeyPDD(); + if (StringUtil.isNullOrEmpty(shopKey)) + return 0; + + String searchKey = brandInfo.getSearchKeyPDD(); if (StringUtil.isNullOrEmpty(searchKey)) searchKey = brandInfo.getName(); @@ -97,7 +104,7 @@ for (PDDGoodsDetail goods : goodsList) { // 鍖呭惈搴楅摵id 銆佸寘鍚搧鐗屽悕绉� String mallName = goods.getMallName(); - if(addShop && !StringUtil.isNullOrEmpty(mallName) && mallName.contains(brandInfo.getName()) + if(addShop && !StringUtil.isNullOrEmpty(mallName) && mallName.toLowerCase().contains(shopKey.toLowerCase()) && goods.getMallId() != null){ shopInfoVO = new ShopInfoVO(); shopInfoVO.setId(goods.getMallId().toString()); @@ -117,7 +124,9 @@ brandShop.setShop(shopInfoVO); brandShop.setCreateTime(new Date()); brandShopCaheDao.insert(brandShop); + return 1; } + return 0; } -- Gitblit v1.8.0