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