From 01e773cf27e572b8fb83538d85f31130930d93d1 Mon Sep 17 00:00:00 2001 From: yujian <yujian@123.com> Date: 星期四, 15 八月 2019 15:57:23 +0800 Subject: [PATCH] 券赠送 --- fanli/src/main/java/com/yeshi/fanli/job/UpdateDaTaoKeJob.java | 139 +++++++++++++++++++++++++++++++++++----------- 1 files changed, 105 insertions(+), 34 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..16c8f65 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,17 @@ package com.yeshi.fanli.job; -import java.util.List; +import java.util.Date; 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 +20,116 @@ @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,18 * * ? ") + 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); + } + } + + /** + * 鍒犻櫎杩囨湡鏁版嵁锛堟瘡10鍒嗛挓鍒犻櫎涓�娆★級 + */ + @Scheduled(cron = "0 0/10 * * * ? ") + public void doDeleteOutOfDate() { + if (!Constant.IS_TASK) + return; + daTaoKeGoodsDetailV2Service.deleteOutOfDate(new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24L)); } } -- Gitblit v1.8.0