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