桌码打包下载失败修复
This commit is contained in:
@@ -119,18 +119,23 @@ public class ShopTableServiceImpl extends ServiceImpl<ShopTableMapper, ShopTable
|
|||||||
// 转换为字节数组
|
// 转换为字节数组
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
ImgUtil.write(qrImage, ImgUtil.IMAGE_TYPE_PNG, out);
|
ImgUtil.write(qrImage, ImgUtil.IMAGE_TYPE_PNG, out);
|
||||||
|
out.flush(); // 确保所有数据都已写入
|
||||||
byte[] qrBytes = out.toByteArray();
|
byte[] qrBytes = out.toByteArray();
|
||||||
|
|
||||||
// 添加到 ZIP
|
// 添加到 ZIP
|
||||||
zipOut.putNextEntry(new ZipEntry(tableCode + ".png"));
|
zipOut.putNextEntry(new ZipEntry(tableCode + ".png"));
|
||||||
zipOut.write(qrBytes);
|
zipOut.write(qrBytes);
|
||||||
zipOut.closeEntry();
|
zipOut.closeEntry(); // 确保当前文件的条目被关闭
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 刷新并完成文件输出
|
||||||
|
zipOut.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
shopTableCodeService.saveBatch(codeList);
|
shopTableCodeService.saveBatch(codeList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private String generateCode(Integer count, Long shopId, Long id, Map<String, Long> map) {
|
private String generateCode(Integer count, Long shopId, Long id, Map<String, Long> map) {
|
||||||
if (count > 100) {
|
if (count > 100) {
|
||||||
throw new ApiNotPrintException("桌码生成失败");
|
throw new ApiNotPrintException("桌码生成失败");
|
||||||
|
|||||||
Reference in New Issue
Block a user