package com.ghy.quartz.task;

import com.ghy.common.utils.ExceptionUtil;
import com.ghy.quartz.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Slf4j
@Component("orderTask")
public class OrderTask {

    @Autowired
    private OrderService orderService;

    /**
     * 超时状态刷新
     */
    public void overTimeOrder(String orderStatus) {
        try {
            orderService.overTimeOrder(orderStatus);
        } catch (Exception e) {
            log.error("over time order task error is {}", ExceptionUtil.getExceptionMessage(e));
        }
    }

    /**
     * 自动确认完成订单
     */
    public void finishOrder() {
        try {
            orderService.autoFinishOrder();
        } catch (Exception e) {
            log.error("auto finish order task error is {}", ExceptionUtil.getExceptionMessage(e));
        }
    }

    /**
     * 自动修改提现状态
     */
    public void autoChangeDrawCashStatus() {
        try {
            orderService.autoChangeDrawCashStatus();
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }
    }

    /**
     * 超时巡查
     */
    public void tineOutOrder() {
        try {
            orderService.timeOutOrder();
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }
    }

    /**
     * 定点巡查
     */
    public void AfterSalesAndShelveOrder() {
        try {
            orderService.AfterSalesAndShelveOrder();
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }
    }

    /**
     *  配件订单服务中转确认中
     */
    public void orderServerToFinishCheck() {
        try {
            orderService.orderServerToFinishCheck();
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }
    }
}
