package cn.iocoder.yudao.module.crm.service.receivable.listener; import cn.iocoder.yudao.module.bpm.api.event.BpmProcessInstanceStatusEvent; import cn.iocoder.yudao.module.bpm.api.event.BpmProcessInstanceStatusEventListener; import cn.iocoder.yudao.module.crm.service.receivable.CrmReceivableService; import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; /** 回款审批结果回写。 */ @Component @Slf4j public class CrmReceivableStatusListener extends BpmProcessInstanceStatusEventListener { @Resource private CrmReceivableService receivableService; @Override protected String getProcessDefinitionKey() { return "crm-receivable-audit"; } @Override protected void onEvent(BpmProcessInstanceStatusEvent event) { try { receivableService.updateReceivableAuditStatus(Long.parseLong(event.getBusinessKey()), event.getStatus()); } catch (NumberFormatException e) { log.warn("[onEvent] 无效的回款业务编号: {}", event.getBusinessKey()); } } }