feat(pricing): 新增优惠券属性门槛校验功能

- 在PriceCouponConfig实体中新增requiredAttributeKeys字段,用于配置优惠券使用门槛
- 修改MyBatis Mapper SQL语句,支持新字段的插入和更新操作
- 在CouponManagementServiceImpl中增加对requiredAttributeKeys的格式校验逻辑
- 更新CouponServiceImpl的优惠券适用性检查逻辑,增加属性门槛判断
- 在PriceCalculationServiceImpl中实现商品属性Key的自动计算与填充
- 优化价格计算服务中的能力缓存与属性Key构建逻辑
- 更新CLAUDE.md文档,补充属性门槛特性的说明
This commit is contained in:
2025-12-17 23:49:20 +08:00
parent 00dd6a16a3
commit 7e157eaba9
7 changed files with 183 additions and 22 deletions

View File

@@ -52,9 +52,9 @@ public interface PriceCouponConfigMapper extends BaseMapper<PriceCouponConfig> {
*/
@Insert("INSERT INTO price_coupon_config (coupon_name, coupon_type, discount_value, min_amount, " +
"max_discount, applicable_products, total_quantity, used_quantity, valid_from, valid_until, " +
"is_active, scenic_id, create_time, update_time) VALUES " +
"required_attribute_keys, is_active, scenic_id, create_time, update_time) VALUES " +
"(#{couponName}, #{couponType}, #{discountValue}, #{minAmount}, #{maxDiscount}, " +
"#{applicableProducts}, #{totalQuantity}, #{usedQuantity}, #{validFrom}, #{validUntil}, " +
"#{applicableProducts}, #{requiredAttributeKeys}, #{totalQuantity}, #{usedQuantity}, #{validFrom}, #{validUntil}, " +
"#{isActive}, #{scenicId}, NOW(), NOW())")
int insertCoupon(PriceCouponConfig coupon);
@@ -63,7 +63,7 @@ public interface PriceCouponConfigMapper extends BaseMapper<PriceCouponConfig> {
*/
@Update("UPDATE price_coupon_config SET coupon_name = #{couponName}, coupon_type = #{couponType}, " +
"discount_value = #{discountValue}, min_amount = #{minAmount}, max_discount = #{maxDiscount}, " +
"applicable_products = #{applicableProducts}, total_quantity = #{totalQuantity}, " +
"applicable_products = #{applicableProducts}, required_attribute_keys = #{requiredAttributeKeys}, total_quantity = #{totalQuantity}, " +
"valid_from = #{validFrom}, valid_until = #{validUntil}, is_active = #{isActive}, " +
"scenic_id = #{scenicId}, update_time = NOW() WHERE id = #{id}")
int updateCoupon(PriceCouponConfig coupon);