云
2026-10-24 a4ed0f250009167453ca637ce042ef8e0b69f613
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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());
        }
    }
}