| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- package com.ruoyi.system.dto;
- import java.math.BigDecimal;
- import java.util.List;
- import com.fasterxml.jackson.annotation.JsonInclude;
- import lombok.Data;
- /**
- * 优惠算价响应DTO
- *
- * 返回字段:
- * - originalAmount 商品原价总额
- * - pathA 路径A(折扣/第二份半价)
- * - pathB 路径B(满减)
- * - optimalPath 最优路径 "A" 或 "B"
- * - finalAmount 最终实付金额(最低¥0.01)
- * - newCustomerReduce 新客立减金额(新客时返回)
- * - couponId 使用的优惠券ID(选券时返回)
- * - couponName 使用的券名称
- * - couponReduce 优惠券减免金额
- * - couponConflict 优惠券是否与促销冲突
- * - conflictNote 冲突说明
- * - details 优惠明细列表
- * - availableCoupons 可用优惠券列表
- */
- @Data
- @JsonInclude(JsonInclude.Include.NON_NULL)
- public class PromotionCalcResponse {
- /** 商品原价总额 */
- private BigDecimal originalAmount;
- /** 路径A(折扣/第二份半价) */
- private PathResult pathA;
- /** 路径B(满减) */
- private PathResult pathB;
- /** 最优路径 "A" 或 "B" */
- private String optimalPath;
- /** 最终实付金额(最低¥0.01) */
- private BigDecimal finalAmount;
- /** 新客立减金额(新客时返回) */
- private BigDecimal newCustomerReduce;
- /** 使用的优惠券ID(选券时返回) */
- private Long couponId;
- /** 使用的券名称 */
- private String couponName;
- /** 优惠券减免金额 */
- private BigDecimal couponReduce;
- /** 优惠券是否与促销冲突 */
- private Boolean couponConflict;
- /** 冲突说明 */
- private String conflictNote;
- /** 优惠明细列表 */
- private List<PromotionDetail> details;
- /** 可用优惠券列表 */
- private List<AvailableCoupon> availableCoupons;
- /** 优惠券批次ID(使用券时返回, 对应 promotion_coupon_batch.id) */
- private Long couponBatchId;
- /**
- * 路径结果
- */
- @Data
- @JsonInclude(JsonInclude.Include.NON_NULL)
- public static class PathResult {
- /** 路径标签(折扣/第二份半价/满减) */
- private String label;
- /** 促销子类型(仅路径A): 2=折扣 3=第二份半价 */
- private Integer appliedType;
- /** 路径小计金额 */
- private BigDecimal subtotal;
- /** 促销减免金额 */
- private BigDecimal promotionReduce;
- /** 商品行明细 */
- private List<LineItem> items;
- /** 匹配到的满减规则(仅路径B) */
- private MatchedRule matchedRule;
- }
- /**
- * 商品行明细
- */
- @Data
- @JsonInclude(JsonInclude.Include.NON_NULL)
- public static class LineItem {
- private Long productId;
- private Integer quantity;
- private BigDecimal unitPrice;
- private String name;
- private BigDecimal originalLineTotal;
- private BigDecimal finalLineTotal;
- /** 折扣率(仅折扣路径, 如 0.70=7折) */
- private BigDecimal discountRate;
- /** 是否命中第二份半价 */
- private Boolean halfPriceApplied;
- }
- /**
- * 匹配到的满减规则(仅路径B)
- */
- @Data
- @JsonInclude(JsonInclude.Include.NON_NULL)
- public static class MatchedRule {
- private Long id;
- private Long activityId;
- private String activityName;
- private BigDecimal threshold;
- private BigDecimal reduceAmount;
- }
- /**
- * 优惠明细
- */
- @Data
- @JsonInclude(JsonInclude.Include.NON_NULL)
- public static class PromotionDetail {
- /** 优惠类型: promotion=促销, coupon=优惠券 */
- private String type;
- /** 促销子类型: 1=满减 2=折扣 3=第二份半价 4=新客立减 (coupon时为0) */
- private Integer subType;
- /** 优惠名称 */
- private String name;
- /** 减免金额 */
- private BigDecimal reduce;
- /** 关联ID: 促销活动ID(promo_type=1) 或 券批次ID(promo_type=2) */
- private Long refId;
- }
- /**
- * 可用优惠券
- */
- @Data
- @JsonInclude(JsonInclude.Include.NON_NULL)
- public static class AvailableCoupon {
- private Long id;
- private String name;
- /** 券类型: 1=满减券 2=商品券 3=免配送费券 */
- private Integer couponType;
- /** 是否互斥: 0=同享 1=互斥 */
- private Integer isMutex;
- private BigDecimal threshold;
- private BigDecimal amount;
- private BigDecimal discountRate;
- /** 是否可用 */
- private Boolean usable;
- /** 是否与当前促销冲突 */
- private Boolean conflictWithPromotion;
- }
- }
|