package com.xhpc.activity.task;


import com.xhpc.activity.mapper.XhpcClearingCheckoutMapper;
import com.xhpc.activity.mapper.XhpcClearingHistoryOrderMapper;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class AsyncService {
    @Resource
    XhpcClearingHistoryOrderMapper historyOrderMapper;

    @Resource
    XhpcClearingCheckoutMapper checkoutMapper;

    /**
     * 审核待清分订单处理
     * @param orderIds
     * @param status
     * @param checkBy
     */
    @Async
    public void updateCheckStatusAsync(String orderIds, Integer status, String checkBy){
        historyOrderMapper.updateStatusBatchByOrderIds(orderIds, status, checkBy);
    }


    @Async
    public void updateCheckoutByOperatorAsync(Long operatorId, Long checkoutId){
        historyOrderMapper.updateCheckoutByOperator(operatorId, checkoutId);
        checkoutMapper.updateStatusByIds(checkoutId.toString(), 1);
    }


    @Async
    public void updateCheckoutByOrderIdsAsync(String orderIds, Long checkoutId){
        historyOrderMapper.updateCheckoutByOrderId(orderIds, checkoutId);
        checkoutMapper.updateStatusByIds(checkoutId.toString(), 1);
    }
}
