Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
yijiegong 2024-09-23 11:01:42 +08:00
commit 2426a8155e
3 changed files with 15 additions and 9 deletions

View File

@ -59,7 +59,7 @@ public class TbCallQueue {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@Column(name = "cancel_time")
private Date cancelTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@Column(name = "confirm_time")
private Date confirmTime;
@ -84,4 +84,7 @@ public class TbCallQueue {
@Column(name = "create_day")
private String createDay;
@Column(name = "is_postpone")
private Integer isPostpone;
}

View File

@ -163,6 +163,7 @@ public class TbCallServiceImpl implements TbCallService {
.eq(TbCallQueue::getShopId, takeNumberDTO.getShopId())
.in(TbCallQueue::getState, 0, 1)
.eq(TbCallQueue::getCreateDay, DateUtil.today())
.eq(TbCallQueue::getIsPostpone, 0)
.eq(TbCallQueue::getCallTableId, takeNumberDTO.getCallTableId()).one();
if (callQueue != null) {
throw new BadRequestException("当前用户已取号");
@ -182,6 +183,7 @@ public class TbCallServiceImpl implements TbCallService {
.eq(TbCallQueue::getPhone, takeNumberDTO.getPhone())
.eq(TbCallQueue::getShopId, takeNumberDTO.getShopId())
.eq(TbCallQueue::getCreateDay, DateUtil.today())
.eq(TbCallQueue::getIsPostpone, 0)
.eq(TbCallQueue::getCallTableId, takeNumberDTO.getCallTableId()).one();
if (callQueue != null) {
throw new BadRequestException("当前用户已取号");
@ -323,6 +325,8 @@ public class TbCallServiceImpl implements TbCallService {
break;
case 3:
callQueue.setPassTime(DateUtil.date());
// 已经顺延
callQueue.setIsPostpone(1);
TbShopInfo shopInfo = shopInfoRepository.findById(callQueue.getShopId()).orElse(null);
if (shopInfo == null) {
throw new BadRequestException("店铺信息不存在");
@ -337,7 +341,7 @@ public class TbCallServiceImpl implements TbCallService {
Integer postponeNum = callTable.getPostponeNum();
// 判断是否需要顺延
if (isPostpone != null && isPostpone == 1 && postponeNum != null && postponeNum > 0) {
if (callQueue.getIsPostpone() == 0 && isPostpone != null && isPostpone == 1 && postponeNum != null && postponeNum > 0) {
// 查询当前桌以及顺延桌数
List<TbCallQueue> current = callQueueService.lambdaQuery()
.eq(TbCallQueue::getCallTableId, callQueue.getCallTableId())

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;