桌码下载修复linux下下载不正常

This commit is contained in:
张松 2025-02-28 10:01:36 +08:00
parent a6cb86a126
commit 18970d0516
1 changed files with 2 additions and 4 deletions

View File

@ -29,6 +29,7 @@ import org.apache.dubbo.config.annotation.DubboService;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -144,8 +145,7 @@ public class ShopTableServiceImpl extends ServiceImpl<ShopTableMapper, ShopTable
// 写入ZIP文件
ZipOutputStream zipOut = new ZipOutputStream(response.getOutputStream());
try {
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);
@ -154,9 +154,7 @@ public class ShopTableServiceImpl extends ServiceImpl<ShopTableMapper, ShopTable
zipOut.flush();
zipOut.closeEntry();
}
}finally {
zipOut.finish();
zipOut.close();
}
}