mirror of
https://gitee.com/youlaitech/youlai-mall.git
synced 2024-12-23 05:00:25 +08:00
update mall-oms/oms-boot/src/main/java/com/youlai/mall/oms/service/impl/OrderServiceImpl.java.
fix(OrderServiceImpl.java): 解决服务调用失败, 导致重新提交订单时, 一直报 "订单不可重复提交"
This commit is contained in:
parent
2a7351d69f
commit
9c5b51efa8
@ -158,6 +158,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OmsOrder> impleme
|
||||
Long execute = this.redisTemplate.execute(redisScript, Collections.singletonList(ORDER_TOKEN_PREFIX + orderToken), orderToken);
|
||||
Assert.isTrue(execute.equals(1l), "订单不可重复提交");
|
||||
|
||||
OmsOrder order;
|
||||
try {
|
||||
// 订单验价
|
||||
Long orderTotalAmount = orderSubmitForm.getTotalAmount();
|
||||
boolean checkResult = this.checkOrderPrice(orderTotalAmount, orderItems);
|
||||
@ -167,7 +169,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OmsOrder> impleme
|
||||
this.lockStock(orderToken, orderItems);
|
||||
|
||||
// 创建订单
|
||||
OmsOrder order = new OmsOrder().setOrderSn(orderToken) // 把orderToken赋值给订单编号
|
||||
order = new OmsOrder().setOrderSn(orderToken) // 把orderToken赋值给订单编号
|
||||
.setStatus(OrderStatusEnum.PENDING_PAYMENT.getCode())
|
||||
.setSourceType(OrderTypeEnum.APP.getCode())
|
||||
.setMemberId(MemberUtils.getMemberId())
|
||||
@ -193,7 +195,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OmsOrder> impleme
|
||||
}
|
||||
}
|
||||
Assert.isTrue(result, "订单提交失败");
|
||||
|
||||
} catch (Exception e) {
|
||||
redisTemplate.opsForValue().set(ORDER_TOKEN_PREFIX + orderToken, orderToken);
|
||||
throw new BizException(e);
|
||||
}
|
||||
// 成功响应返回值构建
|
||||
OrderSubmitVO submitVO = new OrderSubmitVO();
|
||||
submitVO.setOrderId(order.getId());
|
||||
|
Loading…
Reference in New Issue
Block a user