yujian
2019-12-12 8c04d27e5cebb7e654c208533e9567c4df2c8acc
fanli/src/main/java/com/yeshi/fanli/job/BrandInfoJob.java
@@ -5,6 +5,7 @@
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.brand.BrandInfoService;
import com.yeshi.fanli.util.Constant;
@@ -23,7 +24,7 @@
   /**
    * 每两个小时进行更新品牌商品信息
    */
//   @Scheduled(cron = "0 0 1/2 * * ? ")
   @Scheduled(cron = "0 0 1/2 * * ? ")
   public void updateGoods() {
      if (!Constant.IS_TASK)
         return;
@@ -31,10 +32,15 @@
      long count = brandInfoService.countValidByCid(null);
      if (count == 0)
         return;
      for (int page = 1; page < (count / 100) + 1; page++) {
         brandInfoService.addShopAndGoods((page - 1) * 100, 100);
      long totalPage = (count / 100) + 1;
      for (long page = 0; page < totalPage; page++) {
         try {
            brandInfoService.addShopAndGoods(page * 100, 100);
         } catch (Exception e) {
            LogHelper.errorDetailInfo(e);
         }
      }
   }
}