From 8c04d27e5cebb7e654c208533e9567c4df2c8acc Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期四, 12 十二月 2019 14:21:44 +0800 Subject: [PATCH] 券时间限制 --- fanli/src/main/java/com/yeshi/fanli/job/BrandInfoJob.java | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/job/BrandInfoJob.java b/fanli/src/main/java/com/yeshi/fanli/job/BrandInfoJob.java index 187048e..b563cde 100644 --- a/fanli/src/main/java/com/yeshi/fanli/job/BrandInfoJob.java +++ b/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); + } } } - + } -- Gitblit v1.8.0