调整 price 接口,参考 taobao 的技术文档

This commit is contained in:
YunaiV 2022-10-28 23:49:15 +08:00
parent 3b506006dd
commit a88eda340b

View File

@ -9,6 +9,18 @@ import java.util.List;
/**
* 价格计算 Response DTO
*
* 整体设计参考 taobao 的技术文档
* 1. <a href="https://developer.alibaba.com/docs/doc.htm?treeId=1&articleId=1029&docType=1">订单管理</a>
* 2. <a href="https://open.taobao.com/docV3.htm?docId=108471&docType=1">常用订单金额说明</a>
*
* 举个例子<a href="https://img.alicdn.com/top/i1/LB1mALAi4HI8KJjy1zbXXaxdpXa">订单图</a>
* 输入
* 1. 订单实付 trade.payment = 198.00订单邮费5
* 2. 商品级优惠 圣诞价: 29.00 圣诞价: 150.00 订单级优惠圣诞 2: 5.00
* 分摊
* 1. 商品 1原价 108 优惠 29 子订单实付 79 分摊主订单优惠 1.99
* 2. 商品 2原价 269 优惠 150 子订单实付 119 分摊主订单优惠 3.01
*
* @author 芋道源码
*/
@Data
@ -36,32 +48,29 @@ public class PriceCalculateRespDTO {
* 商品原价单位
*
* 基于 {@link OrderItem#getOriginalPrice()} 求和
* 对应 taobao trade.total_fee 字段
*/
private Integer originalPrice;
/**
* 活动减免优惠单位
* 商品优惠单位
*
* 基于 {@link OrderItem#getActivityPrice()} 求和
* 订单级优惠对主订单的优惠常见如订单满 200 元减 10 订单满 80 包邮
*
* 对应 taobao order.discount_fee 字段
*/
private Integer activityPrice;
private Integer discountPrice;
/**
* 优惠劵减免金额单位
*
* 基于 {@link OrderItem#getCouponPrice()} 求和
* 对应 taobao trade.coupon_fee 字段
*/
private Integer couponPrice;
/**
* 积分减免金额单位
*
* 基于 {@link OrderItem#getPointPrice()} 求和
* 对应 taobao trade.point_fee 字段
*/
private Integer pointPrice;
/**
* 会员减免金额单位
*
* 基于 {@link OrderItem#getMemberPrice()} 求和
*/
private Integer memberPrice;
/**
* 运费金额单位
*/
@ -70,6 +79,8 @@ public class PriceCalculateRespDTO {
* 最终购买金额单位
*
* = {@link OrderItem#getPayPrice()} 求和
* - {@link #couponPrice}
* - {@link #pointPrice}
* + {@link #deliveryPrice}
*/
private Integer payPrice;
@ -107,44 +118,40 @@ public class PriceCalculateRespDTO {
* 商品原价单位
*
* 对应 ProductSkuDO price 字段
* 对应 taobao order.price 字段
*/
private Integer originalUnitPrice;
/**
* 活动减免优惠单位
* 商品优惠单位
*
* 例如说限时折扣满减送等营销活动
*/
private Integer activityPrice;
/**
* 优惠劵减免金额单位
* 商品级优惠对单个商品的常见如商品原价的 8 商品原价的减 50
*
* 一个优惠劵会作用到的多个 SKU 商品按照计算时的 {@link #payPrice} 的比例分摊
* 对应 taobao order.discount_fee 字段
*/
private Integer couponPrice;
private Integer discountPrice;
/**
* 积分减免金额单位
*/
private Integer pointPrice;
/**
* 会员减免金额单位
*/
private Integer memberPrice;
/**
* 最终购买金额单位
* 子订单实付金额不算主订单分摊金额单位
*
* = {@link #originalPrice}
* - {@link #activityPrice}
* - {@link #couponPrice}
* - {@link #pointPrice}
* - {@link #memberPrice}
* - {@link #discountPrice}
*
* 对应 taobao order.payment 字段
*/
private Integer payPrice;
/**
* 最终购买金额单位
* 子订单分摊金额单位
* 需要分摊 {@link Order#discountPrice}{@link Order#couponPrice}
*
* = {@link #payPrice} / {@link #getCount()}
* 对应 taobao order.part_mjz_discount 字段
*/
private Integer payUnitPrice;
private Integer orderPartPrice;
/**
* 分摊后子订单实付金额单位
*
* 对应 taobao divide_order_fee 字段
*/
private Integer orderDividePrice;
}
@ -179,11 +186,11 @@ public class PriceCalculateRespDTO {
/**
* 计算时的原价单位
*/
private Integer totalOriginalPrice;
private Integer beforePrice;
/**
* 计算时的优惠单位
*/
private Integer totalPromotionPrice;
private Integer afterPrice;
/**
* 匹配的商品 SKU 数组
*/
@ -218,11 +225,11 @@ public class PriceCalculateRespDTO {
/**
* 计算时的原价单位
*/
private Integer totalOriginalPrice;
private Integer beforePrice;
/**
* 计算时的优惠单位
*/
private Integer totalPromotionPrice;
private Integer afterPrice;
}