1 默认项目已经配置并连接成功OSS客户端
@Resource
private OSSClient ossClient;
2 具体实现代码
public void batchDownLoadFile(DownLoadFileDTO downLoadFileDTO, HttpServletRequest request, HttpServletResponse response) {
//获取前端传过来的文件id集合
List<String> fileMapperIdList = downLoadFileDTO.getFileMapperIdList();
try {
String fileName = "test.zip";
// 创建临时文件
File zipFile = File.createTempFile("test", ".zip");
FileOutputStream f = new FileOutputStream(zipFile);
//作用是为任何OutputStream产生校验
//第一个参数是制定产生校验和的输出流,第二个参数是指定Checksum的类型 (Adler32(较快)和CRC32两种)
CheckedOutputStream csum = new CheckedOutputStream(f, new Adler32());
//用于将数据压缩成Zip文件格式
ZipOutputStream zos = new ZipOutputStream(csum);
for (String