就餐模式获取调整

This commit is contained in:
2024-09-27 09:41:54 +08:00
parent b4f227878a
commit cf9ff5c380
6 changed files with 19 additions and 18 deletions

View File

@@ -120,7 +120,7 @@ public class TbPlaceController {
public ResponseEntity<Object> getCart( public ResponseEntity<Object> getCart(
@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer size, @RequestParam(defaultValue = "10") Integer size,
@RequestParam(required = false) Long tableId, @RequestParam(required = false) String tableId,
@RequestParam Integer shopId, @RequestParam Integer shopId,
@RequestParam String masterId, @RequestParam String masterId,
@RequestParam String useType @RequestParam String useType
@@ -146,7 +146,7 @@ public class TbPlaceController {
@ApiOperation("代客下单 ") @ApiOperation("代客下单 ")
public ResponseEntity<Object> getMasterId( public ResponseEntity<Object> getMasterId(
@RequestParam Integer shopId, @RequestParam Integer shopId,
@RequestParam Long tableId, @RequestParam String tableId,
@RequestParam(defaultValue = "") String useType @RequestParam(defaultValue = "") String useType
) { ) {
return ResponseEntity.ok(tbShopTableService.getMasterId(shopId, tableId, useType)); return ResponseEntity.ok(tbShopTableService.getMasterId(shopId, tableId, useType));

View File

@@ -13,5 +13,5 @@ import javax.validation.constraints.NotNull;
private String shopId; private String shopId;
@NotEmpty @NotEmpty
private String useType; private String useType;
private Long tableId; private String tableId;
} }

View File

@@ -12,7 +12,7 @@ public class RemoveCartDTO {
private Integer cartId; private Integer cartId;
@NotNull @NotNull
private Integer shopId; private Integer shopId;
private Long tableId; private String tableId;
@NotBlank @NotBlank
private String useType; private String useType;
} }

View File

@@ -14,5 +14,5 @@ public class ShopEatTypeInfoDTO {
private TbShopInfo shopInfo; private TbShopInfo shopInfo;
private String useType; private String useType;
private Object shopId; private Object shopId;
private Object tableId; private String tableId;
} }

View File

@@ -155,12 +155,12 @@ public class TbShopTableServiceImpl implements TbShopTableService {
* @param shopId 店铺id * @param shopId 店铺id
* @return 就餐类型信息 * @return 就餐类型信息
*/ */
public ShopEatTypeInfoDTO checkEatModel(Object shopId, Object tableId) { public ShopEatTypeInfoDTO checkEatModel(Object shopId, String tableId) {
String eatModel = StrUtil.isBlank(tableId == null ? "" : tableId.toString()) ? ShopInfoEatModelEnum.TAKE_OUT.getValue() : ShopInfoEatModelEnum.DINE_IN.getValue(); String eatModel = StrUtil.isBlank(tableId) ? ShopInfoEatModelEnum.TAKE_OUT.getValue() : ShopInfoEatModelEnum.DINE_IN.getValue();
return getShopEatTypeInfoDTO(shopId, eatModel, tableId); return getShopEatTypeInfoDTO(shopId, eatModel, tableId);
} }
private ShopEatTypeInfoDTO getShopEatTypeInfoDTO(Object shopId, String eatModel, Object tableId) { private ShopEatTypeInfoDTO getShopEatTypeInfoDTO(Object shopId, String eatModel, String tableId) {
TbShopInfo shopInfo = mpShopInfoMapper.selectOne(new LambdaQueryWrapper<TbShopInfo>() TbShopInfo shopInfo = mpShopInfoMapper.selectOne(new LambdaQueryWrapper<TbShopInfo>()
.eq(TbShopInfo::getId, shopId) .eq(TbShopInfo::getId, shopId)
.eq(TbShopInfo::getStatus, 1)); .eq(TbShopInfo::getStatus, 1));
@@ -235,7 +235,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
itemMap.put("tableId", date.getQrcode()); itemMap.put("tableId", date.getQrcode());
} }
ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(criteria.getShopId(), criteria.getQrcode()); ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(criteria.getShopId(), criteria.getQrcode() != null ? String.valueOf(criteria.getQrcode()) : "");
TbOrderInfo orderInfo = getCurrentOrder(shopEatTypeInfoDTO); TbOrderInfo orderInfo = getCurrentOrder(shopEatTypeInfoDTO);
itemMap.put("orderId", orderInfo == null ? null : orderInfo.getId()); itemMap.put("orderId", orderInfo == null ? null : orderInfo.getId());
itemMap.put("useType", orderInfo == null ? null : orderInfo.getUseType()); itemMap.put("useType", orderInfo == null ? null : orderInfo.getUseType());
@@ -342,7 +342,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
throw new BadRequestException("购物车商品不存在"); throw new BadRequestException("购物车商品不存在");
} }
ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(updateCartDTO.getShopId(), tbCashierCart.getUseType()); ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(updateCartDTO.getShopId(), String.valueOf(tbCashierCart.getTableId()));
int currentPlaceNum = getCurrentPlaceNum(shopEatTypeInfoDTO); int currentPlaceNum = getCurrentPlaceNum(shopEatTypeInfoDTO);
if (tbCashierCart.getPlaceNum() != null && !tbCashierCart.getPlaceNum().equals(currentPlaceNum)) { if (tbCashierCart.getPlaceNum() != null && !tbCashierCart.getPlaceNum().equals(currentPlaceNum)) {
@@ -419,7 +419,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
@Override @Override
public TbCashierCart addCartForUser(AddCartDTO addCartDTO) { public TbCashierCart addCartForUser(AddCartDTO addCartDTO) {
ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(addCartDTO.getShopId(), addCartDTO.getUseType()); ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(addCartDTO.getShopId(), addCartDTO.getTableId());
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());
@@ -703,9 +703,9 @@ public class TbShopTableServiceImpl implements TbShopTableService {
} }
@Override @Override
public Map<String, Object> getCart(Long tableId, Integer page, public Map<String, Object> getCart(String tableId, Integer page,
Integer size, Integer shopId, String masterId, String useType) { Integer size, Integer shopId, String masterId, String useType) {
ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(shopId, useType); ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(shopId, tableId);
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>() LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
.in(TbCashierCart::getStatus, "create", "return") .in(TbCashierCart::getStatus, "create", "return")
.eq(TbCashierCart::getShopId, shopId) .eq(TbCashierCart::getShopId, shopId)
@@ -1004,7 +1004,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
private final StringRedisTemplate redisTemplate; private final StringRedisTemplate redisTemplate;
@Override @Override
public JSONObject getMasterId(Integer shopId, Long tableId,String useType) { public JSONObject getMasterId(Integer shopId, String tableId,String useType) {
String account = tokenProvider.getSubject(); String account = tokenProvider.getSubject();
if (account == null) { if (account == null) {
throw new BadRequestException("token解析失败"); throw new BadRequestException("token解析失败");
@@ -1048,7 +1048,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
if (shopInfo == null) throw new BadRequestException("店铺信息不存在"); if (shopInfo == null) throw new BadRequestException("店铺信息不存在");
// 就餐模式信息 // 就餐模式信息
ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(createOrderDTO.getShopId(), createOrderDTO.getUseType()); ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(createOrderDTO.getShopId(), createOrderDTO.getTableId());
// 传递orderId直接取否则取当前缓存id // 传递orderId直接取否则取当前缓存id
Integer orderId = shopEatTypeInfoDTO.isDineInAfter() ? Integer orderId = shopEatTypeInfoDTO.isDineInAfter() ?
@@ -1638,7 +1638,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
@Override @Override
public Object choseTable(ChoseTableDTO choseTableDTO) { public Object choseTable(ChoseTableDTO choseTableDTO) {
String masterId = getMasterId(choseTableDTO.getShopId(), Long.valueOf(choseTableDTO.getNewTableId()), null).getString("masterId"); String masterId = getMasterId(choseTableDTO.getShopId(), choseTableDTO.getNewTableId(), null).getString("masterId");
TbShopTable shopTable = mpShopTableMapper.selectOne(new LambdaQueryWrapper<TbShopTable>() TbShopTable shopTable = mpShopTableMapper.selectOne(new LambdaQueryWrapper<TbShopTable>()
.eq(TbShopTable::getQrcode, choseTableDTO.getNewTableId()) .eq(TbShopTable::getQrcode, choseTableDTO.getNewTableId())
@@ -1710,6 +1710,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
.eq(TbCashierCart::getSkuId, "-999") .eq(TbCashierCart::getSkuId, "-999")
.eq(TbCashierCart::getUseType, choseCountDTO.getUseType()) .eq(TbCashierCart::getUseType, choseCountDTO.getUseType())
.eq(TbCashierCart::getTradeDay, cn.ysk.cashier.utils.DateUtils.getDay()) .eq(TbCashierCart::getTradeDay, cn.ysk.cashier.utils.DateUtils.getDay())
.eq(TbCashierCart::getStatus, "create")
.eq(TbCashierCart::getTableId, choseCountDTO.getTableId()); .eq(TbCashierCart::getTableId, choseCountDTO.getTableId());
TbCashierCart tbCashierCart = cashierCartMapper.selectOne(query); TbCashierCart tbCashierCart = cashierCartMapper.selectOne(query);

View File

@@ -104,7 +104,7 @@ public interface TbShopTableService {
void clearCart(ClearCartDTO clearCartDTO); void clearCart(ClearCartDTO clearCartDTO);
Map<String, Object> getCart(Long tableId, Integer page, Integer size, Integer shopId, String masterId, String useType); Map<String, Object> getCart(String tableId, Integer page, Integer size, Integer shopId, String masterId, String useType);
TbCashierCart updateCart(UpdateCartDTO updateCartDTO); TbCashierCart updateCart(UpdateCartDTO updateCartDTO);
@@ -112,7 +112,7 @@ public interface TbShopTableService {
Object createOrder(CreateOrderDTO createOrderDTO, boolean addMasterId, boolean isPrint); Object createOrder(CreateOrderDTO createOrderDTO, boolean addMasterId, boolean isPrint);
JSONObject getMasterId(Integer shopId, Long tableId, String useType); JSONObject getMasterId(Integer shopId, String tableId, String useType);
Object pending(PendingDTO pendingDTO); Object pending(PendingDTO pendingDTO);