微调 压缩文件的编解码保持一致
This commit is contained in:
@@ -1722,8 +1722,8 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
String zipFileName = URLEncoder.encode(subPlan.getName() + ".zip", "UTF-8");
|
||||
File zipFile = FileUtil.file(tempDir, zipFileName);
|
||||
|
||||
// 先将json文件添加到zip中
|
||||
ZipUtil.zip(jsonFile.getAbsolutePath(), zipFile.getAbsolutePath());
|
||||
// 先将json文件添加到zip中(使用UTF-8编码)
|
||||
ZipUtil.zip(zipFile, CharsetUtil.CHARSET_UTF_8, false, jsonFile);
|
||||
|
||||
|
||||
// 创建一个临时目录存放两个文件
|
||||
@@ -1745,8 +1745,8 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
}
|
||||
|
||||
|
||||
// 重新创建zip文件,包含所有文件
|
||||
ZipUtil.zip(tempZipDir.getAbsolutePath(), zipFile.getAbsolutePath());
|
||||
// 重新创建zip文件,包含所有文件,使用UTF-8编码
|
||||
ZipUtil.zip(zipFile, CharsetUtil.CHARSET_UTF_8, false, FileUtil.file(tempZipDir));
|
||||
|
||||
// 删除临时目录
|
||||
FileUtil.del(tempZipDir);
|
||||
@@ -1780,9 +1780,9 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
File zipFile = FileUtil.file(tempDir, file.getOriginalFilename());
|
||||
file.transferTo(zipFile);
|
||||
|
||||
// 解压zip文件
|
||||
// 解压zip文件,使用UTF-8编码
|
||||
File unzipDir = FileUtil.mkdir(FileUtil.file(tempDir, "unzip"));
|
||||
ZipUtil.unzip(zipFile.getAbsolutePath(), unzipDir.getAbsolutePath());
|
||||
ZipUtil.unzip(zipFile, unzipDir, CharsetUtil.CHARSET_UTF_8);
|
||||
|
||||
// 查找解压目录中的json文件
|
||||
File[] files = unzipDir.listFiles();
|
||||
@@ -2100,8 +2100,8 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
}
|
||||
}
|
||||
|
||||
// 重新创建zip文件,包含所有文件
|
||||
ZipUtil.zip(tempZipDir.getAbsolutePath(), zipFile.getAbsolutePath());
|
||||
// 重新创建zip文件,包含所有文件,使用UTF-8编码
|
||||
ZipUtil.zip(zipFile, CharsetUtil.CHARSET_UTF_8, false, FileUtil.file(tempZipDir));
|
||||
|
||||
// 删除临时目录
|
||||
FileUtil.del(tempZipDir);
|
||||
|
||||
Reference in New Issue
Block a user