创建订单修改餐位费校验
This commit is contained in:
@@ -1151,14 +1151,9 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
||||
List<TbOrderDetail> addOrderDetails = new ArrayList<>();
|
||||
|
||||
|
||||
BigDecimal mealAmount = null;
|
||||
Integer mealNum = null;
|
||||
|
||||
boolean hasNewInfo = false;
|
||||
for (TbCashierCart cashierCart : cashierCarts) {
|
||||
if ("-999".equals(cashierCart.getProductId())) {
|
||||
mealAmount = cashierCart.getTotalAmount();
|
||||
mealNum = cashierCart.getNumber();
|
||||
}
|
||||
if (!"return".equals(cashierCart.getStatus())) {
|
||||
totalAmount = totalAmount.add(cashierCart.getTotalAmount());
|
||||
packAMount = packAMount.add(cashierCart.getPackFee());
|
||||
@@ -1203,11 +1198,6 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
||||
orderDetails.add(orderDetail);
|
||||
}
|
||||
|
||||
if (shopInfo.getIsTableFee() != null && shopInfo.getIsTableFee() == 0
|
||||
&& !shopEatTypeInfoDTO.isTakeout()
|
||||
&& mealAmount == null) {
|
||||
throw new BadRequestException("请选择用餐人数");
|
||||
}
|
||||
|
||||
// 查询订单
|
||||
TbOrderInfo orderInfo = null;
|
||||
@@ -1232,8 +1222,10 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
||||
orderInfo.setTradeDay(DateUtils.getDay());
|
||||
orderInfo.setUseType(createOrderDTO.getUseType());
|
||||
orderInfo.setCreatedAt(DateUtil.current());
|
||||
orderInfo.setSeatAmount(mealAmount);
|
||||
orderInfo.setSeatCount(mealNum);
|
||||
if (seatCart != null) {
|
||||
orderInfo.setSeatAmount(seatCart.getTotalAmount());
|
||||
orderInfo.setSeatCount(seatCart.getNumber());
|
||||
}
|
||||
if (StrUtil.isNotBlank(createOrderDTO.getVipUserId())) {
|
||||
orderInfo.setUserId(createOrderDTO.getVipUserId());
|
||||
}
|
||||
@@ -1272,8 +1264,10 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
||||
if (StrUtil.isNotBlank(createOrderDTO.getVipUserId())) {
|
||||
orderInfo.setUserId(createOrderDTO.getVipUserId());
|
||||
}
|
||||
orderInfo.setSeatAmount(mealAmount);
|
||||
orderInfo.setSeatCount(mealNum);
|
||||
if (seatCart != null) {
|
||||
orderInfo.setSeatAmount(seatCart.getTotalAmount());
|
||||
orderInfo.setSeatCount(seatCart.getNumber());
|
||||
}
|
||||
orderInfo.setSendType(shopEatTypeInfoDTO.getSendType());
|
||||
TbMerchantAccount merchantAccount = merchantAccountMapper.selectOne(new LambdaQueryWrapper<TbMerchantAccount>()
|
||||
.eq(TbMerchantAccount::getShopId, createOrderDTO.getShopId())
|
||||
@@ -1371,7 +1365,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
||||
.set(TbShopTable::getProductNum, cashierCarts.size())
|
||||
.set(TbShopTable::getTotalAmount, orderInfo.getOrderAmount())
|
||||
.set(TbShopTable::getRealAmount, orderInfo.getOrderAmount())
|
||||
.set(TbShopTable::getUseNum, mealNum)
|
||||
.set(TbShopTable::getUseNum, seatCart != null ? seatCart.getNumber() : null)
|
||||
.set(TbShopTable::getStatus, TableStateEnum.USING.getState());
|
||||
if (isFirst) {
|
||||
wrapper.set(TbShopTable::getUseTime, DateUtil.date());
|
||||
|
||||
Reference in New Issue
Block a user