Commit 00863fdbac44befc1915e64d1065120d88500f23

Authored by YunaiV
1 parent face9cae

mall:调整 trade 订单的设计

yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderDO.java
@@ -109,26 +109,43 @@ public class TradeOrderDO extends BaseDO { @@ -109,26 +109,43 @@ public class TradeOrderDO extends BaseDO {
109 private Date payTime; 109 private Date payTime;
110 110
111 // ========== 价格 + 支付基本信息 ========== 111 // ========== 价格 + 支付基本信息 ==========
  112 + // 价格文档 - 淘宝:https://open.taobao.com/docV3.htm?docId=108471&docType=1
  113 +
  114 +// TODO promotion_details(订单优惠信息明细,商品和订单级优惠一般都在里面)
  115 +
112 /** 116 /**
113 - * 购买(商品)总金额,单位:分 117 + * 商品原价(总),单位:分
  118 + *
  119 + * 基于 {@link TradeOrderItemDO#getTotalOriginalPrice()} 求和
114 */ 120 */
115 - private Integer buyPrice; // niu - goods_money; 121 + private Integer skuOriginalPrice; // niu - goods_money;
116 /** 122 /**
117 - * 运费金额,单位:分 123 + * 商品优惠(总),单位:分
  124 + *
  125 + * 基于 {@link TradeOrderItemDO#getTotalPromotionPrice()} 求和
118 */ 126 */
119 - private Integer deliveryPrice; // niu - delivery_money; 127 + private Integer skuPromotionPrice;
120 /** 128 /**
121 - * 最终金额,单位:分 129 + * 订单优惠(总),单位:分
122 * 130 *
123 - * presentPrice = buyPrice + deliveryPrice - couponPrice - integralPrice - marketPrice 131 + * 例如说:满减折扣;不包括优惠劵、商品优惠
  132 + */
  133 + private Integer orderPromotionPrice; // niu - promotion_money;taobao - discount_fee(主订单优惠)
  134 + /**
  135 + * 运费金额,单位:分
124 */ 136 */
125 - private Integer presentPrice; // niu - order_money; 137 + private Integer deliveryPrice; // niu - delivery_money;taobao - post_fee(订单邮费)
  138 + // TODO 芋艿:taobao 的:trade.adjust_fee/order.adjust_fee(调整金额,如:卖家手动修改订单价格,官方数据修复等等)
126 /** 139 /**
127 - * 实际已支付金额,单位:分 140 + * 应付金额(总),单位:分
128 * 141 *
129 - * 初始时,金额为 0 。等到支付成功后,会进行更新。 142 + * = {@link #skuOriginalPrice}
  143 + * + {@link #deliveryPrice}
  144 + * - {@link #skuPromotionPrice}
  145 + * - {@link #orderPromotionPrice}
  146 + * - {@link #couponPrice}
130 */ 147 */
131 - private Integer payPrice; // niu - pay_money; 148 + private Integer payPrice; // niu - pay_money;taobao - payment(主订单实付金额) | trade.total_fee(主订单应付金额,参考使用);
132 /** 149 /**
133 * 支付订单编号 150 * 支付订单编号
134 * 151 *
@@ -137,8 +154,10 @@ public class TradeOrderDO extends BaseDO { @@ -137,8 +154,10 @@ public class TradeOrderDO extends BaseDO {
137 private Long payOrderId; 154 private Long payOrderId;
138 /** 155 /**
139 * 支付成功的支付渠道 156 * 支付成功的支付渠道
  157 + *
  158 + * 对应 PayChannelEnum 枚举
140 */ 159 */
141 - private Integer payType; 160 + private Integer payChannel;
142 161
143 // ========== 收件 + 物流基本信息 ========== 162 // ========== 收件 + 物流基本信息 ==========
144 /** 163 /**
@@ -226,20 +245,14 @@ public class TradeOrderDO extends BaseDO { @@ -226,20 +245,14 @@ public class TradeOrderDO extends BaseDO {
226 * 优惠劵减免金额,单位:分 245 * 优惠劵减免金额,单位:分
227 */ 246 */
228 private Integer couponPrice; // niu - coupon_money; 247 private Integer couponPrice; // niu - coupon_money;
229 - /**  
230 - * 营销减免金额,单位:分  
231 - *  
232 - * 例如说:满减折扣  
233 - */  
234 - private Integer marketPrice; // niu - promotion_money;  
235 - /**  
236 - * 积分抵扣的金额,单位:分  
237 - */  
238 - private Integer integralPrice;  
239 - /**  
240 - * 使用的积分  
241 - */  
242 - private Integer useIntegral; 248 +// /**
  249 +// * 积分抵扣的金额,单位:分
  250 +// */
  251 +// private Integer integralPrice;
  252 +// /**
  253 +// * 使用的积分
  254 +// */
  255 +// private Integer useIntegral;
243 256
244 // TODO ========== 待定字段:yv ========= 257 // TODO ========== 待定字段:yv =========
245 // TODO cart_id:购物车 id 258 // TODO cart_id:购物车 id
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderItemDO.java
@@ -42,11 +42,17 @@ public class TradeOrderItemDO extends BaseDO { @@ -42,11 +42,17 @@ public class TradeOrderItemDO extends BaseDO {
42 42
43 // ========== 商品基本信息 ========== 43 // ========== 商品基本信息 ==========
44 /** 44 /**
  45 + * 商品 SPU 编号
  46 + *
  47 + * 关联 ProductSkuDO 的 spuId 编号
  48 + */
  49 + private Long spuId;
  50 + /**
45 * 商品 SKU 编号 51 * 商品 SKU 编号
46 * 52 *
47 * 关联 ProductSkuDO 的 id 编号 53 * 关联 ProductSkuDO 的 id 编号
48 */ 54 */
49 - private Integer skuId; 55 + private Long skuId;
50 /** 56 /**
51 * 规格值数组,JSON 格式 57 * 规格值数组,JSON 格式
52 */ 58 */
@@ -74,46 +80,51 @@ public class TradeOrderItemDO extends BaseDO { @@ -74,46 +80,51 @@ public class TradeOrderItemDO extends BaseDO {
74 80
75 // ========== 价格 + 支付基本信息 ========== 81 // ========== 价格 + 支付基本信息 ==========
76 /** 82 /**
77 - * 购买单价,单位:分 83 + * 商品原价(单),单位:分
78 * 84 *
79 * 对应 ProductSkuDO 的 price 字段 85 * 对应 ProductSkuDO 的 price 字段
80 */ 86 */
81 - private Integer buyPrice; // like - original_price;niu - costPrice  
82 - /**  
83 - * 最终单价,单位:分。  
84 - */  
85 - private Integer presentPrice; // like - goods_price;niu - price  
86 - /**  
87 - * 购买总金额,单位:分  
88 - */  
89 - private Integer buyTotal; // like - total_price;niu - 暂无 87 + private Integer originalPrice; // like - original_price;niu - costPrice
90 /** 88 /**
91 - * 最终总金额,单位:分。 89 + * 商品原价(总),单位:分
92 * 90 *
93 - * 注意,presentPrice * count 不一定等于 presentTotal 。  
94 - * 因为,存在无法整除的情况。  
95 - * 举个例子,presentPrice = 8.33 ,stock = 3 的情况,presentTotal 有可能是 24.99 ,也可能是 25 。  
96 - * 所以,需要存储一个该字段。 91 + * = {@link #originalPrice} * {@link #count}
97 */ 92 */
98 - private Integer presentTotal; // like - total_pay_price;niu - goods_money  
99 -  
100 - // ========== 营销基本信息 ========== 93 + private Integer totalOriginalPrice; // like - total_price;niu - 暂无
101 /** 94 /**
102 - * 优惠劵满减金额,单位:分 95 + * 商品级优惠(总),单位:分
  96 + *
  97 + * 例如说“限时折扣”:商品原价的 8 折;商品原价的减 50 元
103 */ 98 */
104 - private Integer couponTotal; // like - discount_price;niu - coupon_money 99 + private Integer totalPromotionPrice; // taobao - order.discount_fee(子订单商品优惠)
105 /** 100 /**
106 - * 营销减免金额,单位:分 101 + * 最终购买金额(单),单位:分。
  102 + *
  103 + * = {@link #totalPresentPrice} / {@link #count}
107 */ 104 */
108 - private Integer marketTotal; // like - discount_price;niu - promotion_money 105 + private Integer presentPrice;
109 /** 106 /**
110 - * 积分抵扣的金额,单位:分 107 + * 最终购买金额(总),单位:分。
  108 + *
  109 + * = {@link #totalOriginalPrice}
  110 + * - {@link #totalPromotionPrice}
111 */ 111 */
112 - private Integer integralTotal; // like - integral_price;niu - point_money 112 + private Integer totalPresentPrice; // like - total_pay_price;niu - goods_money; taobao - order.payment(子订单实付金额,不算主订单分摊金额) | order.total_fee(子订单应付金额,参考使用)
  113 + // TODO 芋艿:part_mjz_discount(子订单分摊金额);本质上,totalOriginalPrice - totalPayPrice
113 /** 114 /**
114 - * 使用的积分 115 + * 应付金额(总),单位:分
115 */ 116 */
116 - private Integer useIntegral; // niu - use_point 117 + private Integer totalPayPrice; // taobao - divide_order_fee (分摊后子订单实付金额);
  118 +
  119 + // ========== 营销基本信息 ==========
  120 +// /**
  121 +// * 积分抵扣的金额,单位:分
  122 +// */
  123 +// private Integer integralTotal; // like - integral_price;niu - point_money
  124 +// /**
  125 +// * 使用的积分
  126 +// */
  127 +// private Integer useIntegral; // niu - use_point
117 128
118 // ========== 退款基本信息 ========== 129 // ========== 退款基本信息 ==========
119 /** 130 /**
@@ -193,5 +204,6 @@ public class TradeOrderItemDO extends BaseDO { @@ -193,5 +204,6 @@ public class TradeOrderItemDO extends BaseDO {
193 // TODO refund_status '退款状态' 204 // TODO refund_status '退款状态'
194 // TODO refund_type '退款状态' 205 // TODO refund_type '退款状态'
195 // TODO 一堆退款字段 206 // TODO 一堆退款字段
  207 +
196 } 208 }
197 209