diff --git a/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java b/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java index 3da990ee..3c1de54c 100644 --- a/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java +++ b/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java @@ -712,7 +712,13 @@ public class EstimateService { public void excelDownload( HttpServletRequest request, HttpServletResponse response, EstimateRequest estimateRequest) throws Exception { - ExcelUtil excelUtil = new ExcelUtil(); + + // file Name 명이 없는경우 + if (estimateRequest.getFileName() == null || "".equals(estimateRequest.getFileName())) { + estimateRequest.setFileName( + "Quation_Detail_" + new SimpleDateFormat("yyyyMMdd").format(new Date())); + } + EstimateResponse estimateResponse = new EstimateResponse(); String splitStr = "、"; @@ -844,8 +850,6 @@ public class EstimateService { String[] arrSection = new String[5]; // TODO Section 갯수 넣기 int iSection = 0; - String pdfFileName = - "Quation_Detail_" + new SimpleDateFormat("yyyyMMdd").format(new Date()); String templateFilePath = "pdf_download_quotation_detail_template.html"; // 템플릿 html 조회 @@ -874,20 +878,19 @@ public class EstimateService { } // pdf 다운로드 - PdfUtil.pdfDownload(request, response, doc, pdfFileName, arrSection); + PdfUtil.pdfDownload(request, response, doc, estimateRequest.getFileName(), arrSection); } else { - String excelFileName = - "Quation_Detail_" + new SimpleDateFormat("yyyyMMdd").format(new Date()); String excelTemplateNam = "excel_download_quotation_detail_template.xlsx"; + ExcelUtil excelUtil = new ExcelUtil(); excelUtil.download( request, response, this.convertVoToMap(estimateResponse), this.convertListToMap(estimateItemList), - excelFileName, + estimateRequest.getFileName(), excelTemplateNam); } diff --git a/src/main/java/com/interplug/qcast/biz/estimate/dto/EstimateRequest.java b/src/main/java/com/interplug/qcast/biz/estimate/dto/EstimateRequest.java index 86756844..fbd53338 100644 --- a/src/main/java/com/interplug/qcast/biz/estimate/dto/EstimateRequest.java +++ b/src/main/java/com/interplug/qcast/biz/estimate/dto/EstimateRequest.java @@ -190,4 +190,7 @@ public class EstimateRequest { @Schema(description = "아이템 목록") List itemList; + + @Schema(description = "다운로드 파일명") + private String fileName; } diff --git a/src/main/java/com/interplug/qcast/util/ExcelUtil.java b/src/main/java/com/interplug/qcast/util/ExcelUtil.java index 90213d47..37ed9e7b 100644 --- a/src/main/java/com/interplug/qcast/util/ExcelUtil.java +++ b/src/main/java/com/interplug/qcast/util/ExcelUtil.java @@ -47,6 +47,7 @@ public class ExcelUtil { InputStream is = new BufferedInputStream(templateStream); response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + ".xlsx\""); + response.addHeader("Access-Control-Expose-Headers", "Content-Disposition"); try (OutputStream os = response.getOutputStream()) { Context context = new Context(); diff --git a/src/main/java/com/interplug/qcast/util/PdfUtil.java b/src/main/java/com/interplug/qcast/util/PdfUtil.java index ae25eb62..a9b6bf3a 100644 --- a/src/main/java/com/interplug/qcast/util/PdfUtil.java +++ b/src/main/java/com/interplug/qcast/util/PdfUtil.java @@ -73,6 +73,7 @@ public class PdfUtil { // 응답에 PDF 설정 response.setContentType("application/pdf"); response.setHeader("Content-Disposition", "attachment; filename=\"" + pdfFileName + "\""); + response.addHeader("Access-Control-Expose-Headers", "Content-Disposition"); try (OutputStream os = response.getOutputStream(); PdfWriter writer = new PdfWriter(os); diff --git a/src/main/resources/template/pdf/pdf_download_quotation_detail_template.html b/src/main/resources/template/pdf/pdf_download_quotation_detail_template.html index 11161be5..03e106f1 100644 --- a/src/main/resources/template/pdf/pdf_download_quotation_detail_template.html +++ b/src/main/resources/template/pdf/pdf_download_quotation_detail_template.html @@ -352,17 +352,16 @@
- 三油商会 -  PITステーション名東一社 - 様邸 + +
見積有効期限 : - 発行日より1ヶ月 +
件名 : - 三油商会 PITステーション名東一社 +
@@ -370,27 +369,32 @@
- 物件番号 : - RX524231020006 + 見積書番号 : +
プラン : - 5 +
日付 : - 2023/10/20 +
- 登録番号 : - 3456789 + 法人番号 : +
-
鈴与商事株式会社
+
- 〒 420-0859 - 静岡県静岡市葵区栄町 1-3 鈴与静岡ビル6F -
TEL : 054-273-7780 FAX : 054-273-7704
+ + +
+ TEL : + + FAX : + +
@@ -413,14 +417,14 @@
太陽電池容量 : - 8.3 + KW
お見積金額 - 7,478,790 円 - (消費税込) + + 円 (消費税込)
@@ -435,36 +439,37 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - + - - + + + - +
価格
1Re.RISE 415Re.RISE 415¥278,05020¥5,561,000
2Re.RISE 415Re.RISE 415¥278,05020¥5,561,000
小計¥6,798,900
消費税 (10%)¥679,890消費税(10%)
合計金額¥7,478,790
@@ -476,9 +481,8 @@ - -
※受注発注品の納期はお問合せください。
-
※別紙添付ファイルにて各拾い出し部材の注意事項・備考一覧をご確認ください
+ +