新增桌码绑定接口

This commit is contained in:
2024-10-24 16:29:08 +08:00
parent 4ec0f04cc5
commit 537b9b408b
9 changed files with 75 additions and 7 deletions

View File

@@ -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);
}
}
}

View File

@@ -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;
}
}

View File

@@ -88,4 +88,5 @@ public interface TbShopInfoService {
* @throws IOException /
*/
void download(List<TbShopInfoDto> all, HttpServletResponse response) throws IOException;
}
}

View File

@@ -147,4 +147,6 @@ public interface TbShopTableService {
* @return
*/
Object getShopState(Integer shopId, String tableId);
Object bindQrcode(BindTableQrCodeDTO bindTableQrCodeDTO);
}