需求:java
下载文件,选择单个文档则下载单个文档,选择多个文档则讲多个文档压缩进一个压缩文件。code
public ResponseEntity downloadFiles(String literIds,String type) throws YMLibWebApplicationException {
Assert.notNull(literIds, "未指定要下载的文献");
if(null==type){
type="";
}
String[] ids = literIds.split(",");
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
QFullTextLibrary qfullTextLibrary = QFullTextLibrary.fullTextLibrary;
Predicate predicate = qfullTextLibrary.id.in(ids);
Iterable iter = fullTextLibraryRepository.findAll(predicate);
int total = 0;
String fileName = "";
Collection fileIds = new ArrayList();
for (FullTextLibrary one : iter) {
String fileId = one.getFileId();</