转台相关接口

This commit is contained in:
张松
2024-12-10 15:17:19 +08:00
parent c82dcd3496
commit cbe190ea71
6 changed files with 57 additions and 3 deletions

View File

@@ -239,6 +239,11 @@ public class TbPlaceController {
return ResponseEntity.ok(tbShopTableService.choseCount(choseCountDTO));
}
@PutMapping("/switch")
public ResponseEntity<?> switchTable(@Validated @RequestBody SwitchTableDTO switchTableDTO) {
return ResponseEntity.ok(tbShopTableService.switchTable(switchTableDTO));
}
@PutMapping("/updateVip")
@ApiOperation("代客下单 查询购物车 /shop/table")
public ResponseEntity<Object> updateVip(@Validated @RequestBody UpdateVipDTO updateVipDTO) {

View File

@@ -0,0 +1,22 @@
package cn.ysk.cashier.dto.shoptable;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
@Data
public class SwitchTableDTO {
@NotNull
private Integer shopId;
@NotEmpty(message = "取餐码不为空")
private String masterId;
private Integer orderId;
private List<Integer> cartIds;
private boolean isFull;
@NotEmpty(message = "当前台桌id不为空")
private String currentTableId;
@NotEmpty(message = "目标台桌id不为空")
private String targetTableId;
}

View File

@@ -69,7 +69,15 @@ public interface MpCashierCartService extends IService<TbCashierCart> {
List<TbCashierCart> selectByShopEatType(ShopEatTypeInfoDTO shopEatTypeInfoDTO, String masterId, TableConstant.OrderInfo.Status... statuses);
List<TbCashierCart> selectByShopEatTypeAndOrderId(ShopEatTypeInfoDTO shopEatTypeInfoDTO, String masterId, Integer orderId, TableConstant.OrderInfo.Status... statuses);
/**
* 根据就餐模式查询购物车信息
* @param shopEatTypeInfoDTO 就餐模式
* @param masterId 取餐码
* @param orderId 订单id
* @param onlySearchPc 只查询pc
* @param statuses 状态
*/
List<TbCashierCart> selectByShopEatTypeAndOrderId(ShopEatTypeInfoDTO shopEatTypeInfoDTO, String masterId, Integer orderId, boolean onlySearchPc, TableConstant.OrderInfo.Status... statuses);
/**
* 根据订单id和状态获取购物车数据

View File

@@ -139,7 +139,8 @@ public class MpCashierCartServiceImpl extends ServiceImpl<TbCashierCartMapper, T
}
@Override
public List<TbCashierCart> selectByShopEatTypeAndOrderId(ShopEatTypeInfoDTO shopEatTypeInfoDTO, String masterId, Integer orderId, TableConstant.OrderInfo.Status... statuses) {
public List<TbCashierCart> selectByShopEatTypeAndOrderId(ShopEatTypeInfoDTO shopEatTypeInfoDTO, String masterId,
Integer orderId, boolean onlySearchPc, TableConstant.OrderInfo.Status... statuses) {
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
.eq(TbCashierCart::getShopId, shopEatTypeInfoDTO.getShopId())
.eq(TbCashierCart::getUseType, shopEatTypeInfoDTO.getUseType())
@@ -157,6 +158,10 @@ public class MpCashierCartServiceImpl extends ServiceImpl<TbCashierCartMapper, T
.or().isNull(TbCashierCart::getOrderId));
}
if (onlySearchPc) {
queryWrapper.ne(TbCashierCart::getPlatformType, "mimiapp");
}
// 非堂食校验台桌状态
if (shopEatTypeInfoDTO.isTakeout()) {
queryWrapper.and(q -> q.isNull(TbCashierCart::getTableId).or().eq(TbCashierCart::getTableId, ""))

View File

@@ -3318,7 +3318,8 @@ public class TbShopTableServiceImpl implements TbShopTableService {
public Object waitCall(WaitCallDTO waitCallDTO) {
ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(waitCallDTO.getShopId(), waitCallDTO.getTableId(), waitCallDTO.getUseType());
List<TbCashierCart> cashierCarts = mpCashierCartService.selectByShopEatTypeAndOrderId(shopEatTypeInfoDTO,
waitCallDTO.getMasterId(), waitCallDTO.getOrderId(), TableConstant.OrderInfo.Status.CREATE, TableConstant.OrderInfo.Status.RETURN, TableConstant.OrderInfo.Status.CLOSED);
waitCallDTO.getMasterId(), waitCallDTO.getOrderId(), false, TableConstant.OrderInfo.Status.CREATE,
TableConstant.OrderInfo.Status.RETURN, TableConstant.OrderInfo.Status.CLOSED);
if (cashierCarts.isEmpty()) {
throw new BadRequestException("购物车为空");
}
@@ -3336,4 +3337,11 @@ public class TbShopTableServiceImpl implements TbShopTableService {
mpCashierCartService.updateFieldValByIds(waitCallDTO.getShopId(), cartIds, TbCashierCart::getIsWaitCall, waitCallDTO.getIsWaitCall());
return mpOrderDetailService.updateFieldByCartId(TbOrderDetail::getIsWaitCall, waitCallDTO.getIsWaitCall(), cartIds);
}
@Override
public Object switchTable(SwitchTableDTO switchTableDTO) {
// 查询当前台桌信息
mpCashierCartService.selectByShopEatTypeAndOrderId()
return null;
}
}

View File

@@ -169,4 +169,10 @@ public interface TbShopTableService {
Object checkCoupon(ThirdCouponCheckDTO checkDTO);
Object waitCall(WaitCallDTO waitCallDTO);
/**
* 台桌转台
* @param switchTableDTO 转台参数
*/
Object switchTable(SwitchTableDTO switchTableDTO);
}