From 30d8e227e8d823b6c38c3b9c90ac2df03b63befe Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 25 二月 2025 16:41:22 +0800 Subject: [PATCH] 淘宝转链接口更新 --- fanli/src/main/java/com/yeshi/fanli/job/BrandInfoJob.java | 142 +++++++++++++++++++++++----------------------- 1 files changed, 71 insertions(+), 71 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 a9f10d1..bda001d 100644 --- a/fanli/src/main/java/com/yeshi/fanli/job/BrandInfoJob.java +++ b/fanli/src/main/java/com/yeshi/fanli/job/BrandInfoJob.java @@ -1,71 +1,71 @@ -package com.yeshi.fanli.job; - -import java.util.ArrayList; -import java.util.List; - -import javax.annotation.Resource; - -import org.springframework.stereotype.Component; - -import com.xxl.job.core.biz.model.ReturnT; -import com.xxl.job.core.handler.annotation.XxlJob; -import com.yeshi.fanli.entity.brand.BrandInfo; -import com.yeshi.fanli.log.LogHelper; -import com.yeshi.fanli.service.inter.brand.BrandInfoService; -import com.yeshi.fanli.util.Constant; - -/** - * 鍝佺墝淇℃伅鏇存柊 - * - * @author Administrator - * - */ -@Component -public class BrandInfoJob { - - @Resource - private BrandInfoService brandInfoService; - - /** - * 姣忎袱涓皬鏃惰繘琛屾洿鏂板搧鐗屽晢鍝佷俊鎭� - */ - @XxlJob("brandGoodsUpdateHandler") - public ReturnT<String> demoJobHandler(String param) throws Exception { - updateGoods(); - return ReturnT.SUCCESS; - } - - public void updateGoods() { - System.out.println("鍝佺墝鍟嗗搧鏇存柊鎵ц"); - if (!Constant.IS_TASK) - return; - long startTime = java.lang.System.currentTimeMillis(); - LogHelper.test("寮�濮嬫墽琛屽搧鐗屾洿鏂�---updateGoods" + startTime); - long count = brandInfoService.countValidByCid(null); - if (count == 0) - return; - - List<BrandInfo> list = new ArrayList<>(); - - long totalPage = (count / 100) + 1; - for (long page = 0; page < totalPage; page++) { - List<BrandInfo> tempList = brandInfoService.listValidOrderByUpdateTime((int) (page + 1), 100); - if (tempList != null && tempList.size() > 0) { - list.addAll(tempList); - } - } - - for (int page = 0; page < totalPage; page++) { - try { - brandInfoService.addShopAndGoods( - list.subList(page * 100, page * 100 + 100 > count ? (int) count : (page * 100 + 100))); - } catch (Exception e) { - LogHelper.errorDetailInfo(e); - } - } - - long endTime = java.lang.System.currentTimeMillis(); - LogHelper.test("缁撴潫鎵ц鍝佺墝鏇存柊---updateGoods" + endTime + ",鎬昏�楁椂:" + (endTime - startTime) / 1000); - } - -} +package com.yeshi.fanli.job; + +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Component; + +import com.xxl.job.core.biz.model.ReturnT; +import com.xxl.job.core.handler.annotation.XxlJob; +import com.yeshi.fanli.entity.brand.BrandInfo; +import com.yeshi.fanli.log.LogHelper; +import com.yeshi.fanli.service.inter.brand.BrandInfoService; +import com.yeshi.fanli.util.Constant; + +/** + * 鍝佺墝淇℃伅鏇存柊 + * + * @author Administrator + * + */ +@Component +public class BrandInfoJob { + + @Resource + private BrandInfoService brandInfoService; + + /** + * 姣忎袱涓皬鏃惰繘琛屾洿鏂板搧鐗屽晢鍝佷俊鎭� + */ + @XxlJob("brandGoodsUpdateHandler") + public ReturnT<String> demoJobHandler(String param) throws Exception { + updateGoods(); + return ReturnT.SUCCESS; + } + + public void updateGoods() { + System.out.println("鍝佺墝鍟嗗搧鏇存柊鎵ц"); + if (!Constant.IS_TASK) + return; + long startTime = java.lang.System.currentTimeMillis(); + LogHelper.test("寮�濮嬫墽琛屽搧鐗屾洿鏂�---updateGoods" + startTime); + long count = brandInfoService.countValidByCid(null); + if (count == 0) + return; + + List<BrandInfo> list = new ArrayList<>(); + + long totalPage = (count / 100) + 1; + for (long page = 0; page < totalPage; page++) { + List<BrandInfo> tempList = brandInfoService.listValidOrderByUpdateTime((int) (page + 1), 100); + if (tempList != null && tempList.size() > 0) { + list.addAll(tempList); + } + } + + for (int page = 0; page < totalPage; page++) { + try { + brandInfoService.addShopAndGoods( + list.subList(page * 100, page * 100 + 100 > count ? (int) count : (page * 100 + 100))); + } catch (Exception e) { + LogHelper.errorDetailInfo(e); + } + } + + long endTime = java.lang.System.currentTimeMillis(); + LogHelper.test("缁撴潫鎵ц鍝佺墝鏇存柊---updateGoods" + endTime + ",鎬昏�楁椂:" + (endTime - startTime) / 1000); + } + +} -- Gitblit v1.8.0