From 573c491b4a1ba60e12a5678a01c1546c0077c1ee Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 30 七月 2019 09:07:42 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- fanli/src/main/java/com/yeshi/fanli/job/UpdateDaTaoKeJob.java | 130 +++++++++++++++++++++++++++++++----------- 1 files changed, 95 insertions(+), 35 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/job/UpdateDaTaoKeJob.java b/fanli/src/main/java/com/yeshi/fanli/job/UpdateDaTaoKeJob.java index b69a1d4..b20598f 100644 --- a/fanli/src/main/java/com/yeshi/fanli/job/UpdateDaTaoKeJob.java +++ b/fanli/src/main/java/com/yeshi/fanli/job/UpdateDaTaoKeJob.java @@ -1,20 +1,15 @@ package com.yeshi.fanli.job; -import java.util.List; - import javax.annotation.Resource; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; -import com.yeshi.fanli.entity.bus.lable.BoutiqueAutoRule; -import com.yeshi.fanli.entity.bus.lable.QualityFactory; -import com.yeshi.fanli.entity.common.AdminUser; -import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief; import com.yeshi.fanli.log.LogHelper; import com.yeshi.fanli.service.inter.lable.QualityFactoryService; +import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailService; +import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailV2Service; import com.yeshi.fanli.util.Constant; -import com.yeshi.fanli.util.taobao.DaTaoKeUtil; /** * 鏇存柊澶ф窐瀹㈡暟鎹� @@ -23,42 +18,107 @@ @Component public class UpdateDaTaoKeJob { - @Resource private QualityFactoryService qualityFactoryService; - // 涓ゅ皬鏃舵墽琛屼竴娆� 瀵瑰晢鍝佷俊鎭繘琛屾洿鏂� - @Scheduled(cron = "0 0 0/2 * * ?") - public void doUpdateJob() { - + @Resource + private DaTaoKeGoodsDetailService daTaoKeGoodsService; + + @Resource + private DaTaoKeGoodsDetailV2Service daTaoKeGoodsDetailV2Service; + + + // 1涓皬鏃舵洿鏂颁竴娆� + @Scheduled(cron = "0 0 0/1 * * ? ") + public void doSyncJob() { if (!Constant.IS_TASK) return; - - List<TaoBaoGoodsBrief> listgoods = DaTaoKeUtil.getDingDongQiang(); - if (listgoods == null || listgoods.size() == 0) { - return; - } - try { - /* 鎿嶄綔浜猴細 寮�鍙戣处鍙� */ - AdminUser admin = new AdminUser(2L); - BoutiqueAutoRule autoRule = new BoutiqueAutoRule(); - autoRule.setAdminUser(admin); - autoRule.setCalss9k9(false); - autoRule.setFlashSale(true); - autoRule.setStartWeight(1); - autoRule.setEndWeight(3000); - autoRule.setGoodsSource(QualityFactory.SOURCE_TAOBAO_DATAOKE); - qualityFactoryService.autoInsertOrUpadateStorage(listgoods, null, autoRule); - + new Thread(new Runnable() { + + @Override + public void run() { + daTaoKeGoodsService.startSyncGoods(); + } + }).start(); + } catch (Exception e) { - try { - LogHelper.errorDetailInfo(e); - } catch (Exception e1) { - e1.printStackTrace(); - } + LogHelper.errorDetailInfo(e); } - + } + + // 姣忓ぉ鏃╀笂鍚屾涓�娆� + @Scheduled(cron = "0 0 6 * * ? ") + public void doSyncJobNew() { + if (!Constant.IS_TASK) + return; + try { + new Thread(new Runnable() { + + @Override + public void run() { + daTaoKeGoodsDetailV2Service.startSyncGoods(); + } + }).start(); + + } catch (Exception e) { + LogHelper.errorDetailInfo(e); + } + } + + @Scheduled(cron = "0 0/10 * * * ? ") + public void doUpdateJobNew() { + if (!Constant.IS_TASK) + return; + try { + new Thread(new Runnable() { + + @Override + public void run() { + daTaoKeGoodsDetailV2Service.updateNewGoods(); + } + }).start(); + + } catch (Exception e) { + LogHelper.errorDetailInfo(e); + } + } + + @Scheduled(cron = "0 0/10 * * * ? ") + public void doDeleteJobNew() { + if (!Constant.IS_TASK) + return; + try { + new Thread(new Runnable() { + + @Override + public void run() { + daTaoKeGoodsDetailV2Service.deleteInvalid(); + } + }).start(); + + } catch (Exception e) { + LogHelper.errorDetailInfo(e); + } + } + + // 姣忓ぉ鐨�8鐐癸紝11鐐癸紝19鐐癸紝23鐐规墽琛屼竴娆� + @Scheduled(cron = "0 0 8,11,19,23 * * ? ") + public void doUpdateInfoJobNew() { + if (!Constant.IS_TASK) + return; + try { + new Thread(new Runnable() { + + @Override + public void run() { + daTaoKeGoodsDetailV2Service.updateData(); + } + }).start(); + + } catch (Exception e) { + LogHelper.errorDetailInfo(e); + } } } -- Gitblit v1.8.0