package cn.iocoder.yudao.module.bpm.service.oa.listener;

import cn.iocoder.yudao.module.bpm.framework.bpm.core.event.BpmProcessInstanceResultEvent;
import cn.iocoder.yudao.module.bpm.framework.bpm.core.event.BpmProcessInstanceResultEventListener;
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAInvoiceService;
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAInvoiceServiceImpl;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * OA 奖惩的结果的监听器实现类
 *
 * @author 符溶馨
 */
@Component
public class BpmOAInvoiceResultListener extends BpmProcessInstanceResultEventListener {

    @Resource
    private BpmOAInvoiceService invoiceService;

    @Override
    protected String getProcessDefinitionKey() {
        return BpmOAInvoiceServiceImpl.PROCESS_KEY;
    }

    @Override
    protected void onEvent(BpmProcessInstanceResultEvent event) {
        invoiceService.updateInvoiceResult(Long.parseLong(event.getBusinessKey()), event.getResult());
    }
}
