From 4d795610e26e15d552127d5a684ca7ca7d993aa1 Mon Sep 17 00:00:00 2001 From: "DESKTOP-6ARNG1Q\\dlsgk" Date: Fri, 15 Nov 2024 10:18:18 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=EC=97=91=EC=85=80/pdf=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=EB=AA=85=20=ED=94=84=EB=A1=A0=ED=8A=B8=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EB=B0=9B=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../qcast/biz/estimate/EstimateService.java | 9 +- .../biz/estimate/dto/EstimateRequest.java | 3 + ...df_download_quotation_detail_template.html | 92 ++++++++++--------- 3 files changed, 53 insertions(+), 51 deletions(-) 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 1e61c381..effa91ca 100644 --- a/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java +++ b/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java @@ -28,7 +28,6 @@ import java.beans.PropertyDescriptor; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.math.BigDecimal; -import java.text.SimpleDateFormat; import java.util.*; import java.util.List; import lombok.RequiredArgsConstructor; @@ -848,8 +847,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 조회 @@ -878,12 +875,10 @@ 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.download( @@ -891,7 +886,7 @@ public class EstimateService { 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 55950d59..e0b5340a 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 @@ -184,4 +184,7 @@ public class EstimateRequest { @Schema(description = "아이템 목록") List itemList; + + @Schema(description = "다운로드 파일명") + private String fileName; } 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 @@ - -
※受注発注品の納期はお問合せください。
-
※別紙添付ファイルにて各拾い出し部材の注意事項・備考一覧をご確認ください
+ + From d69c00831826b5aeab60d86193a1cb3e387666ce Mon Sep 17 00:00:00 2001 From: "DESKTOP-6ARNG1Q\\dlsgk" Date: Fri, 15 Nov 2024 10:27:40 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=EB=8B=A4=EC=9A=B4=EB=A1=9C=EB=93=9C=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../interplug/qcast/biz/estimate/EstimateService.java | 10 +++++++++- src/main/java/com/interplug/qcast/util/ExcelUtil.java | 1 + src/main/java/com/interplug/qcast/util/PdfUtil.java | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) 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 effa91ca..a5bb62a3 100644 --- a/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java +++ b/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java @@ -28,6 +28,7 @@ import java.beans.PropertyDescriptor; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.math.BigDecimal; +import java.text.SimpleDateFormat; import java.util.*; import java.util.List; import lombok.RequiredArgsConstructor; @@ -711,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 = "、"; @@ -881,6 +888,7 @@ public class EstimateService { String excelTemplateNam = "excel_download_quotation_detail_template.xlsx"; + ExcelUtil excelUtil = new ExcelUtil(); excelUtil.download( request, response, 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);