zepengdev
2025-09-30 bfddfbc26cac79e28149cfd7a3d3c63c623a39ef
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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<ProductAuditVerdictHandler> handlers;
 
    public ProductAuditVerdictHandler getHandler(ProductAuditTypeEnum auditType) {
        return handlers.stream()
                .filter(handler -> handler.supports(auditType))
                .findFirst()
                .orElseThrow(() -> new UnsupportedOperationException("未找到商品审核处理类型为 [" + auditType + "] 的处理器"));
    }
}