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

import javax.annotation.Resource;

/**
 * OA 名片定制的结果的监听器实现类
 *
 * @author 符溶馨
 */
@Component
public class BpmOABusinessCardResultListener extends BpmProcessInstanceResultEventListener {
    @Resource
    private BpmOABusinessCardService businessCardService;

    @Override
    protected String getProcessDefinitionKey() {

        return BpmOABusinessCardServiceImpl.PROCESS_KEY;
    }

    @Override
    protected void onEvent(BpmProcessInstanceResultEvent event) {

        businessCardService.updateBusinessCardResult(Long.parseLong(event.getBusinessKey()), event.getResult());
    }
}
