package cn.iocoder.yudao.module.supplier.service.listener;

import cn.iocoder.yudao.module.bpm.event.BpmProcessInstanceStatusEvent;
import cn.iocoder.yudao.module.bpm.event.BpmProcessInstanceStatusEventListener;
import cn.iocoder.yudao.module.supplier.service.product.SupplierService;
import cn.iocoder.yudao.module.supplier.service.product.SupplierServiceImpl;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 回款审批的结果的监听器实现类
 *
 * @author HUIHUI
 */
@Component
public class SupplierStatusListener extends BpmProcessInstanceStatusEventListener {

    @Resource
    private SupplierService supplierService;

    @Override
    public String getProcessDefinitionKey() {
        return SupplierServiceImpl.PROCESS_KEY;
    }

    @Override
    public void onEvent(BpmProcessInstanceStatusEvent event) {
        supplierService.updateSupplierAuditStatus(Long.parseLong(event.getBusinessKey()), event.getStatus());
    }

}
