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

import javax.annotation.Resource;

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

    @Resource
    private BpmOARegularService regularService;

    @Override
    protected String getProcessDefinitionKey() {

        return BpmOARegularServiceImpl.PROCESS_KEY;
    }

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