From 62a447d89331aee1feae7724c7616aa1bb2cfe79 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 16 十月 2024 14:28:37 +0800 Subject: [PATCH] 将CMQ替换为rabbitmq --- fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandClassShopGoodsServiceImpl.java | 126 +++++++++++++++++++++--------------------- 1 files changed, 63 insertions(+), 63 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 d24edd5..23e0b3b 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 @@ -1,63 +1,63 @@ -package com.yeshi.fanli.service.impl.brand; - -import java.util.List; - -import javax.annotation.Resource; - -import org.springframework.stereotype.Service; - -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; -import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService; - -@Service -public class BrandClassShopGoodsServiceImpl implements BrandClassShopGoodsService { - - @Resource - private TaoBaoGoodsBriefService taoBaoGoodsBriefService; - - @Resource - private BrandClassShopService brandClassShopService; - - @Resource - private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService; - - @Override - public List<TaoBaoGoodsBrief> listBrandShopGoods(Long sellerId, int page, int count) { - - return taoBaoGoodsBriefService.listByShopId((page - 1) * count, count, sellerId); - } - - @Override - public long countBrandShopGoods(Long sellerId) { - return taoBaoGoodsBriefService.countByShopId(sellerId); - } - - @Override - public void startUpdateGoods() { - 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); - } - } - } finally { - LogHelper.test("鍝佺墝鍟嗗搧鏇存柊鏁伴噺:" + goodsCount); - } - } - -} +package com.yeshi.fanli.service.impl.brand; + +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import com.yeshi.fanli.entity.brand.BrandClassShop; +import com.yeshi.goods.facade.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; +import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService; + +@Service +public class BrandClassShopGoodsServiceImpl implements BrandClassShopGoodsService { + + @Resource + private TaoBaoGoodsBriefService taoBaoGoodsBriefService; + + @Resource + private BrandClassShopService brandClassShopService; + + @Resource + private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService; + + @Override + public List<TaoBaoGoodsBrief> listBrandShopGoods(Long sellerId, int page, int count) { + + return taoBaoGoodsBriefService.listByShopId((page - 1) * count, count, sellerId); + } + + @Override + public long countBrandShopGoods(Long sellerId) { + return taoBaoGoodsBriefService.countByShopId(sellerId); + } + + @Override + public void startUpdateGoods() { + 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); + } + } + } finally { + LogHelper.test("鍝佺墝鍟嗗搧鏇存柊鏁伴噺:" + goodsCount); + } + } + +} -- Gitblit v1.8.0