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 |   26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 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 fbe4bb0..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,15 @@
 
 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;
 import com.yeshi.fanli.util.TimeUtil;
@@ -106,8 +107,8 @@
 				while (its.hasNext()) {
 					String key = its.next();
 					List<TaoBaoOrder> orders = map.get(key);
-					String redisKey = "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