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.BpmOASupplierProcurementPlanService;
import cn.iocoder.yudao.module.bpm.service.oa.BpmOASupplierProcurementPlanServiceImpl;
import cn.iocoder.yudao.module.bpm.service.oa.BpmOASupplierService;
import cn.iocoder.yudao.module.bpm.service.oa.BpmOaSupplierServiceImpl;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * OA 合同审批单的结果的监听器实现类
 *
 * @author 符溶馨
 */
@Component
public class BpmOASupplierProcurementPlanResultListener extends BpmProcessInstanceResultEventListener {

    @Resource
    private BpmOASupplierProcurementPlanService supplierProcurementPlanService;

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

    @Override
    protected void onEvent(BpmProcessInstanceResultEvent event) {
        supplierProcurementPlanService.updateSupplierProcurementPlanResult(event.getId(), Long.parseLong(event.getBusinessKey()), event.getResult());
    }
}
