| | |
| | | package com.yeshi.fanli.job.order.jd; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.dao.jd.JDOrderBackUpDao; |
| | | import com.yeshi.fanli.dto.jd.JDOrderForBackUpResult; |
| | | import com.yeshi.fanli.dto.mq.order.body.CommonOrderMQMsg; |
| | | import com.yeshi.fanli.entity.jd.JDBackUpOrder; |
| | | import com.yeshi.fanli.entity.order.CommonOrder; |
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService; |
| | | import com.yeshi.fanli.util.Constant; |
| | | import com.yeshi.fanli.util.annotation.JobMonitor; |
| | | import com.yeshi.fanli.util.mq.cmq.order.OrdersCMQManager; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import com.xxl.job.core.biz.model.ReturnT; |
| | |
| | | |
| | | @Resource |
| | | private JDOrderBackUpDao jdOrderBackUpDao; |
| | | |
| | | @Resource |
| | | private CommonOrderService commonOrderService; |
| | | |
| | | |
| | | /** |
| | |
| | | String result = redisManager.getCommonString(key); |
| | | // 判断 |
| | | if (StringUtil.isNullOrEmpty(result)) { |
| | | JDOrderCMQManager.getInstance().addJDOrder(order.getOrderId() + ""); |
| | | OrdersCMQManager.getInstance().addOrder(new CommonOrderMQMsg(order.getOrderId() + "", Constant.SOURCE_TYPE_JD)); |
| | | redisManager.cacheCommonString(key, "1", 60 * 60 * 2);// 2小时内不再更新 |
| | | } |
| | | } catch (JDOrderException e) { |
| | |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | |
| | | //处理很久没处理的数据 |
| | | @JobMonitor(key = "", maxSpaceTime = 60 * 60 * 25) |
| | | @XxlJob("order-jd-process-outdate") |
| | | public ReturnT<String> processoutOfDate(String param) throws Exception { |
| | | //查询 1个月到5个月处于已付款状态的数据 |
| | | long maxTime = System.currentTimeMillis() - 1000 * 60 * 60 * 24L * 30; |
| | | long minTime = maxTime - 1000 * 60 * 60 * 24L * 120; |
| | | List<CommonOrder> orderList = commonOrderService.listBySourceTypeAndStateAndThirdCrateTime(Constant.SOURCE_TYPE_JD, CommonOrder.STATE_FK, minTime, maxTime, 1, 200); |
| | | Set<String> orderIds = new HashSet<>(); |
| | | for (CommonOrder co : orderList) { |
| | | orderIds.add(co.getOrderNo()); |
| | | } |
| | | for (String orderId : orderIds) { |
| | | OrdersCMQManager.getInstance().addOrder(new CommonOrderMQMsg(orderId, Constant.SOURCE_TYPE_JD)); |
| | | } |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | private List<JDBackUpOrder> getBackUpOrders(Date hourDate) { |
| | | List<JDBackUpOrder> jdOrderList = new ArrayList<>(); |
| | | int pageSize = 200; |