refactor(pricing): 重构适用商品类型处理逻辑

- 移除 ProductTypeListTypeHandler,直接在实体类中处理 JSON转换
- 为 PriceVoucherBatchConfig 添加 ObjectMapper 静态实例和日志记录
- 实现 JSON 字符串与 ProductType 列表之间的转换方法- 更新数据库映射,将 applicableProducts 映射为 JSON 字符串
- 优化 VoucherServiceImpl 中的产品适用性检查逻辑
This commit is contained in:
2025-08-30 15:55:26 +08:00
parent 966568156c
commit 047feec045
3 changed files with 88 additions and 7 deletions

View File

@@ -293,8 +293,7 @@ public class VoucherServiceImpl implements IVoucherService {
return products.stream()
.filter(product -> {
try {
ProductType productType = ProductType.fromCode(product.getProductType());
return applicableProducts.contains(productType);
return applicableProducts.contains(product.getProductType());
} catch (IllegalArgumentException e) {
log.warn("未知的商品类型: {}", product.getProductType());
return false;