liu
2026-10-23 5421b8af862890dcf187c2ad5ece55423959ba85
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/service/finance/listener/ErpFinancePaymentStatusListener.java
@@ -10,25 +10,23 @@
/**
 * 付款单审批状态监听器
 *
 * 监听 BPM 流程实例状态变更事件,更新付款单的审批状态
 *
 * @author 超级管理员
 * 监听 BPM 审批结果,回写付款单状态,使付款单审批统一在「协同办公 - 我的流程」中流转。
 */
@Component
@Slf4j
public class ErpFinancePaymentStatusListener extends BpmProcessInstanceStatusEventListener {
    /**
     * BPM 付款单审批流程定义 key
     * 付款单审批流程定义 Key
     */
    private static final String BPM_PROCESS_DEFINITION_KEY = "erp-finance-payment-audit";
    private static final String PROCESS_DEFINITION_KEY = "erp-finance-payment-audit";
    @Resource
    private ErpFinancePaymentService financePaymentService;
    @Override
    protected String getProcessDefinitionKey() {
        return BPM_PROCESS_DEFINITION_KEY;
        return PROCESS_DEFINITION_KEY;
    }
    @Override
@@ -40,8 +38,15 @@
            log.warn("[onEvent] businessKey({}) 不是有效的付款单编号", event.getBusinessKey());
            return;
        }
        log.info("[onEvent] 收到BPM审批事件,paymentId={}, status={}", paymentId, event.getStatus());
        financePaymentService.updateFinancePaymentAuditStatus(paymentId, event.getStatus());
        try {
            financePaymentService.updateFinancePaymentAuditStatus(paymentId, event.getStatus(), event.getReason());
            log.info("[onEvent] 付款单({}) 审批状态更新完成", paymentId);
        } catch (Exception e) {
            log.error("[onEvent] 更新付款单审批状态失败,paymentId={}", paymentId, e);
        }
    }
}