代客下单获取下单次数增加useType

This commit is contained in:
SongZhang 2024-09-23 10:25:09 +08:00
parent 0fdae37924
commit 272ebd6663
1 changed files with 6 additions and 7 deletions

View File

@ -267,7 +267,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
throw new BadRequestException("购物车商品不存在");
}
int currentPlaceNum = getCurrentPlaceNum(tbCashierCart.getTableId().toString(), tbCashierCart.getShopId());
int currentPlaceNum = getCurrentPlaceNum(tbCashierCart.getTableId().toString(), tbCashierCart.getShopId(), tbCashierCart.getUseType());
if (tbCashierCart.getPlaceNum() != null && !tbCashierCart.getPlaceNum().equals(currentPlaceNum)) {
throw new BadRequestException("已下单商品仅支持退单操作");
@ -330,7 +330,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
return shopTable;
}
private int getCurrentPlaceNum(String tableId, String shopId) {
private int getCurrentPlaceNum(String tableId, String shopId, String useType) {
String currentOrderKey = RedisConstant.getCurrentOrderKey(tableId,
shopId);
String orderId = redisTemplate.opsForValue().get(currentOrderKey);
@ -338,7 +338,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
return 1;
}
TbOrderInfo orderInfo = orderInfoMapper.selectOne(new LambdaQueryWrapper<TbOrderInfo>()
.eq(TbOrderInfo::getUseType, "postPay")
.eq(TbOrderInfo::getUseType, useType)
.eq(TbOrderInfo::getId, orderId).select(TbOrderInfo::getPlaceNum));
return orderInfo == null ? 1 : orderInfo.getPlaceNum() + 1;
}
@ -349,7 +349,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
checkTableIsOpen(addCartDTO.getTableId());
}
int currentPlaceNum = getCurrentPlaceNum(addCartDTO.getTableId(), addCartDTO.getShopId().toString());
int currentPlaceNum = getCurrentPlaceNum(addCartDTO.getTableId(), addCartDTO.getShopId().toString(), addCartDTO.getUseType());
TbProductSku productSku = productMapper.selectSkuByIdAndShopId(addCartDTO.getShopId(), addCartDTO.getSkuId());
TbProduct product = productMapper.selectByIdAndShopId(addCartDTO.getShopId(), addCartDTO.getProductId());
@ -485,7 +485,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
@Override
public void removeCart(RemoveCartDTO removeCartDTO) {
int currentPlaceNum = getCurrentPlaceNum(removeCartDTO.getTableId() == null ? "" : removeCartDTO.getTableId().toString(), removeCartDTO.getShopId().toString());
int currentPlaceNum = getCurrentPlaceNum(removeCartDTO.getTableId() == null ? "" : removeCartDTO.getTableId().toString(), removeCartDTO.getShopId().toString(), removeCartDTO.getUseType());
// 会员点单
TbCashierCart cashierCart = cashierCartMapper.selectOne(new LambdaQueryWrapper<TbCashierCart>()
.eq(TbCashierCart::getShopId, removeCartDTO.getShopId())
@ -528,7 +528,6 @@ public class TbShopTableServiceImpl implements TbShopTableService {
public void returnCart(ReturnOrderDTO removeCartDTO) {
rabbitMsgUtils.printDishesReturnTicket(4450, 9313);
int currentPlaceNum = getCurrentPlaceNum(removeCartDTO.getTableId().toString(), removeCartDTO.getShopId().toString());
// 会员点单
TbCashierCart cashierCart = cashierCartMapper.selectOne(new LambdaQueryWrapper<TbCashierCart>()
.eq(TbCashierCart::getShopId, removeCartDTO.getShopId())
@ -1001,7 +1000,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
BigDecimal feeAmount = BigDecimal.ZERO;
BigDecimal saleAmount = BigDecimal.ZERO;
// 当前下单次数
int placeNum = StrUtil.isNotBlank(createOrderDTO.getTableId()) ? getCurrentPlaceNum(createOrderDTO.getTableId(), createOrderDTO.getShopId().toString()) : 1;
int placeNum = StrUtil.isNotBlank(createOrderDTO.getTableId()) ? getCurrentPlaceNum(createOrderDTO.getTableId(), createOrderDTO.getShopId().toString(), createOrderDTO.getUseType()) : 1;
List<TbOrderDetail> orderDetails = new ArrayList<>();
Integer mealNum = null;