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

import javax.annotation.Resource;

/**
 * OA 借调单的结果的监听器实现类
 */
@Component
public class BpmOASecondResultListener extends BpmProcessInstanceResultEventListener {

    @Resource
    private BpmOASecondService secondService;

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

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