Pu Zhibing
2024-12-25 70ea508da8a26ea4d562000bc00dc6ba5e11cb3f
UserAHTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TaskUtil.java
@@ -1,10 +1,13 @@
package com.stylefeng.guns.modular.system.util;
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService;
import com.stylefeng.guns.modular.system.service.IUserCouponRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
/**
@@ -15,7 +18,30 @@
    @Autowired
    private IUserCouponRecordService userCouponRecordService;
    @Autowired
    private IOrderPrivateCarService orderPrivateCarService;
    @Autowired
    private RedisUtil redisUtil;
    @Scheduled(fixedRate = 1000 * 10)
    public void taskFiveSeconds(){
        try {
            //定时任务推送订单给司机
            String push_order_ids = redisUtil.getListFirstValue("push_order_ids");
            if(ToolUtil.isNotEmpty(push_order_ids)){
                boolean b = orderPrivateCarService.pushOrder1(Integer.valueOf(push_order_ids));
                if(!b){
                    redisUtil.addListLeft("push_order_ids", push_order_ids);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**