Commit a5fc2b61 authored by Ryan Loong's avatar Ryan Loong

fix 文件导出

parent 199b4c30
...@@ -174,7 +174,7 @@ public class WxStorageController { ...@@ -174,7 +174,7 @@ public class WxStorageController {
} }
String type = storage.getType(); String type = storage.getType();
if(type.equals("application/x-zip-compressed") || type.equals("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")){ if(type.equals("application/x-zip-compressed")){
MediaType mediaType = MediaType.parseMediaType(type); MediaType mediaType = MediaType.parseMediaType(type);
Resource file = storageService.loadAsResource(key); Resource file = storageService.loadAsResource(key);
if(file == null) { if(file == null) {
...@@ -182,6 +182,14 @@ public class WxStorageController { ...@@ -182,6 +182,14 @@ public class WxStorageController {
} }
return ResponseEntity.ok().contentType(mediaType).header(HttpHeaders.CONTENT_DISPOSITION, return ResponseEntity.ok().contentType(mediaType).header(HttpHeaders.CONTENT_DISPOSITION,
"attachment; filename=\"" + file.getFilename() + "\"").body(file); "attachment; filename=\"" + file.getFilename() + "\"").body(file);
} else if (type.equals("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")) {
MediaType mediaType = MediaType.parseMediaType(type);
Resource file = storageService.loadAsResource(key);
if(file == null) {
ResponseEntity.notFound();
}
return ResponseEntity.ok().contentType(mediaType).header(HttpHeaders.CONTENT_DISPOSITION,
"attachment; filename=\"" + storage.getName() + "\"").body(file);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment