添加就餐模式接口

This commit is contained in:
2024-09-25 14:26:31 +08:00
parent 3ca5f70e9a
commit 980aad9714
3 changed files with 46 additions and 4 deletions

View File

@@ -8,15 +8,13 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chaozhanggui.system.cashierservice.dao.*;
import com.chaozhanggui.system.cashierservice.entity.*;
import com.chaozhanggui.system.cashierservice.entity.Enum.PlatformTypeEnum;
import com.chaozhanggui.system.cashierservice.entity.Enum.ShopInfoEatModelEnum;
import com.chaozhanggui.system.cashierservice.entity.dto.ChoseCountDTO;
import com.chaozhanggui.system.cashierservice.entity.dto.HomeDto;
import com.chaozhanggui.system.cashierservice.entity.dto.QuerySpecDTO;
import com.chaozhanggui.system.cashierservice.entity.dto.ShopEatTypeInfoDTO;
import com.chaozhanggui.system.cashierservice.entity.dto.*;
import com.chaozhanggui.system.cashierservice.entity.vo.*;
import com.chaozhanggui.system.cashierservice.exception.MsgException;
import com.chaozhanggui.system.cashierservice.mapper.MpCashierCartMapper;
@@ -926,4 +924,24 @@ public class ProductService {
return tbCashierCart;
}
public Object choseEatModel(ChoseEatModelDTO choseTableDTO) {
ShopEatTypeInfoDTO shopEatTypeInfoDTO = shopUtils.checkEatModel(choseTableDTO.getTableId(), choseTableDTO.getShopId());
if (!shopEatTypeInfoDTO.isTakeout()) {
TbShopTable shopTable = mpShopTableMapper.selectOne(new LambdaQueryWrapper<TbShopTable>()
.notIn(TbShopTable::getStatus, "closed", "cleaning")
.eq(TbShopTable::getQrcode, choseTableDTO.getTableId()));
if (shopTable == null) {
throw new MsgException("台桌未开台或不存在");
}
}
return mpCashierCartMapper.update(null, new LambdaUpdateWrapper<TbCashierCart>()
.eq(TbCashierCart::getShopId, choseTableDTO.getShopId())
.eq(TbCashierCart::getUserId, choseTableDTO.getUserId())
.isNull(TbCashierCart::getUseType)
.eq(TbCashierCart::getStatus, "create")
.set(TbCashierCart::getUseType, shopEatTypeInfoDTO.getUseType())) ;
}
}