admin
2023-07-24 24587fd1b4af52469d1e122d2a495eea79d6865e
fanli/src/main/java/com/yeshi/fanli/job/order/vipshop/UpdateVipShopOrderJob.java
@@ -5,9 +5,11 @@
import javax.annotation.Resource;
import com.yeshi.fanli.dao.mybatis.vipshop.VipShopOrderMapper;
import com.yeshi.fanli.dto.mq.order.body.CommonOrderMQMsg;
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.mq.cmq.order.OrdersCMQManager;
import com.yeshi.fanli.util.vipshop.DingDanXiaApiUtil;
import org.springframework.stereotype.Component;
@@ -58,7 +60,7 @@
                String result = redisManager.getCommonString(key);
                // 判断
//            if (StringUtil.isNullOrEmpty(result)) {
                VipShopOrderCMQManager.getInstance().addVipShopOrder(order.getOrderSn() + "");
                OrdersCMQManager.getInstance().addOrder(new CommonOrderMQMsg(order.getOrderSn() + "", Constant.SOURCE_TYPE_VIP));
                redisManager.cacheCommonString(key, "1", 60 * 60 * 2);// 2小时内不再更新
                LogHelper.test("唯品会订单消息发送成功");
//            }else{
@@ -82,8 +84,19 @@
            updateByOrderTime(endTime - 1000 * 60 * 60 * 1L, endTime);
            updateByUpdateTime(endTime - 1000 * 60 * 60 * 1L, endTime);
        } else if ("1day".equalsIgnoreCase(param)) {// 更新最近1天更新的数据
            updateByOrderTime(endTime - 1000 * 60 * 60 * 24L, endTime);
            updateByUpdateTime(endTime - 1000 * 60 * 60 * 24L, endTime);
            Long startT = endTime - 1000 * 60 * 60 * 24L;
            for(long start= startT;start<startT +1000 * 60 * 60 * 24L;start+=1000 * 60 * 60 ) {
                updateByOrderTime(start, start + 1000 * 60 * 60 );
                updateByUpdateTime(start, start + 1000 * 60 * 60 );
            }
        } else if ("1month".equalsIgnoreCase(param)) {// 更新最近1个月的数据
            for (int i = 0; i < 30; i++) {
                Long startT = endTime - 1000 * 60 * 60 * 24L*(i+1);
               for(long start= startT;start<startT +1000 * 60 * 60 * 24L;start+=1000 * 60 * 60 ) {
                   updateByOrderTime(start, start + 1000 * 60 * 60 );
                   updateByUpdateTime(start, start + 1000 * 60 * 60 );
               }
            }
        }
        /*
         * else if ("3day".equalsIgnoreCase(param)) {// 更新最近3天更新的数据
@@ -127,7 +140,7 @@
    @XxlJob("order-vip-updateByLongTimeNoUpdate")
    public ReturnT<String> updateByLongTimeNoUpdate(String param) throws Exception {
        List<CommonOrder> commonOrders = commonOrderService.listPayStateOrder(Constant.SOURCE_TYPE_VIP, null, new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24L * 10));
        List<CommonOrder> commonOrders = commonOrderService.listPayStateOrder(Constant.SOURCE_TYPE_VIP, new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24L * 60), new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24L * 10), 1, 200);
        if (commonOrders == null || commonOrders.size() == 0) {
            throw new Exception("没有需要更新的订单");
        }