取消不报错

This commit is contained in:
wangw 2025-11-12 13:42:42 +08:00
parent 481b0202da
commit fcc33b28e1
2 changed files with 9 additions and 5 deletions

View File

@ -31,7 +31,7 @@ public class OrderDetailServiceImpl extends ServiceImpl<OrderDetailMapper, Order
@Override
public void updateOrderDetailStatus(Long orderId,String status) {
OrderDetail orderDetail = getById(orderId);
OrderDetail orderDetail = new OrderDetail();
orderDetail.setStatus(status);
update(orderDetail, QueryWrapper.create()
.eq(OrderDetail::getOrderId,orderId)

View File

@ -1599,10 +1599,12 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
public Boolean cancelledOrder(Long shopId, Long orderId) throws OrderCancelException {
OrderInfo orderInfo = getById(orderId);
if (orderInfo == null) {
throw new OrderCancelException("订单不存在");
// throw new OrderCancelException("订单不存在");
return true;
}
if (!OrderStatusEnums.UNPAID.getCode().equals(orderInfo.getStatus())) {
throw new OrderCancelException("订单不可取消");
// throw new OrderCancelException("订单不可取消");
return true;
}
updateChain()
.set(OrderInfo::getStatus, OrderStatusEnums.CANCELLED.getCode())
@ -1636,10 +1638,12 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
public Boolean cancelledPlaceOrder(Long shopId, Long orderId, Integer placeNum) {
OrderInfo orderInfo = getById(orderId);
if (orderInfo == null) {
throw new OrderCancelException("订单不存在");
// throw new OrderCancelException("订单不存在");
return true;
}
if (!OrderStatusEnums.UNPAID.getCode().equals(orderInfo.getStatus())) {
throw new OrderCancelException("订单不可取消");
// throw new OrderCancelException("订单不可取消");
return true;
}
if (orderInfo.getPlaceNum().equals(1)) {
updateChain()