| | |
| | | response.setHeader("Content-Disposition", "attachment;filename=files.zip"); |
| | | |
| | | ZipOutputStream zipOutputStream = new ZipOutputStream(response.getOutputStream()); |
| | | int i = 0; |
| | | for (String s : id) { |
| | | i++; |
| | | FileInfo fileInfo = service.getById(s); |
| | | FtpUtils ftpUtil = new FtpUtils(); |
| | | InputStream inputStream = ftpUtil.retrieveFileStream(fileInfo.getFullPath()); |
| | | |
| | | // 每个文件写入到ZIP包中 |
| | | zipOutputStream.putNextEntry(new ZipEntry(fileInfo.getName() + BaseConsts.DOT + fileInfo.getSuffix())); |
| | | zipOutputStream.putNextEntry(new ZipEntry(fileInfo.getName() + "-" + i + BaseConsts.DOT + fileInfo.getSuffix())); |
| | | IOUtils.copy(inputStream, zipOutputStream); |
| | | zipOutputStream.closeEntry(); |
| | | IOUtils.closeQuietly(inputStream); |
| | |
| | | |
| | | /** |
| | | * 公共方法-获取附件列表 |
| | | * @url {ctx}/api/web/fileInfo/lietNewSysFile |
| | | * |
| | | * @param |
| | | * @return Object |
| | | * @url {ctx}/api/web/fileInfo/lietNewSysFile |
| | | */ |
| | | @GetMapping(value = "/listNewSysFile") |
| | | public Object listNewSysFile(@RequestParam (value = "ownerId") String ownerId, @RequestParam (value = "ownerType") String ownerType, |