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 ce53126e6..3fa6ca8ab 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 @@ -62,7 +62,7 @@ public class TradeOrderBaseVO { private Long payOrderId; @Schema(description = "是否已支付", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") - private Boolean payed; + private Boolean payStatus; @Schema(description = "付款时间") private LocalDateTime payTime; diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/AppTradeOrderController.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/AppTradeOrderController.java index df6cc008a..908850d76 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/AppTradeOrderController.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/AppTradeOrderController.java @@ -127,6 +127,22 @@ public class AppTradeOrderController { return success(orderCount); } + @DeleteMapping("/cancel") + @Operation(summary = "取消交易订单") + @Parameter(name = "id", description = "交易订单编号") + public CommonResult cancelOrder(@RequestParam("id") Long id) { + // TODO @芋艿:未实现,mock 用 + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除交易订单") + @Parameter(name = "id", description = "交易订单编号") + public CommonResult deleteOrder(@RequestParam("id") Long id) { + // TODO @芋艿:未实现,mock 用 + return success(true); + } + // ========== 订单项 ========== @GetMapping("/item/get") 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 5a6feb07c..f0915e27e 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 @@ -44,7 +44,7 @@ public class AppTradeOrderDetailRespVO { // ========== 价格 + 支付基本信息 ========== @Schema(description = "是否已支付", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") - private Boolean payed; + private Boolean payStatus; @Schema(description = "支付订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") private Long payOrderId; diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeOrderPageItemRespVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeOrderPageItemRespVO.java index f0f0b2c3c..c9696b42e 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeOrderPageItemRespVO.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeOrderPageItemRespVO.java @@ -34,6 +34,9 @@ public class AppTradeOrderPageItemRespVO { // ========== 价格 + 支付基本信息 ========== + @Schema(description = "支付订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Long payOrderId; + @Schema(description = "应付金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000") private Integer payPrice; 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 e06ff9ef8..0a4d2c25c 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 @@ -116,7 +116,7 @@ public class TradeOrderDO extends BaseDO { * true - 已经支付过 * false - 没有支付过 */ - private Boolean payed; + private Boolean payStatus; /** * 付款时间 */ diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderServiceImpl.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderServiceImpl.java index 7c5c18f9f..d06987ba6 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderServiceImpl.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderServiceImpl.java @@ -195,7 +195,7 @@ public class TradeOrderServiceImpl implements TradeOrderService { order.setProductCount(getSumValue(calculateRespBO.getItems(), TradePriceCalculateRespBO.OrderItem::getCount, Integer::sum)); order.setTerminal(TerminalEnum.H5.getTerminal()); // todo 数据来源? // 支付信息 - order.setAdjustPrice(0).setPayed(false); + order.setAdjustPrice(0).setPayStatus(false); // 物流信息 TODO 芋艿:暂时写死物流方式;应该是前端选择的 order.setDeliveryType(DeliveryTypeEnum.EXPRESS.getMode()).setDeliveryStatus(TradeOrderDeliveryStatusEnum.UNDELIVERED.getStatus()); // 退款信息 @@ -262,7 +262,7 @@ public class TradeOrderServiceImpl implements TradeOrderService { // 更新 TradeOrderDO 状态为已支付,等待发货 int updateCount = tradeOrderMapper.updateByIdAndStatus(id, order.getStatus(), - new TradeOrderDO().setStatus(TradeOrderStatusEnum.UNDELIVERED.getStatus()).setPayed(true) + new TradeOrderDO().setStatus(TradeOrderStatusEnum.UNDELIVERED.getStatus()).setPayStatus(true) .setPayTime(LocalDateTime.now()).setPayChannelCode(payOrder.getChannelCode())); if (updateCount == 0) { throw exception(ORDER_UPDATE_PAID_STATUS_NOT_UNPAID); @@ -292,7 +292,7 @@ public class TradeOrderServiceImpl implements TradeOrderService { throw exception(ORDER_NOT_FOUND); } // 校验订单未支付 - if (!TradeOrderStatusEnum.isUnpaid(order.getStatus()) || order.getPayed()) { + if (!TradeOrderStatusEnum.isUnpaid(order.getStatus()) || order.getPayStatus()) { log.error("[validateOrderPaid][order({}) 不处于待支付状态,请进行处理!order 数据是:{}]", id, JsonUtils.toJsonString(order)); throw exception(ORDER_UPDATE_PAID_STATUS_NOT_UNPAID); 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 15a55726d..184d1c178 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 @@ -168,7 +168,7 @@ public class TradeOrderServiceTest extends BaseDbUnitTest { assertNull(tradeOrderDO.getCancelType()); assertEquals(tradeOrderDO.getUserRemark(), "我是备注"); assertNull(tradeOrderDO.getRemark()); - assertFalse(tradeOrderDO.getPayed()); + assertFalse(tradeOrderDO.getPayStatus()); assertNull(tradeOrderDO.getPayTime()); assertEquals(tradeOrderDO.getTotalPrice(), 230); assertEquals(tradeOrderDO.getDiscountPrice(), 0); @@ -249,7 +249,7 @@ public class TradeOrderServiceTest extends BaseDbUnitTest { // mock 数据(TradeOrder) TradeOrderDO order = randomPojo(TradeOrderDO.class, o -> { o.setId(1L).setStatus(TradeOrderStatusEnum.UNPAID.getStatus()); - o.setPayOrderId(10L).setPayed(false).setPayPrice(100).setPayTime(null); + o.setPayOrderId(10L).setPayStatus(false).setPayPrice(100).setPayTime(null); }); tradeOrderMapper.insert(order); // 准备参数 @@ -265,7 +265,7 @@ public class TradeOrderServiceTest extends BaseDbUnitTest { // 断言 TradeOrderDO dbOrder = tradeOrderMapper.selectById(id); assertEquals(dbOrder.getStatus(), TradeOrderStatusEnum.UNDELIVERED.getStatus()); - assertTrue(dbOrder.getPayed()); + assertTrue(dbOrder.getPayStatus()); assertNotNull(dbOrder.getPayTime()); assertEquals(dbOrder.getPayChannelCode(), "wx_pub"); } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/test/resources/sql/create_tables.sql b/yudao-module-mall/yudao-module-trade-biz/src/test/resources/sql/create_tables.sql index 452362eb5..d4ce5cc9f 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/test/resources/sql/create_tables.sql +++ b/yudao-module-mall/yudao-module-trade-biz/src/test/resources/sql/create_tables.sql @@ -10,7 +10,7 @@ CREATE TABLE IF NOT EXISTS "trade_order" ( "product_count" int NOT NULL, "cancel_type" int, "remark" varchar, - "payed" bit NOT NULL, + "pay_status" bit NOT NULL, "pay_time" datetime, "finish_time" datetime, "cancel_time" datetime,