桌码下载修复linux下下载不正常
This commit is contained in:
parent
e84327e09b
commit
5f905da7d6
|
|
@ -144,18 +144,20 @@ public class ShopTableServiceImpl extends ServiceImpl<ShopTableMapper, ShopTable
|
|||
response.setCharacterEncoding(request.getCharacterEncoding());
|
||||
|
||||
// 写入ZIP文件
|
||||
|
||||
try (ZipOutputStream zipOut = new ZipOutputStream(response.getOutputStream(), Charset.forName("gbk"))) {
|
||||
try (ZipOutputStream zipOut = new ZipOutputStream(response.getOutputStream(), Charset.forName("GBK"))) {
|
||||
for (int i = 0; i < num; i++) {
|
||||
ZipEntry entry = new ZipEntry(fileNames.get(i));
|
||||
zipOut.putNextEntry(entry);
|
||||
|
||||
byte[] byteArray = qrBytesList.get(i);
|
||||
zipOut.write(byteArray, 0, byteArray.length);
|
||||
zipOut.flush();
|
||||
}
|
||||
zipOut.closeEntry();
|
||||
}
|
||||
|
||||
// 确保每个条目被正确关闭
|
||||
zipOut.closeEntry();
|
||||
}
|
||||
|
||||
// 注意:不需要手动调用 zipOut.close(),try-with-resources 会自动关闭流
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue