Commit 78ef0514 authored by sherlock's avatar sherlock

export fileName

parent 89fcee22
...@@ -47,11 +47,14 @@ public class InputInvoiceImportController { ...@@ -47,11 +47,14 @@ public class InputInvoiceImportController {
public void downloadInvoiceQueryData(@RequestBody InputInvoicePreviewQueryParam paras, HttpServletResponse response, public void downloadInvoiceQueryData(@RequestBody InputInvoicePreviewQueryParam paras, HttpServletResponse response,
@RequestHeader("from") String projectId) { @RequestHeader("from") String projectId) {
response.setContentType("application/vnd.ms-excel;charset=utf-8"); response.setContentType("application/vnd.ms-excel;charset=utf-8");
response.setHeader("Content-Disposition", "attachment;filename=" + UUID.randomUUID() + ".xlsx"); response.addHeader("Access-Control-Expose-Headers", "Content-Type,Content-Disposition,x-file-name");
response.setHeader("x-file-name", UUID.randomUUID() + ".xlsx"); response.setCharacterEncoding("UTF-8");
String fileName = paras.getPeriodStart() + "-" + paras.getPeriodEnd();
OutputStream os = null; OutputStream os = null;
try { try {
response.addHeader("Content-Disposition", "attachment;filename="
+ UUID.randomUUID() + ".xls");
response.addHeader("x-file-name", fileName + ".xlsx");
os = response.getOutputStream(); os = response.getOutputStream();
int count = getDownloadFilePath(paras, os, projectId); int count = getDownloadFilePath(paras, os, projectId);
......
...@@ -53,11 +53,14 @@ public class OutputInvoiceController { ...@@ -53,11 +53,14 @@ public class OutputInvoiceController {
@RequestMapping(value = "getExportOutputInvoiceList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "getExportOutputInvoiceList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void downloadInvoiceQueryData(@RequestBody QueryOutputDto paras, @RequestHeader("from") String projectId, HttpServletResponse response) { public void downloadInvoiceQueryData(@RequestBody QueryOutputDto paras, @RequestHeader("from") String projectId, HttpServletResponse response) {
response.setContentType("application/vnd.ms-excel;charset=utf-8"); response.setContentType("application/vnd.ms-excel;charset=utf-8");
response.setHeader("Content-Disposition", "attachment;filename=" response.addHeader("Access-Control-Expose-Headers", "Content-Type,Content-Disposition,x-file-name");
+ UUID.randomUUID() + ".xls"); String fileName = paras.getPeriodStart() + "-" + paras.getPeriodEnd();
response.setHeader("x-file-name", UUID.randomUUID() + ".xlsx"); response.setCharacterEncoding("UTF-8");
OutputStream os = null; OutputStream os = null;
try { try {
response.addHeader("Content-Disposition", "attachment;filename="
+ UUID.randomUUID() + ".xls");
response.addHeader("x-file-name", fileName + ".xlsx");
os = response.getOutputStream(); os = response.getOutputStream();
int count = getDownloadFilePath(paras, projectId, os); int count = getDownloadFilePath(paras, projectId, os);
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
headers = headers(); headers = headers();
// Get the filename from the x-filename header or default to "download.bin" // Get the filename from the x-filename header or default to "download.bin"
var filename = decodeURI(headers['x-file-name']) || defaultFileName; var filename = decodeURI(headers['x-file-name']) + defaultFileName;
// Determine the content type from the header or default to "application/octet-stream" // Determine the content type from the header or default to "application/octet-stream"
var contentType = headers['content-type'] || octetStreamMime; var contentType = headers['content-type'] || octetStreamMime;
......
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