代客下单调整

This commit is contained in:
SongZhang 2024-09-26 16:22:02 +08:00
parent a5c11fee41
commit efb7e64323
1 changed files with 23 additions and 5 deletions

View File

@ -144,9 +144,18 @@ public class TbShopTableServiceImpl implements TbShopTableService {
return orderInfo;
}
/**
* 校验就餐模式是否存在并返回就餐类型信息
* @param tableId 台桌id
* @param shopId 店铺id
* @return 就餐类型信息
*/
public ShopEatTypeInfoDTO checkEatModel(Object tableId, Object shopId) {
String eatModel = StrUtil.isBlank(tableId.toString()) ? ShopInfoEatModelEnum.TAKE_OUT.getValue() : ShopInfoEatModelEnum.DINE_IN.getValue();
return getShopEatTypeInfoDTO(shopId, eatModel);
}
private ShopEatTypeInfoDTO checkEatModel(Integer shopId, String useType) {
String eatModel = OrderUseTypeEnum.TAKEOUT.getValue().equals(useType) ? ShopInfoEatModelEnum.TAKE_OUT.getValue() : ShopInfoEatModelEnum.DINE_IN.getValue();
private ShopEatTypeInfoDTO getShopEatTypeInfoDTO(Object shopId, String eatModel) {
TbShopInfo shopInfo = mpShopInfoMapper.selectOne(new LambdaQueryWrapper<TbShopInfo>()
.eq(TbShopInfo::getId, shopId)
.eq(TbShopInfo::getStatus, 1));
@ -170,6 +179,12 @@ public class TbShopTableServiceImpl implements TbShopTableService {
}
private ShopEatTypeInfoDTO checkEatModel(Integer shopId, String useType) {
String eatModel = OrderUseTypeEnum.TAKEOUT.getValue().equals(useType) ? ShopInfoEatModelEnum.TAKE_OUT.getValue() : ShopInfoEatModelEnum.DINE_IN.getValue();
return getShopEatTypeInfoDTO(shopId, eatModel);
}
@Override
public Map<String, Object> queryAll(TbShopTableQueryCriteria criteria, Pageable pageable) {
if (criteria.getAreaId() == 0) {
@ -327,7 +342,8 @@ public class TbShopTableServiceImpl implements TbShopTableService {
throw new BadRequestException("购物车商品不存在");
}
int currentPlaceNum = getCurrentPlaceNum(tbCashierCart.getTableId().toString(), tbCashierCart.getShopId(), tbCashierCart.getUseType());
ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(updateCartDTO.getShopId(), tbCashierCart.getUseType());
int currentPlaceNum = getCurrentPlaceNum(tbCashierCart.getTableId().toString(), tbCashierCart.getShopId(), shopEatTypeInfoDTO);
if (tbCashierCart.getPlaceNum() != null && !tbCashierCart.getPlaceNum().equals(currentPlaceNum)) {
throw new BadRequestException("已下单商品仅支持退单操作");
@ -543,7 +559,9 @@ public class TbShopTableServiceImpl implements TbShopTableService {
@Override
public void removeCart(RemoveCartDTO removeCartDTO) {
int currentPlaceNum = getCurrentPlaceNum(removeCartDTO.getTableId() == null ? "" : removeCartDTO.getTableId().toString(), removeCartDTO.getShopId().toString(), removeCartDTO.getUseType());
ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(removeCartDTO.getTableId(), removeCartDTO.getShopId());
int currentPlaceNum = getCurrentPlaceNum(removeCartDTO.getTableId() == null ? "" : removeCartDTO.getTableId().toString(), removeCartDTO.getShopId().toString(), shopEatTypeInfoDTO);
// 会员点单
TbCashierCart cashierCart = cashierCartMapper.selectOne(new LambdaQueryWrapper<TbCashierCart>()
.eq(TbCashierCart::getShopId, removeCartDTO.getShopId())
@ -1095,7 +1113,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
BigDecimal feeAmount = BigDecimal.ZERO;
BigDecimal saleAmount = BigDecimal.ZERO;
// 当前下单次数
int placeNum = getCurrentPlaceNum(createOrderDTO.getTableId(), String.valueOf(createOrderDTO.getShopId()), createOrderDTO.getUseType());
int placeNum = getCurrentPlaceNum(createOrderDTO.getTableId(), String.valueOf(createOrderDTO.getShopId()), shopEatTypeInfoDTO);
List<TbOrderDetail> orderDetails = new ArrayList<>();
BigDecimal mealAmount = null;