新增桌码绑定接口
This commit is contained in:
parent
4ec0f04cc5
commit
537b9b408b
|
|
@ -100,4 +100,5 @@ public class TbShopInfoController {
|
|||
tbShopInfoService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,10 +17,7 @@ package cn.ysk.cashier.controller.shop;
|
|||
|
||||
import cn.ysk.cashier.annotation.AnonymousAccess;
|
||||
import cn.ysk.cashier.annotation.Log;
|
||||
import cn.ysk.cashier.dto.shoptable.AddCartDTO;
|
||||
import cn.ysk.cashier.dto.shoptable.ClearCartDTO;
|
||||
import cn.ysk.cashier.dto.shoptable.RemoveCartDTO;
|
||||
import cn.ysk.cashier.dto.shoptable.TableGenerateDTO;
|
||||
import cn.ysk.cashier.dto.shoptable.*;
|
||||
import cn.ysk.cashier.pojo.shop.TbShopTable;
|
||||
import cn.ysk.cashier.service.shop.TbShopTableService;
|
||||
import cn.ysk.cashier.dto.shop.TbShopTableQueryCriteria;
|
||||
|
|
@ -106,4 +103,12 @@ public class TbShopTableController {
|
|||
return new ResponseEntity<>(tbShopTableService.getShopState(shopId, tableId),HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 桌码绑定
|
||||
*/
|
||||
@PostMapping("/bind")
|
||||
public ResponseEntity<Object> bindQrcode(@Validated @RequestBody BindTableQrCodeDTO bindTableQrCodeDTO) {
|
||||
return new ResponseEntity<>(tbShopTableService.bindQrcode(bindTableQrCodeDTO),HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
package cn.ysk.cashier.dto.shoptable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
public class BindTableQrCodeDTO {
|
||||
@NotNull
|
||||
private Integer shopId;
|
||||
@NotNull
|
||||
private Integer id;
|
||||
@NotEmpty
|
||||
private String code;
|
||||
}
|
||||
|
|
@ -28,4 +28,12 @@ public interface MpShopTableService extends IService<TbShopTable> {
|
|||
* @return 台桌信息
|
||||
*/
|
||||
TbShopTable selectByTableId(String tableId, Integer shopId);
|
||||
|
||||
/**
|
||||
* 根据主键查询台桌
|
||||
* @param id 主键
|
||||
* @param shopId 店铺id
|
||||
* @return 台桌信息
|
||||
*/
|
||||
TbShopTable selectById(Integer id, Integer shopId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,4 +37,11 @@ public class MpShopTableServiceImpl extends ServiceImpl<MpShopTableMapper, TbSho
|
|||
.eq(TbShopTable::getShopId, shopId)
|
||||
.eq(TbShopTable::getQrcode, tableId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbShopTable selectById(Integer id, Integer shopId) {
|
||||
return getOne(new LambdaQueryWrapper<TbShopTable>()
|
||||
.eq(TbShopTable::getId, id)
|
||||
.eq(TbShopTable::getShopId, shopId));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
package cn.ysk.cashier.service.impl.shopimpl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.qrcode.QrCodeUtil;
|
||||
import cn.hutool.extra.qrcode.QrConfig;
|
||||
import cn.ysk.cashier.config.security.security.TokenProvider;
|
||||
import cn.ysk.cashier.config.security.service.UserCacheManager;
|
||||
import cn.ysk.cashier.dto.shop.TbShopInfoDto;
|
||||
|
|
@ -7,6 +10,7 @@ import cn.ysk.cashier.dto.shop.TbShopInfoQueryCriteria;
|
|||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.exception.EntityNotFoundException;
|
||||
import cn.ysk.cashier.mapper.shop.TbShopInfoMapper;
|
||||
import cn.ysk.cashier.mybatis.mapper.MpShopInfoMapper;
|
||||
import cn.ysk.cashier.pojo.shop.TbMerchantAccount;
|
||||
import cn.ysk.cashier.pojo.shop.TbMerchantRegister;
|
||||
import cn.ysk.cashier.pojo.shop.TbPlussShopStaff;
|
||||
|
|
@ -24,8 +28,11 @@ import cn.ysk.cashier.system.repository.UserRepository;
|
|||
import cn.ysk.cashier.system.service.ParamsService;
|
||||
import cn.ysk.cashier.system.service.UserService;
|
||||
import cn.ysk.cashier.utils.*;
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
|
@ -35,8 +42,12 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
|
||||
|
|
@ -322,4 +333,6 @@ public class TbShopInfoServiceImpl implements TbShopInfoService {
|
|||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2203,4 +2203,19 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object bindQrcode(BindTableQrCodeDTO bindTableQrCodeDTO) {
|
||||
TbShopTable shopTable = mpShopTableService.selectById(bindTableQrCodeDTO.getId(), bindTableQrCodeDTO.getShopId());
|
||||
if (shopTable == null) {
|
||||
throw new BadRequestException("台桌不存在");
|
||||
}
|
||||
|
||||
shopTable.setQrcode(bindTableQrCodeDTO.getCode());
|
||||
if (!mpShopTableService.updateById(shopTable)) {
|
||||
throw new BadRequestException("绑定失败");
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,4 +88,5 @@ public interface TbShopInfoService {
|
|||
* @throws IOException /
|
||||
*/
|
||||
void download(List<TbShopInfoDto> all, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,4 +147,6 @@ public interface TbShopTableService {
|
|||
* @return
|
||||
*/
|
||||
Object getShopState(Integer shopId, String tableId);
|
||||
|
||||
Object bindQrcode(BindTableQrCodeDTO bindTableQrCodeDTO);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue