package cn.iocoder.yudao.module.pms.listener;

import cn.iocoder.yudao.module.bpm.event.BpmProcessInstanceStatusEvent;
import cn.iocoder.yudao.module.bpm.event.BpmProcessInstanceStatusEventListener;
import cn.iocoder.yudao.module.pms.service.qhse.accident.IotAccidentReportServiceImpl;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class AccidentBpmStatusListener extends BpmProcessInstanceStatusEventListener {
    @Resource
    private IotAccidentReportServiceImpl iotAccidentReportService;
    @Override
    protected String getProcessDefinitionKey() {
        return "qhse-accident";
    }

    @Override
    protected void onEvent(BpmProcessInstanceStatusEvent event) {
        iotAccidentReportService.approvalAccidentFlow(Long.parseLong(event.getBusinessKey()), event.getStatus());
    }
}
