Merge Q-CAST-III-MR-305: 엑셀/pdf 파일명 프론트에서 받도록 수정

This commit is contained in:
박 꽃송이 2024-11-15 01:29:19 +00:00 committed by Space Cloud
commit 30a57df0b9
No known key found for this signature in database
GPG Key ID: 2F4D45726235F749
5 changed files with 63 additions and 51 deletions

View File

@ -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);
}

View File

@ -190,4 +190,7 @@ public class EstimateRequest {
@Schema(description = "아이템 목록")
List<ItemRequest> itemList;
@Schema(description = "다운로드 파일명")
private String fileName;
}

View File

@ -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();

View File

@ -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);

View File

@ -352,17 +352,16 @@
<td colspan="3">
<div class="estimate-wrap">
<div class="estimate-info">
<span>三油商会</span>
<span class="estimate-info-name"> PITステーション名東一社</span>
<span>様邸 </span>
<span class="estimate-info-name" id="custSaleStoreName"></span>
<span class="estimate-info-name" id="custOmit"></span>
</div>
<div class="estimate-tit-form">
<span class="estimate-tit">見積有効期限 :</span>
<span>発行日より1ヶ月</span>
<span id="estimateValidityTerm"></span>
</div>
<div class="estimate-tit-form">
<span class="estimate-tit">件名 :</span>
<span>三油商会 PITステーション名東一社</span>
<span id="objectName1"></span>
</div>
</div>
</td>
@ -370,27 +369,32 @@
<div class="product-wrap">
<div>
<div class="product-num">
<span class="tit">物件番号 :</span>
<span>RX524231020006</span>
<span class="tit">見積書番号 :</span>
<span id="objectNo1"></span>
</div>
<div class="product-count">
<span class="tit">プラン :</span>
<span>5</span>
<span id="planNo"></span>
</div>
</div>
<div class="product-form">
<span class="tit">日付 :</span>
<span>2023/10/20</span>
<span id="estimateDate"></span>
</div>
<div class="product-form">
<span class="tit">登録番号 :</span>
<span>3456789</span>
<span class="tit">法人番号 :</span>
<span id="bizNo"></span>
</div>
<div class="store-info-tit">鈴与商事株式会社</div>
<div class="store-info-tit" id="saleStoreName"></div>
<div class="store-info">
<span>〒 420-0859</span>
<span>静岡県静岡市葵区栄町 1- 鈴与静岡ビルF</span>
<div class="number"><span>TEL :</span> <span>054-273-7780</span> <span>FAX :</span> <span>054-273-7704</span></span></div>
<span id="zipNo"></span>
<span id="address"></span>
<div class="number">
<span>TEL :</span>
<span id="tel"></span>
<span>FAX :</span>
<span id="fax"></span>
</div>
</div>
<table class="approval-table">
<thead>
@ -413,14 +417,14 @@
</table>
<div class="sun-volt">
<span>太陽電池容量 :</span>
<span class="sun-volt-value">8.3</span>
<span class="sun-volt-value" id="totVolKw1"></span>
<span>KW</span>
</div>
<div class="all-price-wrap">
<div class="all-price ">
<span>お見積金額</span>
<span class="all-price-value">7,478,790 円 </span>
<span>(消費税込)</span>
<span class="all-price-value" id="totPrice"></span>
<span>(消費税込)</span>
</div>
</div>
<table class="price-table mb20">
@ -435,36 +439,37 @@
<th style="width: 110px;">価格</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Re.RISE 415</td>
<td>Re.RISE 415</td>
<td>¥278,050</td>
<td>20</td>
<td></td>
<td class="al-r">¥5,561,000</td>
</tr>
<tr>
<td>2</td>
<td>Re.RISE 415</td>
<td>Re.RISE 415</td>
<td>¥278,050</td>
<td>20</td>
<td></td>
<td class="al-r">¥5,561,000</td>
</tr>
<tbody id="itemList_detail">
<!-- <tr>-->
<!-- <td>1</td>-->
<!-- <td>Re.RISE 415</td>-->
<!-- <td>Re.RISE 415</td>-->
<!-- <td>¥278,050</td>-->
<!-- <td>20</td>-->
<!-- <td>枚</td>-->
<!-- <td class="al-r">¥5,561,000</td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td>2</td>-->
<!-- <td>Re.RISE 415</td>-->
<!-- <td>Re.RISE 415</td>-->
<!-- <td>¥278,050</td>-->
<!-- <td>20</td>-->
<!-- <td>枚</td>-->
<!-- <td class="al-r">¥5,561,000</td>-->
<!-- </tr>-->
<tr>
<td class="al-r" colspan="6">小計</td>
<td class="al-r">¥6,798,900</td>
<td class="al-r" id="supplyPrice"></td>
</tr>
<tr>
<td class="al-r" colspan="6">消費税 (10%)</td>
<td class="al-r">¥679,890</td>
<td class="al-r" colspan="5">消費税</td>
<td class="al-r">(10%)</td>
<td class="al-r" id="vatPrice"></td>
</tr>
<tr>
<td class="al-r end" colspan="6">合計金額</td>
<td class="al-r end">¥7,478,790</td>
<td class="al-r end" id="totPrice1"></td>
</tr>
</tbody>
</table>
@ -476,9 +481,8 @@
</thead>
<tbody>
<tr>
<td class="al-l">
<div>※受注発注品の納期はお問合せください。</div>
<div>※別紙添付ファイルにて各拾い出し部材の注意事項・備考一覧をご確認ください</div>
<td class="al-l" id="remarks">
<!--<div>※受注発注品の納期はお問合せください。</div>-->
</td>
</tr>
</tbody>