fanli/src/main/java/com/yeshi/fanli/job/UpdateTaoBaoGoodsJob.java
@@ -12,6 +12,7 @@ import com.yeshi.fanli.exception.ActivityException; import com.yeshi.fanli.log.LogHelper; import com.yeshi.fanli.service.inter.activity.ActivityService; 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.lable.LabelService; @@ -63,6 +64,9 @@ @Resource private TLJBuyGoodsService tljBuyGoodsService; @Resource private BrandClassShopGoodsService brandClassShopGoodsService; // 动态商品更新 ,1个小时更新 @Scheduled(cron = "0 0 */1 * * ?") @@ -162,11 +166,19 @@ } } // 更新品牌商品,每天早上6点执行一次 // 更新增加品牌商品,每天早上6点执行一次 @Scheduled(cron = "0 0 6 * * ? ") public void updateBrandGoods() { public void updateAddBrandGoods() { if (!Constant.IS_TASK) return; brandClassShopService.updateShopGoods(); } // 更新原有精品库的品牌商品,每天凌晨3点执行一次 @Scheduled(cron = "0 0 3 * * ? ") public void updateBrandGoods() { if (!Constant.IS_TASK) return; brandClassShopGoodsService.startUpdateGoods(); } } 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,6 +39,8 @@ @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); @@ -52,6 +55,9 @@ taoBaoGoodsUpdateService.addUpdateQueueAsync(goodsList); } } } finally { LogHelper.test("品牌商品更新数量:" + goodsCount); } } }