mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 23:31:52 +08:00
mall + trade:
1、取消订单 mock 接口 2、删除订单 mock 接口
This commit is contained in:
parent
6206dd94e2
commit
6fc724545b
@ -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;
|
||||
|
@ -127,6 +127,22 @@ public class AppTradeOrderController {
|
||||
return success(orderCount);
|
||||
}
|
||||
|
||||
@DeleteMapping("/cancel")
|
||||
@Operation(summary = "取消交易订单")
|
||||
@Parameter(name = "id", description = "交易订单编号")
|
||||
public CommonResult<Boolean> cancelOrder(@RequestParam("id") Long id) {
|
||||
// TODO @芋艿:未实现,mock 用
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除交易订单")
|
||||
@Parameter(name = "id", description = "交易订单编号")
|
||||
public CommonResult<Boolean> deleteOrder(@RequestParam("id") Long id) {
|
||||
// TODO @芋艿:未实现,mock 用
|
||||
return success(true);
|
||||
}
|
||||
|
||||
// ========== 订单项 ==========
|
||||
|
||||
@GetMapping("/item/get")
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -116,7 +116,7 @@ public class TradeOrderDO extends BaseDO {
|
||||
* true - 已经支付过
|
||||
* false - 没有支付过
|
||||
*/
|
||||
private Boolean payed;
|
||||
private Boolean payStatus;
|
||||
/**
|
||||
* 付款时间
|
||||
*/
|
||||
|
@ -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);
|
||||
|
@ -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");
|
||||
}
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user