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

import javax.annotation.Resource;

/**
 * OA 出差单的结果的监听器实现类
 *
 * @author 符溶馨
 */
@Component
public class BpmOAProcureResultListener extends BpmProcessInstanceResultEventListener {

    @Resource
    private BpmOAProcureService evectionService;

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

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