package com.oying.modules.pc.product.events.handler; import com.oying.modules.pc.product.domain.enums.ProductAuditTypeEnum; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import java.util.List; @Slf4j @Component @RequiredArgsConstructor public class ProductAuditVerdictAfterHandlerFactory { private final List handlers; public ProductAuditVerdictHandler getHandler(ProductAuditTypeEnum auditType) { return handlers.stream() .filter(handler -> handler.supports(auditType)) .findFirst() .orElseThrow(() -> new UnsupportedOperationException("未找到商品审核处理类型为 [" + auditType + "] 的处理器")); } }