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.BpmOAReimbursementService;
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAReimbursementServiceImpl;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * OA 报销单的结果的监听器实现类
 *

 */
@Component
public class BpmOAReimbursementResultListener extends BpmProcessInstanceResultEventListener {

    @Resource
    private BpmOAReimbursementService reimbursementService;

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

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

}
