package com.jy.business.payment.flow;

import com.jy.business.payment.dao.PaymentRequestsDao;
import jakarta.annotation.Resource;
import org.dromara.warm.flow.core.entity.Instance;
import org.dromara.warm.flow.core.listener.Listener;
import org.dromara.warm.flow.core.listener.ListenerVariable;
import org.springframework.stereotype.Component;

@Component("paymentRequestsFlow")
public class PaymentRequestsFlow implements Listener {

    @Resource
    private PaymentRequestsDao paymentRequestsDao;

    @Override
    public void notify(ListenerVariable listenerVariable) {
        Instance instance = listenerVariable.getInstance();

        String businessId = instance.getBusinessId();
        String flowStatus = instance.getFlowStatus();

        paymentRequestsDao.updateFlowStatus(businessId, flowStatus);
    }

}
