From 02fa6fc5c6187bc1c731e11f574675d7aac410fc Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 26 May 2023 23:58:26 +0800 Subject: [PATCH] =?UTF-8?q?mall=20+=20trade=EF=BC=9A=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E4=BB=B7=E6=A0=BC=E5=AD=97=E6=AE=B5=EF=BC=8C=E6=9B=B4=E6=98=93?= =?UTF-8?q?=E6=87=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/price/dto/PriceCalculateRespDTO.java | 12 ++--- .../promotion/convert/price/PriceConvert.java | 6 +-- .../service/price/PriceServiceImpl.java | 7 ++- .../service/price/PriceServiceTest.java | 29 +++++----- .../admin/order/vo/TradeOrderBaseVO.java | 3 -- .../order/vo/AppTradeOrderDetailRespVO.java | 5 +- .../dal/dataobject/order/TradeOrderDO.java | 27 +++------- .../dataobject/order/TradeOrderItemDO.java | 53 ++++++++++--------- .../aftersale/TradeAfterSaleServiceImpl.java | 2 +- .../service/order/TradeOrderServiceTest.java | 7 +-- 10 files changed, 58 insertions(+), 93 deletions(-) diff --git a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/price/dto/PriceCalculateRespDTO.java b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/price/dto/PriceCalculateRespDTO.java index cda6d99d6..a067aa0b5 100644 --- a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/price/dto/PriceCalculateRespDTO.java +++ b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/price/dto/PriceCalculateRespDTO.java @@ -38,6 +38,7 @@ public class PriceCalculateRespDTO { */ private List promotions; + // TODO @芋艿:需要改造下,主要是价格字段 /** * 订单 */ @@ -51,14 +52,7 @@ public class PriceCalculateRespDTO { * * 对应 taobao 的 trade.total_fee 字段 */ - private Integer originalPrice; - /** - * 订单原价(总),单位:分 - * - * 基于 {@link OrderItem#getPayPrice()} 求和 - * 和 {@link #originalPrice} 的差异:去除商品级优惠 - */ - private Integer orderPrice; + private Integer totalPrice; /** * 订单优惠(总),单位:分 * @@ -207,7 +201,7 @@ public class PriceCalculateRespDTO { /** * 计算时的原价(总),单位:分 */ - private Integer originalPrice; + private Integer totalPrice; /** * 计算时的优惠(总),单位:分 */ diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/price/PriceConvert.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/price/PriceConvert.java index 8e4b24666..e8649cb61 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/price/PriceConvert.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/price/PriceConvert.java @@ -22,7 +22,7 @@ public interface PriceConvert { // 创建 PriceCalculateRespDTO 对象 PriceCalculateRespDTO priceCalculate = new PriceCalculateRespDTO(); // 创建它的 Order 属性 - PriceCalculateRespDTO.Order order = new PriceCalculateRespDTO.Order().setOriginalPrice(0).setDiscountPrice(0) + PriceCalculateRespDTO.Order order = new PriceCalculateRespDTO.Order().setTotalPrice(0).setDiscountPrice(0) .setCouponPrice(0).setPointPrice(0).setDeliveryPrice(0).setPayPrice(0) .setItems(new ArrayList<>()).setCouponId(calculateReqDTO.getCouponId()); priceCalculate.setOrder(order).setPromotions(new ArrayList<>()); @@ -38,8 +38,8 @@ public interface PriceConvert { orderItem.setPayPrice(orderItem.getOriginalPrice()).setOrderDividePrice(orderItem.getOriginalPrice()); priceCalculate.getOrder().getItems().add(orderItem); // 补充价格信息到 Order 中 - order.setOriginalPrice(order.getOriginalPrice() + orderItem.getOriginalPrice()) - .setOrderPrice(order.getOriginalPrice()).setPayPrice(order.getOriginalPrice()); + order.setTotalPrice(order.getTotalPrice() + orderItem.getOriginalPrice()) + .setPayPrice(order.getTotalPrice()); }); return priceCalculate; } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/price/PriceServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/price/PriceServiceImpl.java index 03abb061f..7aab0bee5 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/price/PriceServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/price/PriceServiceImpl.java @@ -406,7 +406,7 @@ public class PriceServiceImpl implements PriceService { // 创建营销明细 PriceCalculateRespDTO.Promotion promotion = new PriceCalculateRespDTO.Promotion() .setId(id).setName(name).setType(type).setLevel(level) - .setOriginalPrice(promotionItem.getOriginalPrice()).setDiscountPrice(promotionItem.getDiscountPrice()) + .setTotalPrice(promotionItem.getOriginalPrice()).setDiscountPrice(promotionItem.getDiscountPrice()) .setItems(singletonList(promotionItem)).setMeet(meet).setMeetTip(meetTip); priceCalculate.getPromotions().add(promotion); } @@ -437,7 +437,7 @@ public class PriceServiceImpl implements PriceService { // 创建营销明细 PriceCalculateRespDTO.Promotion promotion = new PriceCalculateRespDTO.Promotion() .setId(id).setName(name).setType(type).setLevel(level) - .setOriginalPrice(getSumValue(orderItems, PriceCalculateRespDTO.OrderItem::getOrderDividePrice, Integer::sum)) + .setTotalPrice(getSumValue(orderItems, PriceCalculateRespDTO.OrderItem::getOrderDividePrice, Integer::sum)) .setDiscountPrice(getSumValue(discountPrices, value -> value, Integer::sum)) .setItems(promotionItems).setMeet(meet).setMeetTip(meetTip); priceCalculate.getPromotions().add(promotion); @@ -453,7 +453,7 @@ public class PriceServiceImpl implements PriceService { Integer originalPrice = getSumValue(orderItems, PriceCalculateRespDTO.OrderItem::getOrderDividePrice, Integer::sum); PriceCalculateRespDTO.Promotion promotion = new PriceCalculateRespDTO.Promotion() .setId(id).setName(name).setType(type).setLevel(level) - .setOriginalPrice(originalPrice).setDiscountPrice(0) + .setTotalPrice(originalPrice).setDiscountPrice(0) .setItems(promotionItems).setMeet(false).setMeetTip(meetTip); priceCalculate.getPromotions().add(promotion); } @@ -476,7 +476,6 @@ public class PriceServiceImpl implements PriceService { // 设置 Order 相关相关字段 PriceCalculateRespDTO.Order order = priceCalculate.getOrder(); order.setPayPrice(order.getPayPrice() - diffPayPrice); - order.setOrderPrice(order.getOrderPrice() - diffPayPrice); } /** diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/price/PriceServiceTest.java b/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/price/PriceServiceTest.java index 0c7b2d6ec..9e40ff67b 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/price/PriceServiceTest.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/price/PriceServiceTest.java @@ -70,8 +70,7 @@ public class PriceServiceTest extends BaseMockitoUnitTest { PriceCalculateRespDTO priceCalculate = priceService.calculatePrice(calculateReqDTO); // 断言 Order 部分 PriceCalculateRespDTO.Order order = priceCalculate.getOrder(); - assertEquals(order.getOriginalPrice(), 200); - assertEquals(order.getOrderPrice(), 180); + assertEquals(order.getTotalPrice(), 200); assertEquals(order.getDiscountPrice(), 0); assertEquals(order.getPointPrice(), 0); assertEquals(order.getDeliveryPrice(), 0); @@ -95,7 +94,7 @@ public class PriceServiceTest extends BaseMockitoUnitTest { assertEquals(promotion.getName(), "会员折扣"); assertEquals(promotion.getType(), PromotionTypeEnum.MEMBER.getType()); assertEquals(promotion.getLevel(), PromotionLevelEnum.SKU.getLevel()); - assertEquals(promotion.getOriginalPrice(), 200); + assertEquals(promotion.getTotalPrice(), 200); assertEquals(promotion.getDiscountPrice(), 20); assertTrue(promotion.getMeet()); assertEquals(promotion.getMeetTip(), "会员折扣:省 0.20 元"); @@ -133,8 +132,7 @@ public class PriceServiceTest extends BaseMockitoUnitTest { PriceCalculateRespDTO priceCalculate = priceService.calculatePrice(calculateReqDTO); // 断言 Order 部分 PriceCalculateRespDTO.Order order = priceCalculate.getOrder(); - assertEquals(order.getOriginalPrice(), 350); - assertEquals(order.getOrderPrice(), 210); + assertEquals(order.getTotalPrice(), 350); assertEquals(order.getDiscountPrice(), 0); assertEquals(order.getPointPrice(), 0); assertEquals(order.getDeliveryPrice(), 0); @@ -167,7 +165,7 @@ public class PriceServiceTest extends BaseMockitoUnitTest { assertEquals(promotion01.getName(), "活动 1000 号"); assertEquals(promotion01.getType(), PromotionTypeEnum.DISCOUNT_ACTIVITY.getType()); assertEquals(promotion01.getLevel(), PromotionLevelEnum.SKU.getLevel()); - assertEquals(promotion01.getOriginalPrice(), 200); + assertEquals(promotion01.getTotalPrice(), 200); assertEquals(promotion01.getDiscountPrice(), 80); assertTrue(promotion01.getMeet()); assertEquals(promotion01.getMeetTip(), "限时折扣:省 0.80 元"); @@ -181,7 +179,7 @@ public class PriceServiceTest extends BaseMockitoUnitTest { assertEquals(promotion02.getName(), "活动 2000 号"); assertEquals(promotion02.getType(), PromotionTypeEnum.DISCOUNT_ACTIVITY.getType()); assertEquals(promotion02.getLevel(), PromotionLevelEnum.SKU.getLevel()); - assertEquals(promotion02.getOriginalPrice(), 150); + assertEquals(promotion02.getTotalPrice(), 150); assertEquals(promotion02.getDiscountPrice(), 60); assertTrue(promotion02.getMeet()); assertEquals(promotion02.getMeetTip(), "限时折扣:省 0.60 元"); @@ -225,8 +223,7 @@ public class PriceServiceTest extends BaseMockitoUnitTest { PriceCalculateRespDTO priceCalculate = priceService.calculatePrice(calculateReqDTO); // 断言 Order 部分 PriceCalculateRespDTO.Order order = priceCalculate.getOrder(); - assertEquals(order.getOriginalPrice(), 470); - assertEquals(order.getOrderPrice(), 470); + assertEquals(order.getTotalPrice(), 470); assertEquals(order.getDiscountPrice(), 130); assertEquals(order.getPointPrice(), 0); assertEquals(order.getDeliveryPrice(), 0); @@ -268,7 +265,7 @@ public class PriceServiceTest extends BaseMockitoUnitTest { assertEquals(promotion01.getName(), "活动 1000 号"); assertEquals(promotion01.getType(), PromotionTypeEnum.REWARD_ACTIVITY.getType()); assertEquals(promotion01.getLevel(), PromotionLevelEnum.ORDER.getLevel()); - assertEquals(promotion01.getOriginalPrice(), 350); + assertEquals(promotion01.getTotalPrice(), 350); assertEquals(promotion01.getDiscountPrice(), 70); assertTrue(promotion01.getMeet()); assertEquals(promotion01.getMeetTip(), "满减送:省 0.70 元"); @@ -287,7 +284,7 @@ public class PriceServiceTest extends BaseMockitoUnitTest { assertEquals(promotion02.getName(), "活动 2000 号"); assertEquals(promotion02.getType(), PromotionTypeEnum.REWARD_ACTIVITY.getType()); assertEquals(promotion02.getLevel(), PromotionLevelEnum.ORDER.getLevel()); - assertEquals(promotion02.getOriginalPrice(), 120); + assertEquals(promotion02.getTotalPrice(), 120); assertEquals(promotion02.getDiscountPrice(), 60); assertTrue(promotion02.getMeet()); assertEquals(promotion02.getMeetTip(), "满减送:省 0.60 元"); @@ -323,8 +320,7 @@ public class PriceServiceTest extends BaseMockitoUnitTest { PriceCalculateRespDTO priceCalculate = priceService.calculatePrice(calculateReqDTO); // 断言 Order 部分 PriceCalculateRespDTO.Order order = priceCalculate.getOrder(); - assertEquals(order.getOriginalPrice(), 350); - assertEquals(order.getOrderPrice(), 350); + assertEquals(order.getTotalPrice(), 350); assertEquals(order.getDiscountPrice(), 0); assertEquals(order.getPointPrice(), 0); assertEquals(order.getDeliveryPrice(), 0); @@ -357,7 +353,7 @@ public class PriceServiceTest extends BaseMockitoUnitTest { assertEquals(promotion01.getName(), "活动 1000 号"); assertEquals(promotion01.getType(), PromotionTypeEnum.REWARD_ACTIVITY.getType()); assertEquals(promotion01.getLevel(), PromotionLevelEnum.ORDER.getLevel()); - assertEquals(promotion01.getOriginalPrice(), 350); + assertEquals(promotion01.getTotalPrice(), 350); assertEquals(promotion01.getDiscountPrice(), 0); assertFalse(promotion01.getMeet()); assertEquals(promotion01.getMeetTip(), "TODO"); // TODO 芋艿:后面再想想 @@ -396,8 +392,7 @@ public class PriceServiceTest extends BaseMockitoUnitTest { PriceCalculateRespDTO priceCalculate = priceService.calculatePrice(calculateReqDTO); // 断言 Order 部分 PriceCalculateRespDTO.Order order = priceCalculate.getOrder(); - assertEquals(order.getOriginalPrice(), 470); - assertEquals(order.getOrderPrice(), 470); + assertEquals(order.getTotalPrice(), 470); assertEquals(order.getDiscountPrice(), 0); assertEquals(order.getPointPrice(), 0); assertEquals(order.getDeliveryPrice(), 0); @@ -440,7 +435,7 @@ public class PriceServiceTest extends BaseMockitoUnitTest { assertEquals(promotion01.getName(), "程序员节"); assertEquals(promotion01.getType(), PromotionTypeEnum.COUPON.getType()); assertEquals(promotion01.getLevel(), PromotionLevelEnum.COUPON.getLevel()); - assertEquals(promotion01.getOriginalPrice(), 350); + assertEquals(promotion01.getTotalPrice(), 350); assertEquals(promotion01.getDiscountPrice(), 70); assertTrue(promotion01.getMeet()); assertEquals(promotion01.getMeetTip(), "优惠劵:省 0.70 元"); diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/vo/TradeOrderBaseVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/vo/TradeOrderBaseVO.java index a1428c436..3453a3c2e 100755 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/vo/TradeOrderBaseVO.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/vo/TradeOrderBaseVO.java @@ -73,9 +73,6 @@ public class TradeOrderBaseVO { @Schema(description = "商品原价(总)", required = true, example = "1000") private Integer originalPrice; - @Schema(description = "订单原价(总)", required = true, example = "1000") - private Integer orderPrice; - @Schema(description = "订单优惠(总)", required = true, example = "100") private Integer discountPrice; diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeOrderDetailRespVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeOrderDetailRespVO.java index fd54444db..647ea2638 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeOrderDetailRespVO.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeOrderDetailRespVO.java @@ -59,10 +59,7 @@ public class AppTradeOrderDetailRespVO { private String payChannelCode; @Schema(description = "商品原价(总)", required = true, example = "1000") - private Integer originalPrice; - - @Schema(description = "订单原价(总)", required = true, example = "1000") - private Integer orderPrice; + private Integer totalPrice; @Schema(description = "订单优惠(总)", required = true, example = "100") private Integer discountPrice; diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderDO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderDO.java index 0faa67db3..f4d27a3ae 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderDO.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderDO.java @@ -2,13 +2,8 @@ package cn.iocoder.yudao.module.trade.dal.dataobject.order; import cn.iocoder.yudao.framework.common.enums.TerminalEnum; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; -import cn.iocoder.yudao.module.promotion.api.price.dto.PriceCalculateRespDTO.OrderItem; import cn.iocoder.yudao.module.trade.enums.delivery.DeliveryTypeEnum; -import cn.iocoder.yudao.module.trade.enums.order.TradeOrderCancelTypeEnum; -import cn.iocoder.yudao.module.trade.enums.order.TradeOrderRefundStatusEnum; -import cn.iocoder.yudao.module.trade.enums.order.TradeOrderDeliveryStatusEnum; -import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum; -import cn.iocoder.yudao.module.trade.enums.order.TradeOrderTypeEnum; +import cn.iocoder.yudao.module.trade.enums.order.*; import com.baomidou.mybatisplus.annotation.KeySequence; import com.baomidou.mybatisplus.annotation.TableName; import lombok.*; @@ -134,25 +129,15 @@ public class TradeOrderDO extends BaseDO { private String payChannelCode; /** - * 商品原价(总),单位:分 + * 商品原价,单位:分 * * totalPrice = {@link TradeOrderItemDO#getPrice()} * {@link TradeOrderItemDO#getCount()} 求和 * * 对应 taobao 的 trade.total_fee 字段 */ private Integer totalPrice; - // TODO 芋艿:是不是要删除这个字段? /** - * 订单原价(总),单位:分 - * - * 1. orderPrice = {@link OrderItem#getPayPrice()} 求和 - * 2. orderPrice = {@link #totalPrice} - 商品级优惠 - */ - private Integer orderPrice; - /** - * 订单优惠(总),单位:分 - * - * 订单级优惠:对主订单的优惠,常见如:订单满 200 元减 10 元;订单满 80 包邮。 + * 优惠金额,单位:分 * * 对应 taobao 的 order.discount_fee 字段 */ @@ -162,7 +147,7 @@ public class TradeOrderDO extends BaseDO { */ private Integer deliveryPrice; /** - * 订单调价(总),单位:分 + * 订单调价,单位:分 * * 正数,加价;负数,减价 */ @@ -170,11 +155,11 @@ public class TradeOrderDO extends BaseDO { /** * 应付金额(总),单位:分 * - * = {@link OrderItem#getPayPrice()} 求和 + * = {@link #totalPrice} * - {@link #couponPrice} * - {@link #pointPrice} - * + {@link #deliveryPrice} * - {@link #discountPrice} + * + {@link #deliveryPrice} * + {@link #adjustPrice} */ private Integer payPrice; diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderItemDO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderItemDO.java index 42fc106f5..323389c94 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderItemDO.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderItemDO.java @@ -102,44 +102,47 @@ public class TradeOrderItemDO extends BaseDO { */ private Integer price; /** - * 商品优惠(总),单位:分 - * - * 商品级优惠:对单个商品的,常见如:商品原价的 8 折;商品原价的减 50 元 + * 优惠金额(总),单位:分 * * 对应 taobao 的 order.discount_fee 字段 */ private Integer discountPrice; /** - * 子订单实付金额(总),不算主订单分摊金额,单位:分 + * 运费金额(总),单位:分 + */ + private Integer deliveryPrice; + /** + * 订单调价(总),单位:分 + * + * 正数,加价;负数,减价 + */ + private Integer adjustPrice; + /** + * 应付金额(总),单位:分 * * = {@link #price} * {@link #count} + * - {@link #couponPrice} + * - {@link #pointPrice} * - {@link #discountPrice} - * - * 对应 taobao 的 order.payment 字段 + * + {@link #deliveryPrice} + * + {@link #adjustPrice} */ private Integer payPrice; - /** - * 子订单分摊金额(总),单位:分 - * 需要分摊 {@link TradeOrderDO#getDiscountPrice()}、{@link TradeOrderDO#getCouponPrice()}、{@link TradeOrderDO#getPointPrice()} - * - * 对应 taobao 的 order.part_mjz_discount 字段 - * 淘宝说明:子订单分摊优惠基础逻辑:一般正常优惠券和满减优惠按照子订单的金额进行分摊,特殊情况如果优惠券是指定商品使用的,只会分摊到对应商品子订单上不分摊。 - */ - private Integer orderPartPrice; - /** - * 分摊后子订单实付金额(总),单位:分 - * - * = {@link #payPrice} - * - {@link #orderPartPrice} - * - * 对应 taobao 的 divide_order_fee 字段 - */ - private Integer orderDividePrice; - // ========== 营销基本信息 ========== - // TODO 芋艿:在捉摸一下 + /** + * 优惠劵减免金额,单位:分 + * + * 对应 taobao 的 trade.coupon_fee 字段 + */ + private Integer couponPrice; + /** + * 积分抵扣的金额,单位:分 + * + * 对应 taobao 的 trade.point_fee 字段 + */ + private Integer pointPrice; // ========== 售后基本信息 ========== /** diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/aftersale/TradeAfterSaleServiceImpl.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/aftersale/TradeAfterSaleServiceImpl.java index 2da892d61..374af0a16 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/aftersale/TradeAfterSaleServiceImpl.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/aftersale/TradeAfterSaleServiceImpl.java @@ -97,7 +97,7 @@ public class TradeAfterSaleServiceImpl implements TradeAfterSaleService { } // 申请的退款金额,不能超过商品的价格 - if (createReqVO.getRefundPrice() > orderItem.getOrderDividePrice()) { + if (createReqVO.getRefundPrice() > orderItem.getPayPrice()) { throw exception(AFTER_SALE_CREATE_FAIL_REFUND_PRICE_ERROR); } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/test/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderServiceTest.java b/yudao-module-mall/yudao-module-trade-biz/src/test/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderServiceTest.java index 0b4c3de2d..064ec336e 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/test/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderServiceTest.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/test/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderServiceTest.java @@ -124,7 +124,7 @@ public class TradeOrderServiceTest extends BaseDbUnitTest { .setSpuId(21L).setSkuId(2L).setCount(4).setOriginalPrice(80).setOriginalUnitPrice(20) .setDiscountPrice(40).setPayPrice(40).setOrderPartPrice(15).setOrderDividePrice(25); PriceCalculateRespDTO.Order priceOrder = new PriceCalculateRespDTO.Order() - .setOriginalPrice(230).setOrderPrice(100).setDiscountPrice(0).setCouponPrice(30) + .setTotalPrice(230).setDiscountPrice(0).setCouponPrice(30) .setPointPrice(10).setDeliveryPrice(20).setPayPrice(80).setCouponId(101L).setCouponPrice(30) .setItems(Arrays.asList(priceOrderItem01, priceOrderItem02)); when(priceApi.calculatePrice(argThat(priceCalculateReqDTO -> { @@ -170,7 +170,6 @@ public class TradeOrderServiceTest extends BaseDbUnitTest { assertFalse(tradeOrderDO.getPayed()); assertNull(tradeOrderDO.getPayTime()); assertEquals(tradeOrderDO.getTotalPrice(), 230); - assertEquals(tradeOrderDO.getOrderPrice(), 100); assertEquals(tradeOrderDO.getDiscountPrice(), 0); assertEquals(tradeOrderDO.getAdjustPrice(), 0); assertEquals(tradeOrderDO.getPayPrice(), 80); @@ -208,8 +207,6 @@ public class TradeOrderServiceTest extends BaseDbUnitTest { assertEquals(tradeOrderItemDO01.getPrice(), 50); assertEquals(tradeOrderItemDO01.getDiscountPrice(), 20); assertEquals(tradeOrderItemDO01.getPayPrice(), 130); - assertEquals(tradeOrderItemDO01.getOrderPartPrice(), 7); - assertEquals(tradeOrderItemDO01.getOrderDividePrice(), 35); assertEquals(tradeOrderItemDO01.getAfterSaleStatus(), TradeOrderItemAfterSaleStatusEnum.NONE.getStatus()); // 断言 TradeOrderItemDO 订单(第 2 个) TradeOrderItemDO tradeOrderItemDO02 = tradeOrderItemDOs.get(1); @@ -228,8 +225,6 @@ public class TradeOrderServiceTest extends BaseDbUnitTest { assertEquals(tradeOrderItemDO02.getPrice(), 20); assertEquals(tradeOrderItemDO02.getDiscountPrice(), 40); assertEquals(tradeOrderItemDO02.getPayPrice(), 40); - assertEquals(tradeOrderItemDO02.getOrderPartPrice(), 15); - assertEquals(tradeOrderItemDO02.getOrderDividePrice(), 25); assertEquals(tradeOrderItemDO02.getAfterSaleStatus(), TradeOrderItemAfterSaleStatusEnum.NONE.getStatus()); // 校验调用 verify(productSkuApi).updateSkuStock(argThat(updateStockReqDTO -> {