额外的异常
This commit is contained in:
@@ -264,7 +264,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public OrderInfo createOrder(OrderInfoAddDTO param) {
|
||||
public OrderInfo createOrder(OrderInfoAddDTO param) throws ValidateException{
|
||||
ShopInfo shopInfo = shopInfoService.getById(param.getShopId());
|
||||
AssertUtil.isNull(shopInfo, "生成订单失败,店铺信息不存在");
|
||||
if (!shopInfo.getEatModel().contains(param.getDineMode())) {
|
||||
@@ -1596,13 +1596,13 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean cancelledOrder(Long shopId, Long orderId) {
|
||||
public Boolean cancelledOrder(Long shopId, Long orderId) throws OrderCancelException {
|
||||
OrderInfo orderInfo = getById(orderId);
|
||||
if (orderInfo == null) {
|
||||
throw new ApiNotPrintException("订单不存在");
|
||||
throw new OrderCancelException("订单不存在");
|
||||
}
|
||||
if (!OrderStatusEnums.UNPAID.getCode().equals(orderInfo.getStatus())) {
|
||||
throw new ApiNotPrintException("订单不可取消");
|
||||
throw new OrderCancelException("订单不可取消");
|
||||
}
|
||||
updateChain()
|
||||
.set(OrderInfo::getStatus, OrderStatusEnums.CANCELLED.getCode())
|
||||
|
||||
Reference in New Issue
Block a user