yanderong
2026-06-05 be49561932d273c1bb3540cb9ed862eefaafd77e
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TaskUtil.java
@@ -3,14 +3,16 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.stylefeng.guns.modular.system.model.TDriver;
import com.stylefeng.guns.modular.system.service.IPushEvaluationService;
import com.stylefeng.guns.modular.system.service.ITDriverService;
import com.stylefeng.guns.modular.system.service.ITLocationService;
import com.stylefeng.guns.modular.system.service.IUserCouponRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
@@ -31,6 +33,9 @@
    @Autowired
    private ITDriverService driverService;
    @Autowired
    private IPushEvaluationService pushEvaluationService;
@@ -76,4 +81,23 @@
            e.printStackTrace();
        }
    }
    /**
     * 每周一零晨3点执行任务
     * 推送上周订单评价数据
     */
    @Scheduled(cron = "0 0 3 ? * MON")
    public void taskPushEvaluation() {
        try {
            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
            LocalDateTime endTimeObj = LocalDateTime.now();
            String startTime = endTimeObj.minusWeeks(1).format(formatter);
            String endTime = endTimeObj.format(formatter);
            pushEvaluationService.pushEvaluation(startTime, endTime);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}