添加就餐模式接口
This commit is contained in:
@@ -4,6 +4,7 @@ package com.chaozhanggui.system.cashierservice.controller;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ChoseCountDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ChoseEatModelDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.QuerySpecDTO;
|
||||
import com.chaozhanggui.system.cashierservice.service.CartService;
|
||||
import com.chaozhanggui.system.cashierservice.service.ProductService;
|
||||
@@ -107,6 +108,13 @@ public class ProductController {
|
||||
return Result.success(CodeEnum.SUCCESS, productService.choseCount(choseCountDTO));
|
||||
}
|
||||
|
||||
@PostMapping("/choseEatModel")
|
||||
public Result choseEatModel(
|
||||
@Validated @RequestBody ChoseEatModelDTO choseEatModelDTO
|
||||
) {
|
||||
return Result.success(CodeEnum.SUCCESS, productService.choseEatModel(choseEatModelDTO));
|
||||
}
|
||||
|
||||
@PostMapping("cleanCart")
|
||||
public Result cleanCart(@RequestBody JSONObject jsonObject) {
|
||||
log.info("清空购物车数据:{}", jsonObject);
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
public class ChoseEatModelDTO {
|
||||
@NotNull
|
||||
private Integer shopId;
|
||||
private String tableId;
|
||||
@NotNull
|
||||
private Integer userId;
|
||||
}
|
||||
@@ -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())) ;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user