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

import javax.annotation.Resource;

/**
 * OA 工单的结果的监听器实现类
 *
 * @author 系统
 */
@Component
public class BpmOAWorkOrderResultListener extends BpmProcessInstanceResultEventListener {

    @Resource
    private BpmOAWorkOrderService workOrderService;

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

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