yujian
2020-05-23 28cf328a098334b51a3e9d2d56f983fb8c862211
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();