yujian
2019-05-30 ebce479a2d0634c90e5f80045e204248336b410d
fanli/src/main/java/com/yeshi/fanli/job/UpdateTaoBaoGoodsJob.java
@@ -43,10 +43,9 @@
   @Resource
   private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
   @Resource
   private QualityFlashSaleService qualityFlashSaleService;
   // 动态商品更新 ,1个小时更新
   @Scheduled(cron = "0 0 */1 * * ?")
@@ -84,16 +83,9 @@
      }
      try {
         LogHelper.test("---执行--updateQualityFactoryWeightJob--");
         qualityFactoryService.updateWeight(10, 3);
      } catch (Exception e) {
         try {
            LogHelper.errorDetailInfo(e);
         } catch (Exception e1) {
            e1.printStackTrace();
         }
         LogHelper.errorDetailInfo(e);
      }
   }
@@ -110,56 +102,44 @@
   // 添加精选库中需要更新的淘宝商品ID(2个小时执行一次)
   @Scheduled(cron = "0 0 1/2 * * ? ")
   public void addNeddUpdateTaoBaoGoods() {
      if (!Constant.IS_TASK) {
      if (!Constant.IS_TASK)
         return;
      List<Long> list = qualityFactoryService.queryNeedUpdate(0, 1000, 4);
      if (list == null || list.size() == 0) {
         return;
      }
      
      LogHelper.test("---addNeddUpdateTaoBaoGoods----execute ");
      List<Long> list = qualityFactoryService.queryNeedUpdate(0, 3000, 4);
      if (list != null) {
         for (Long id : list) {
            try {
               CMQManager.getInstance().addNeedUpdateTaoBaoGoodsId(id);
            } catch (Exception e) {
               try {
                  LogHelper.errorDetailInfo(e);
               } catch (Exception e1) {
                  e1.printStackTrace();
               }
            }
      for (Long id : list) {
         try {
            CMQManager.getInstance().addNeedUpdateTaoBaoGoodsId(id);
         } catch (Exception e) {
            LogHelper.errorDetailInfo(e);
         }
      }
   }
   /**
    * 定时清理超过6个小时未更新的限时抢购商品
    */
   @Scheduled(cron = "0 15 0/6 * * ? ")
   public void removeFlashSaleGoods() {
      if (!Constant.IS_TASK) {
         return;
      }
      try {
         while (true) {
            List<Long> list = qualityFlashSaleService.queryNeedRemove(0, 100, 6);
            List<Long> list = qualityFlashSaleService.queryNeedRemove(0, 200, 6);
            if (list == null || list.size() == 0) {
               break;
            }
            }
            qualityFlashSaleService.deleteBatchByPrimaryKey(list);
         }
      } catch (Exception e) {
         try {
            LogHelper.errorDetailInfo(e);
         } catch (Exception e1) {
            e1.printStackTrace();
         }
      }
   }