From 28cf328a098334b51a3e9d2d56f983fb8c862211 Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期六, 23 五月 2020 09:54:38 +0800 Subject: [PATCH] 足迹、收藏订单兼容新需求 --- fanli/src/main/java/com/yeshi/fanli/job/order/taobao/UpdateTBRelationAndSpecialOrderJob.java | 24 ++++++++++++++---------- 1 files changed, 14 insertions(+), 10 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/job/order/taobao/UpdateTBRelationAndSpecialOrderJob.java b/fanli/src/main/java/com/yeshi/fanli/job/order/taobao/UpdateTBRelationAndSpecialOrderJob.java index e8e65d8..d698ad6 100644 --- a/fanli/src/main/java/com/yeshi/fanli/job/order/taobao/UpdateTBRelationAndSpecialOrderJob.java +++ b/fanli/src/main/java/com/yeshi/fanli/job/order/taobao/UpdateTBRelationAndSpecialOrderJob.java @@ -7,14 +7,14 @@ import javax.annotation.Resource; -import org.springframework.scheduling.annotation.Scheduled; 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.taobao.TaoBaoOrder; import com.yeshi.fanli.log.LogHelper; import com.yeshi.fanli.service.inter.order.tb.TaoBaoOrderService; import com.yeshi.fanli.util.CMQManager; -import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.RedisKeyEnum; import com.yeshi.fanli.util.RedisManager; import com.yeshi.fanli.util.StringUtil; @@ -107,7 +107,8 @@ while (its.hasNext()) { String key = its.next(); List<TaoBaoOrder> orders = map.get(key); - String redisKey = RedisKeyEnum.getRedisKey(RedisKeyEnum.addOrderQueue, TaoBaoOrderUtil.getOrderDataHashCode(orders)); + String redisKey = RedisKeyEnum.getRedisKey(RedisKeyEnum.addOrderQueue, + TaoBaoOrderUtil.getOrderDataHashCode(orders)); // redis鍋氶鐜囬檺鍒� try { if (!StringUtil.isNullOrEmpty(redisManager.getCommonString(redisKey))) { @@ -139,12 +140,18 @@ } } + @XxlJob("updateTBRelationAndSpecialOrderHandler") + public ReturnT<String> updateTBRelationAndSpecialOrder(String param) throws Exception { + if ("1".equalsIgnoreCase(param)) {// 鐖彇杩�20鍒嗛挓鐨勬暟鎹� + doJob1(); + } else if ("1day".equalsIgnoreCase(param)) {// 姣�5鍒嗛挓鏇存柊锛堣繎1澶╂暟鎹級 + doJob2(); + } + return ReturnT.SUCCESS; + } + // 姣�30s鐖彇涓�娆� - @Scheduled(cron = "0/30 * * * * ? ") public void doJob1() { - if (!Constant.IS_TASK) - return; - // 鐖彇杩�20鍒嗛挓鐨勬暟鎹� LogHelper.job("鐖崟:30s鐖彇涓�娆″崟"); Date systemDate = TaoKeApiUtil.getTaoBaoSystemTime(); long endTime = systemDate != null ? systemDate.getTime() : System.currentTimeMillis(); @@ -154,10 +161,7 @@ } // 姣�5鍒嗛挓鏇存柊锛堣繎1澶╂暟鎹級 - @Scheduled(cron = "0 0/5 * * * ? ") public void doJob2() { - if (!Constant.IS_TASK) - return; LogHelper.job("鐖崟:5min鐖彇涓�娆″崟"); Date systemDate = TaoKeApiUtil.getTaoBaoSystemTime(); long endTime = systemDate != null ? systemDate.getTime() : System.currentTimeMillis(); -- Gitblit v1.8.0