外带不校验用餐人数

This commit is contained in:
2024-09-25 17:35:57 +08:00
parent 0306b9ea67
commit 9919bac0c3

View File

@@ -629,26 +629,6 @@ public class CartService {
if (shopTable == null) {
throw new MsgException("台桌不存在");
}
// 设置餐位费
TbShopInfo shopInfo = mpShopInfoMapper.selectById(shopId);
if (!shopEatTypeInfoDTO.isTakeout() && shopInfo.getIsTableFee() != null && shopInfo.getIsTableFee() == 0) {
seatNum = jsonObject.getInteger("dinersNum");
if (seatNum == null) {
MsgException.throwException("dinersNum不能为空");
}
if (shopTable.getMaxCapacity() < seatNum) {
throw new MsgException("当前台桌最大人数为: " + shopTable.getMaxCapacity());
}
seatCost = shopInfo.getTableFee().multiply(BigDecimal.valueOf(seatNum));
ChoseCountDTO choseCountDTO = new ChoseCountDTO();
choseCountDTO.setTableId(tableId);
choseCountDTO.setShopId(Integer.valueOf(shopId));
choseCountDTO.setNum(seatNum);
choseCountDTO.setUserId(userId);
productService.choseCount(choseCountDTO);
}
}
// 所有订单信息
@@ -852,6 +832,25 @@ public class CartService {
}
// 设置餐位费
TbShopInfo shopInfo = mpShopInfoMapper.selectById(shopId);
if (!shopEatTypeInfoDTO.isTakeout() && shopInfo.getIsTableFee() != null && shopInfo.getIsTableFee() == 0 && (orderInfo == null || orderInfo.getSeatCount() == null)) {
seatNum = jsonObject.getInteger("dinersNum");
if (seatNum == null) {
MsgException.throwException("dinersNum不能为空");
}
if (shopTable.getMaxCapacity() < seatNum) {
throw new MsgException("当前台桌最大人数为: " + shopTable.getMaxCapacity());
}
seatCost = shopInfo.getTableFee().multiply(BigDecimal.valueOf(seatNum));
ChoseCountDTO choseCountDTO = new ChoseCountDTO();
choseCountDTO.setTableId(tableId);
choseCountDTO.setShopId(Integer.valueOf(shopId));
choseCountDTO.setNum(seatNum);
choseCountDTO.setUserId(userId);
productService.choseCount(choseCountDTO);
}
if (orderInfo != null) {
log.info("订单状态:" + orderInfo.getStatus());
if (!"unpaid".equals(orderInfo.getStatus())) {