| | |
| | | package cn.iocoder.yudao.module.erp.service.purchase.listener; |
| | | |
| | | import cn.iocoder.yudao.module.bpm.api.event.BpmProcessInstanceStatusEvent; |
| | | import cn.iocoder.yudao.module.bpm.api.event.BpmProcessInstanceStatusEventListener; |
| | | import cn.iocoder.yudao.module.erp.service.purchase.ErpPurchasePlanService; |
| | | import jakarta.annotation.Resource; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * 采购计划审批状态监听器(Legacy,已停用) |
| | | * 采购计划审批状态监听器 |
| | | * |
| | | * 采购计划审批已改为「审批配置」轻量级状态机,由 |
| | | * {@link ErpPurchasePlanService#submitPurchasePlan(Long)} / {@link ErpPurchasePlanService#auditPurchasePlan(Long, Boolean, String)} |
| | | * 直接驱动状态,不再依赖 BPM。 |
| | | * |
| | | * 保留本类仅作历史参考;不再注册为 Spring Bean,避免旧的 BPM 流程实例触发时 |
| | | * 与新审批路径重复更新/重复生成采购申请。 |
| | | * 监听 BPM 审批结果,回写采购计划状态,使采购计划审批统一在「协同办公 - 我的流程」中流转。 |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class ErpPurchasePlanStatusListener extends cn.iocoder.yudao.module.bpm.api.event.BpmProcessInstanceStatusEventListener { |
| | | public class ErpPurchasePlanStatusListener extends BpmProcessInstanceStatusEventListener { |
| | | |
| | | /** |
| | | * 采购计划审批流程定义 Key |
| | |
| | | log.info("[onEvent] 收到BPM审批事件,planId={}, status={}", planId, event.getStatus()); |
| | | |
| | | try { |
| | | purchasePlanService.updatePurchasePlanAuditStatus(planId, event.getStatus()); |
| | | purchasePlanService.updatePurchasePlanAuditStatus(planId, event.getStatus(), event.getReason()); |
| | | log.info("[onEvent] 采购计划({}) 审批状态更新完成", planId); |
| | | } catch (Exception e) { |
| | | log.error("[onEvent] 更新采购计划审批状态失败,planId={}", planId, e); |