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

import javax.annotation.Resource;

/**
 * OA 备用金单的结果的监听器实现类
 *
 * @author 符溶馨
 */
@Component
public class BpmOAImprestResultListener extends BpmProcessInstanceResultEventListener {

    @Resource
    private BpmOAImprestService imprestService;

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

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