trade:【交易订单】调整交易订单的 afterSale 字段

This commit is contained in:
YunaiV 2022-11-19 09:18:19 +08:00
parent cd2bc112cc
commit e95402ab92
6 changed files with 16 additions and 24 deletions

View File

@ -38,6 +38,7 @@ public class ProductSkuDO extends BaseDO {
/**
* 商品 SKU 名字
*/
@Deprecated // TODO 芋艿参考有赞不需要 sku 的标题
private String name;
/**
* SPU 编号

View File

@ -20,7 +20,7 @@ import java.util.List;
*
* @author 芋道源码
*/
@TableName(value = "trade_refund")
@TableName(value = "trade_after_sale")
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)

View File

@ -71,7 +71,6 @@ public class TradeOrderDO extends BaseDO {
* 枚举 {@link TradeOrderStatusEnum}
*/
private Integer status;
// TODO 芋艿要不要存储 prod_name 购买的商品名门
/**
* 购买的商品数量
*/

View File

@ -61,6 +61,8 @@ public class TradeOrderItemDO extends BaseDO {
private List<Property> properties;
/**
* 商品名称
*
* 冗余 ProductSpuDO name 字段
*/
private String name;
/**
@ -136,7 +138,7 @@ public class TradeOrderItemDO extends BaseDO {
// ========== 退款基本信息 ==========
/**
* 退款状态
* 售后状态
*
* 枚举 {@link TradeOrderItemAfterSaleStatusEnum}
*

View File

@ -8,7 +8,6 @@ import cn.iocoder.yudao.module.member.api.address.dto.AddressRespDTO;
import cn.iocoder.yudao.module.pay.api.order.PayOrderApi;
import cn.iocoder.yudao.module.product.api.sku.ProductSkuApi;
import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuRespDTO;
import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuUpdateStockReqDTO;
import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi;
import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO;
import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum;
@ -18,17 +17,16 @@ import cn.iocoder.yudao.module.promotion.api.price.dto.PriceCalculateRespDTO;
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderCreateReqVO;
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO;
import cn.iocoder.yudao.module.trade.dal.mysql.order.TradeOrderMapper;
import cn.iocoder.yudao.module.trade.dal.mysql.order.TradeOrderItemMapper;
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderItemAfterSaleStatusEnum;
import cn.iocoder.yudao.module.trade.dal.mysql.order.TradeOrderMapper;
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderAfterSaleStatusEnum;
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderItemAfterSaleStatusEnum;
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum;
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderTypeEnum;
import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderConfig;
import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderProperties;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentMatcher;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Import;
@ -208,7 +206,6 @@ class TradeOrderServiceTest extends BaseDbUnitTest {
assertEquals(tradeOrderItemDO01.getOrderPartPrice(), 7);
assertEquals(tradeOrderItemDO01.getOrderDividePrice(), 35);
assertEquals(tradeOrderItemDO01.getAfterSaleStatus(), TradeOrderItemAfterSaleStatusEnum.NONE.getStatus());
assertEquals(tradeOrderItemDO01.getRefundTotal(), 0);
// 断言 TradeOrderItemDO 订单 2
TradeOrderItemDO tradeOrderItemDO02 = tradeOrderItemDOs.get(1);
assertNotNull(tradeOrderItemDO02.getId());
@ -229,20 +226,14 @@ class TradeOrderServiceTest extends BaseDbUnitTest {
assertEquals(tradeOrderItemDO02.getOrderPartPrice(), 15);
assertEquals(tradeOrderItemDO02.getOrderDividePrice(), 25);
assertEquals(tradeOrderItemDO02.getAfterSaleStatus(), TradeOrderItemAfterSaleStatusEnum.NONE.getStatus());
assertEquals(tradeOrderItemDO02.getRefundTotal(), 0);
// 校验调用
verify(productSkuApi).updateSkuStock(argThat(new ArgumentMatcher<ProductSkuUpdateStockReqDTO>() {
@Override
public boolean matches(ProductSkuUpdateStockReqDTO updateStockReqDTO) {
verify(productSkuApi).updateSkuStock(argThat(updateStockReqDTO -> {
assertEquals(updateStockReqDTO.getItems().size(), 2);
assertEquals(updateStockReqDTO.getItems().get(0).getId(), 1L);
assertEquals(updateStockReqDTO.getItems().get(0).getIncrCount(), 3);
assertEquals(updateStockReqDTO.getItems().get(1).getId(), 2L);
assertEquals(updateStockReqDTO.getItems().get(1).getIncrCount(), 4);
return true;
}
}));
verify(couponApi).useCoupon(argThat(reqDTO -> {
assertEquals(reqDTO.getId(), reqVO.getCouponId());

View File

@ -32,7 +32,7 @@ CREATE TABLE IF NOT EXISTS "trade_order" (
"receiver_area_id" int NOT NULL,
"receiver_post_code" int,
"receiver_detail_address" varchar NOT NULL,
"refund_status" int NOT NULL,
"after_sale_status" int NOT NULL,
"refund_price" int NOT NULL,
"coupon_id" bigint NOT NULL,
"coupon_price" int NOT NULL,
@ -61,8 +61,7 @@ CREATE TABLE IF NOT EXISTS "trade_order_item" (
"pay_price" int NOT NULL,
"order_part_price" int NOT NULL,
"order_divide_price" int NOT NULL,
"refund_status" int NOT NULL,
"refund_total" int NOT NULL,
"after_sale_status" int NOT NULL,
"creator" varchar DEFAULT '',
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updater" varchar DEFAULT '',