From 6d933cb7a7345b8fc9fd51be52b79ec4cd837a13 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期一, 12 八月 2019 12:19:15 +0800 Subject: [PATCH] 增加品牌商品更新任务 --- fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandClassShopGoodsServiceImpl.java | 30 ++++++++++++++++++------------ 1 files changed, 18 insertions(+), 12 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandClassShopGoodsServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandClassShopGoodsServiceImpl.java index 14521f2..d24edd5 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandClassShopGoodsServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandClassShopGoodsServiceImpl.java @@ -8,6 +8,7 @@ import com.yeshi.fanli.entity.brand.BrandClassShop; import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief; +import com.yeshi.fanli.log.LogHelper; import com.yeshi.fanli.service.inter.brand.BrandClassShopGoodsService; import com.yeshi.fanli.service.inter.brand.BrandClassShopService; import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService; @@ -38,19 +39,24 @@ @Override public void startUpdateGoods() { - long count = brandClassShopService.countQuery(null, null, BrandClassShop.STATE_VALID); - int page = (int) (count % 100 == 0 ? count / 100 : count / 100 + 1); + int goodsCount = 0; + try { + long count = brandClassShopService.countQuery(null, null, BrandClassShop.STATE_VALID); + int page = (int) (count % 100 == 0 ? count / 100 : count / 100 + 1); - for (int i = 0; i < page; i++) { - List<BrandClassShop> shopList = brandClassShopService.listQuery(i * 100, 100, null, null, - BrandClassShop.STATE_VALID); - // 姣忎釜鍝佺墝鏈�澶氭洿鏂�100涓晢鍝� - if (shopList != null) - for (BrandClassShop shop : shopList) { - Long sellerId = shop.getShop().getId(); - List<TaoBaoGoodsBrief> goodsList = listBrandShopGoods(sellerId, 1, 100); - taoBaoGoodsUpdateService.addUpdateQueueAsync(goodsList); - } + for (int i = 0; i < page; i++) { + List<BrandClassShop> shopList = brandClassShopService.listQuery(i * 100, 100, null, null, + BrandClassShop.STATE_VALID); + // 姣忎釜鍝佺墝鏈�澶氭洿鏂�100涓晢鍝� + if (shopList != null) + for (BrandClassShop shop : shopList) { + Long sellerId = shop.getShop().getId(); + List<TaoBaoGoodsBrief> goodsList = listBrandShopGoods(sellerId, 1, 100); + taoBaoGoodsUpdateService.addUpdateQueueAsync(goodsList); + } + } + } finally { + LogHelper.test("鍝佺墝鍟嗗搧鏇存柊鏁伴噺:" + goodsCount); } } -- Gitblit v1.8.0