yujian
2020-01-18 f4a0f2acc63d7785eab108419a4e16f5f688cb95
fanli/src/main/java/com/yeshi/fanli/job/UpdateTaoBaoGoodsJob.java
@@ -1,5 +1,6 @@
package com.yeshi.fanli.job;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
@@ -11,13 +12,19 @@
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;
import com.yeshi.fanli.service.inter.lable.QualityFactoryService;
import com.yeshi.fanli.service.inter.lable.QualityFlashSaleService;
import com.yeshi.fanli.service.inter.taobao.ShareHotGoodsService;
import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsActivityService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
import com.yeshi.fanli.util.CMQManager;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.cache.HttpGoodsCacheManager;
/**
 * 淘宝商品更细
@@ -46,6 +53,24 @@
   @Resource
   private QualityFlashSaleService qualityFlashSaleService;
   @Resource
   private BrandClassShopService brandClassShopService;
   @Resource
   private TaoBaoGoodsActivityService taoBaoGoodsActivityService;
   @Resource
   private ShareHotGoodsService shareHotGoodsService;
   @Resource
   private TLJBuyGoodsService tljBuyGoodsService;
   @Resource
   private BrandClassShopGoodsService brandClassShopGoodsService;
   @Resource
   private HttpGoodsCacheManager httpGoodsCacheManager;
   // 动态商品更新 ,1个小时更新
   @Scheduled(cron = "0 0 */1 * * ?")
@@ -99,20 +124,20 @@
      taoBaoGoodsUpdateService.deleteOutOfDate();
   }
   /**
    * 更新超过4个小时未更新的商品
    */
   @Scheduled(cron = "0 0 1/2 * * ? ")
   public void addNeddUpdateTaoBaoGoods() {
      if (!Constant.IS_TASK)
   // 1个小时更新
   @Scheduled(cron = "0 0 1/1 * * ? ")
   public void addNeedUpdateTaoBaoGoods() {
      if (!Constant.IS_TASK)
         return;
      List<Long> list = taoBaoGoodsUpdateService.listNeedUpdateGoodsId(0, 4000, 4);
      List<Long> list = taoBaoGoodsUpdateService.listNeedUpdateGoodsId(0, 2000, 4);
      if (list == null || list.size() == 0) {
         return;
      }
      for (Long id : list) {
         try {
            CMQManager.getInstance().addNeedUpdateTaoBaoGoodsId(id);
@@ -127,7 +152,6 @@
    */
   @Scheduled(cron = "0 15 0/6 * * ? ")
   public void removeFlashSaleGoods() {
      if (!Constant.IS_TASK) {
         return;
      }
@@ -142,8 +166,33 @@
         }
      } catch (Exception e) {
            LogHelper.errorDetailInfo(e);
         LogHelper.errorDetailInfo(e);
      }
   }
   // 更新增加品牌商品,每天早上6点执行一次
   @Scheduled(cron = "0 0 6 * * ? ")
   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();
   }
   // 每天凌晨4点模拟请求
   @Scheduled(cron = "0 0 4 * * ? ")
   public void simulateRequest() {
      httpGoodsCacheManager.requestHomeRecommend();
      httpGoodsCacheManager.requestClassGoods();
      httpGoodsCacheManager.requestBrandGoods();
      httpGoodsCacheManager.requestDynamic();
      httpGoodsCacheManager.requestCommonTemplate();
   }
}