Commit 78ef0514 authored by sherlock's avatar sherlock

export fileName

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