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 | 141 ++++++++++++++++++++++++++-------------------- 1 files changed, 79 insertions(+), 62 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 f13b5a0..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,26 +1,15 @@ package com.yeshi.fanli.job; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -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.entity.taobao.dataoke.DaTaoKeDetail; 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; -import com.yeshi.fanli.util.taobao.TaoBaoUtil; /** * 鏇存柊澶ф窐瀹㈡暟鎹� @@ -34,59 +23,13 @@ @Resource private DaTaoKeGoodsDetailService daTaoKeGoodsService; - - /** - * 闄愭椂绉掓潃 鏁版嵁鏇存柊 - */ - @Scheduled(cron = "0 0 0/2 * * ?") - public void doUpdateJob() { + @Resource + private DaTaoKeGoodsDetailV2Service daTaoKeGoodsDetailV2Service; - if (!Constant.IS_TASK) - return; - List<DaTaoKeDetail> listTaoKe = DaTaoKeUtil.getDingDongQiang(); - if (listTaoKe == null || listTaoKe.size() == 0) { - return; - } - - List<Long> listDaoKeId = new ArrayList<Long>(); - for (DaTaoKeDetail daTaoKeDetail: listTaoKe) { - listDaoKeId.add(daTaoKeDetail.getId()); - } - - List<DaTaoKeDetail> listDetail = daTaoKeGoodsService.listByIds(listDaoKeId); - if (listDetail == null || listDetail.size() == 0) { - return; - } - - List<TaoBaoGoodsBrief> listgoods = new ArrayList<TaoBaoGoodsBrief>(); - for (DaTaoKeDetail daTaoKeDetail: listDetail) { - listgoods.add( TaoBaoUtil.convert(daTaoKeDetail)); - } - - String formatDate = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(new Date()); - 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(autoRule, listgoods, null); - - // 鍒犻櫎涔嬪墠鐨� - qualityFactoryService.deleteNotUpdateGoods(null, formatDate, autoRule.getGoodsSource()); - } catch (Exception e) { - LogHelper.errorDetailInfo(e); - } - } - - // 20鍒嗛挓鏇存柊涓�娆� - @Scheduled(cron = "0 0/20 * * * ? ") + // 1涓皬鏃舵洿鏂颁竴娆� + @Scheduled(cron = "0 0 0/1 * * ? ") public void doSyncJob() { if (!Constant.IS_TASK) return; @@ -104,4 +47,78 @@ } } + // 姣忓ぉ鏃╀笂鍚屾涓�娆� + @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