diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/print/PDFPrintUtil.java b/src/main/java/cokr/xit/fims/cmmn/pdf/print/PDFPrintUtil.java
index 990f0443..3a34c0f7 100644
--- a/src/main/java/cokr/xit/fims/cmmn/pdf/print/PDFPrintUtil.java
+++ b/src/main/java/cokr/xit/fims/cmmn/pdf/print/PDFPrintUtil.java
@@ -30,6 +30,8 @@ public class PDFPrintUtil extends PrintUtil {
private float[] paperMilimeter = new float[2];
+ private String formatKorName;
+
public void setting(String paperType) {
if(paperType.equals("01")) {
this.paperMilimeter = new float[] {210.0f , 297.0f};
@@ -38,6 +40,14 @@ public class PDFPrintUtil extends PrintUtil {
}
}
+ public String getFormatKorName() {
+ return this.formatKorName;
+ }
+
+ public String setFormatKorName(String formatKorName) {
+ return this.formatKorName = formatKorName;
+ }
+
public String filePathForNewFile() {
SimpleDateFormat ymdhmsFormat = new SimpleDateFormat("yyyyMMddHHmmss");
@@ -514,5 +524,4 @@ public class PDFPrintUtil extends PrintUtil {
}
}
-
}
diff --git a/src/main/java/cokr/xit/fims/sprt/service/IntegrationSearchService.java b/src/main/java/cokr/xit/fims/sprt/service/IntegrationSearchService.java
index f9b8b28b..49120d73 100644
--- a/src/main/java/cokr/xit/fims/sprt/service/IntegrationSearchService.java
+++ b/src/main/java/cokr/xit/fims/sprt/service/IntegrationSearchService.java
@@ -34,15 +34,31 @@ public interface IntegrationSearchService {
/** 한글 서식 출력물을 생성한다.
* @param formatType 서식유형 ,formatName 서식명, printOption 출력옵션, crdnIds 출력대상
* @return map 출력 요청 결과
- *
- filePath: 결과 파일 경로
- * - fileName: 다운로드 파일명
+ * - filename: 다운로드 파일명
+ * - filePath: 결과 파일 경로
+ * - file: 결과 파일
*
*/
Map makeFileFromHwpFormat(String formatType, String formatName, PrintOption printOption, String... crdnIds);
-// Map makeFileFromHwpFormat(String formatType, String formatName, PrintOption printOption, String... crdnIds);
- Map makePdfFile(String formatType, String formatName, PrintOption printOption, String[] crdnIds);
+ /** pdf 출력물을 생성한다.
+ * @param formatType 서식유형 ,formatName 서식명, printOption 출력옵션, crdnIds 출력대상
+ * @return map 출력 요청 결과
+ * - filename: 다운로드 파일명
+ * - filePath: 결과 파일 경로
+ * - file: 결과 파일
+ *
+ */
+ Map makePdfFile(String formatType, String formatName, PrintOption printOption, String[] crdnIds);
- Map makeOutsourcingFile(String formatName, PrintOption printOption, String[] crdnIds);
+ /** 외주요청 파일을 생성한다.
+ * @param formatName 서식명, printOption 출력옵션, crdnIds 출력대상
+ * @return map 출력 요청 결과
+ * - filename: 다운로드 파일명
+ * - filePath: 결과 파일 경로
+ * - file: 결과 파일
+ *
+ */
+ Map makeOutsourcingFile(String formatName, PrintOption printOption, String[] crdnIds);
}
diff --git a/src/main/java/cokr/xit/fims/sprt/service/bean/IntegrationSearchServiceBean.java b/src/main/java/cokr/xit/fims/sprt/service/bean/IntegrationSearchServiceBean.java
index 70f3dd13..59ac355c 100644
--- a/src/main/java/cokr/xit/fims/sprt/service/bean/IntegrationSearchServiceBean.java
+++ b/src/main/java/cokr/xit/fims/sprt/service/bean/IntegrationSearchServiceBean.java
@@ -292,8 +292,8 @@ public class IntegrationSearchServiceBean extends AbstractServiceBean implements
}
@Override
- public Map makePdfFile(String formatType, String formatName, PrintOption printOption, String[] crdnIds) {
- Map result = new HashMap<>();
+ public Map makePdfFile(String formatType, String formatName, PrintOption printOption, String[] crdnIds) {
+ Map result = new HashMap<>();
PDFPrintFormat pdfFormat = null;
if(formatName.equals("advntce")) {
@@ -317,6 +317,12 @@ public class IntegrationSearchServiceBean extends AbstractServiceBean implements
PDFPrintUtil pdfPrintUtil = new PDFPrintUtil();
+ if(formatName.equals("advntce")) {
+ pdfPrintUtil.setFormatKorName("사전통지서");
+ } else if(formatName.equals("nht")) {
+ pdfPrintUtil.setFormatKorName("고지서");
+ }
+
UserInfo userInfo = currentUser();
factionBean.initUserInfo(userInfo);
pdfPrintUtil.setPrintRequestUserInfo(userInfo);
@@ -598,8 +604,10 @@ public class IntegrationSearchServiceBean extends AbstractServiceBean implements
doc.save(resultFilePath);
doc.close();
- result.put("fileName", "사전통지서.pdf");
+ String downloadFileName = pdfPrintUtil.getFormatKorName()+"_"+pdfPrintUtil.getPrintRequestDt()+".pdf";
+ result.put("filename", downloadFileName);
result.put("filePath", resultFilePath);
+ result.put("file", new File(resultFilePath));
} catch (Exception e) {
e.printStackTrace();
@@ -610,8 +618,8 @@ public class IntegrationSearchServiceBean extends AbstractServiceBean implements
}
@Override
- public Map makeOutsourcingFile(String formatName, PrintOption printOption, String[] crdnIds) {
- Map result = new HashMap<>();
+ public Map makeOutsourcingFile(String formatName, PrintOption printOption, String[] crdnIds) {
+ Map result = new HashMap<>();
Hangul hangul = new Hangul(2);
@@ -728,8 +736,9 @@ public class IntegrationSearchServiceBean extends AbstractServiceBean implements
zipFile.addFolder(new File(imagesFolderPath));
zipFile.close();
+ result.put("filename", zipFileName);
result.put("filePath", zipFilePath);
- result.put("fileName", zipFileName);
+ result.put("file", new File(zipFilePath));
} catch (IOException e) {
throw new RuntimeException("외주파일생성 중 오류가 발생하였습니다.");
diff --git a/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java b/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java
index 4fd929bb..cd1c7b96 100644
--- a/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java
+++ b/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java
@@ -531,9 +531,9 @@ public class Sprt01Controller extends ApplicationController {
* @return 사전통지서 PDF파일
*/
public ModelAndView makeAdvntcePdf(PrintOption printOption, String[] crdnIds) {
- ModelAndView mav = new ModelAndView("jsonView");
+ ModelAndView mav = new ModelAndView("downloadView");
- Map result = integrationSearchService.makePdfFile("info", "advntce", printOption, crdnIds);
+ Map result = integrationSearchService.makePdfFile("info", "advntce", printOption, crdnIds);
mav.addAllObjects(result);
return mav;
@@ -544,9 +544,9 @@ public class Sprt01Controller extends ApplicationController {
* @return 사전통지서 압축파일
*/
public ModelAndView makeAdvntceOutsourcing(PrintOption printOption, String[] crdnIds) {
- ModelAndView mav = new ModelAndView("jsonView");
+ ModelAndView mav = new ModelAndView("downloadView");
- Map result = integrationSearchService.makeOutsourcingFile("advntce", printOption, crdnIds);
+ Map result = integrationSearchService.makeOutsourcingFile("advntce", printOption, crdnIds);
mav.addAllObjects(result);
return mav;
@@ -569,9 +569,9 @@ public class Sprt01Controller extends ApplicationController {
* @return 고지서 PDF파일
*/
public ModelAndView makeNhtPdf(PrintOption printOption, String[] crdnIds) {
- ModelAndView mav = new ModelAndView("jsonView");
+ ModelAndView mav = new ModelAndView("downloadView");
- Map result = integrationSearchService.makePdfFile("info", "nht", printOption, crdnIds);
+ Map result = integrationSearchService.makePdfFile("info", "nht", printOption, crdnIds);
mav.addAllObjects(result);
return mav;
@@ -581,9 +581,9 @@ public class Sprt01Controller extends ApplicationController {
* @return 고지서 압축파일
*/
public ModelAndView makeNhtOutsourcing(PrintOption printOption, String[] crdnIds) {
- ModelAndView mav = new ModelAndView("jsonView");
+ ModelAndView mav = new ModelAndView("downloadView");
- Map result = integrationSearchService.makeOutsourcingFile("nht", printOption, crdnIds);
+ Map result = integrationSearchService.makeOutsourcingFile("nht", printOption, crdnIds);
mav.addAllObjects(result);
return mav;
diff --git a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01140-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01140-info.jsp
index 64f5ccfc..deeec2cd 100644
--- a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01140-info.jsp
+++ b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01140-info.jsp
@@ -134,25 +134,34 @@ $(document).ready(function(){
crdnIds : $P.crdnIds.join(","),
taskSeCd : taskSeCd
};
+
+ var inBrowser = false;
if(fileType == "pdf"){
submitParam.paperSeCd = paper;
+ inBrowser = true;
}
- ajax.post({
- url : url,
- data : submitParam,
- success : (resp) => {
- if(resp.filePath != null && resp.filePath != ""){
-
- if(fileType == "pdf"){
- openPDF(resp.filePath, resp.fileName, resp.fileName);
- } else {
- downloadFile(resp.filePath, resp.fileName, "tempArea--${pageName}");
- }
-
- }
- }
- });
+
+ if(inBrowser){
+
+ var parameter = toQuery(submitParam);
+ var filenameInHeader = "";
+
+ fetch(url + "?" + parameter)
+ .then((response) => {
+ var header = response.headers.get('Content-Disposition');
+ var parts = header.split(';');
+ filenameInHeader = decodeURIComponent(parts[1].split('=')[1]);
+ return response.blob();
+ })
+ .then((blob) => {
+ openPDF(blob, filenameInHeader);
+ });
+ } else {
+ var parameter = toQuery(submitParam);
+ document.location.href = url + "?" + parameter;
+ }
+
}
$P.fnOpenOtptStng = () => {
diff --git a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01150-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01150-info.jsp
index 8c923866..d16d2e7a 100644
--- a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01150-info.jsp
+++ b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01150-info.jsp
@@ -132,25 +132,33 @@ $(document).ready(function(){
crdnIds : $P.crdnIds.join(","),
taskSeCd : taskSeCd
};
+
+ var inBrowser = false;
if(fileType == "pdf"){
submitParam.paperSeCd = paper;
+ inBrowser = true;
+ }
+
+ if(inBrowser){
+ var parameter = toQuery(submitParam);
+ var filenameInHeader = "";
+
+ fetch(url + "?" + parameter)
+ .then((response) => {
+ var header = response.headers.get('Content-Disposition');
+ var parts = header.split(';');
+ filenameInHeader = decodeURIComponent(parts[1].split('=')[1]);
+ return response.blob();
+ })
+ .then((blob) => {
+ openPDF(blob, filenameInHeader);
+ });
+
+ } else {
+ var parameter = toQuery(submitParam);
+ document.location.href = url + "?" + parameter;
}
- ajax.post({
- url : url,
- data : submitParam,
- success : (resp) => {
- if(resp.filePath != null && resp.filePath != ""){
-
- if(fileType == "pdf"){
- openPDF(resp.filePath, resp.fileName, resp.fileName);
- } else {
- downloadFile(resp.filePath, resp.fileName, "tempArea--${pageName}");
- }
-
- }
- }
- });
}
$P.fnOpenOtptStng = () => {
diff --git a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01200-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01200-main.jsp
index ba12701a..110b2c97 100644
--- a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01200-main.jsp
+++ b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01200-main.jsp
@@ -759,16 +759,20 @@ $(document).ready(function(){
return;
}
- ajax.post({
- url : url,
- data : submitParam,
- success : (resp) => {
- if(resp.filePath != null && resp.filePath != ""){
- openPDF(resp.filePath, resp.fileName, "pdf_sample");
- }
- }
+ var parameter = toQuery(submitParam);
+ var filenameInHeader = "";
+
+ fetch(url + "?" + parameter)
+ .then((response) => {
+ var header = response.headers.get('Content-Disposition');
+ var parts = header.split(';');
+ filenameInHeader = decodeURIComponent(parts[1].split('=')[1]);
+ return response.blob();
+ })
+ .then((blob) => {
+ openPDF(blob, "pdf_sample");
});
-
+
}
//배경이미지 출력 순서 고정
diff --git a/src/main/webapp/resources/html/pdf.html b/src/main/webapp/resources/html/pdf.html
index 5fb49a3e..2e875dbe 100644
--- a/src/main/webapp/resources/html/pdf.html
+++ b/src/main/webapp/resources/html/pdf.html
@@ -51,17 +51,13 @@
-