package com.hotwj.platform.pay.task;

import com.baomidou.lock.annotation.Lock4j;
import com.hotwj.platform.pay.service.PayRechargeOpenService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@RequiredArgsConstructor
public class PayOrderCompensateTask {

    private final PayRechargeOpenService payRechargeOpenService;

    @Lock4j(name = "pay:compensate:scan", expire = 55000, acquireTimeout = 3000)
    @Scheduled(cron = "0 * * * * ?")
    public void compensateOrders() {
        log.debug("开始执行支付补偿任务");
        payRechargeOpenService.compensatePayOrders();
    }
}
