diff --git a/src/main/java/cokr/xit/fims/cmmn/OutsourcingFileMaker.java b/src/main/java/cokr/xit/fims/cmmn/OutsourcingFileMaker.java index 2d4e6ab4..a55b031d 100644 --- a/src/main/java/cokr/xit/fims/cmmn/OutsourcingFileMaker.java +++ b/src/main/java/cokr/xit/fims/cmmn/OutsourcingFileMaker.java @@ -3,6 +3,7 @@ package cokr.xit.fims.cmmn; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; @@ -254,6 +255,8 @@ public class OutsourcingFileMaker { result.put("download", this.getDownloadable().setFilename(zipFileName)); result.put("downloadData", data); result.put("dataNames", this.filterDownloadDataNames()); + } catch(FileNotFoundException e) { + throw new RuntimeException("파일을 찾을 수 없습니다."); } catch (IOException e) { throw new RuntimeException("외주파일생성 중 오류가 발생하였습니다."); } diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/print/format/PDFPrintFormat.java b/src/main/java/cokr/xit/fims/cmmn/pdf/print/format/PDFPrintFormat.java index 7ac5b445..8cc829b5 100644 --- a/src/main/java/cokr/xit/fims/cmmn/pdf/print/format/PDFPrintFormat.java +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/print/format/PDFPrintFormat.java @@ -2,6 +2,7 @@ package cokr.xit.fims.cmmn.pdf.print.format; import java.io.File; import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; @@ -450,6 +451,8 @@ public abstract class PDFPrintFormat { result.put("downloadData", data); result.put("dataNames", this.filterDownloadDataNames()); + } catch(FileNotFoundException e) { + throw new RuntimeException("파일을 찾을 수 없습니다."); } catch (Exception e) { throw new RuntimeException("출력오류."+e); } diff --git a/src/main/webapp/WEB-INF/jsp/fims/sndb/sndb01080-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/sndb/sndb01080-info.jsp index 8e297128..edd8ecb0 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/sndb/sndb01080-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/sndb/sndb01080-info.jsp @@ -505,10 +505,13 @@ }; let url = ""; + let fileTypeName = ""; if (fileType == "pdf") { url = wctx.url("/" + submitParam.taskSeCd + "${infoPrefixUrl}" + "/080/makeAdvntcePdf.do"); + fileTypeName = "PDF 파일"; } else if (fileType == "outsourcing") { url = wctx.url("/" + submitParam.taskSeCd + "${infoPrefixUrl}" + "/080/makeAdvntceOutsourcing.do"); + fileTypeName = "외주 요청 파일"; } let inBrowser = false; @@ -524,13 +527,25 @@ fetch(url + "?" + parameter) .then((response) => { var header = response.headers.get('Content-Disposition'); + if(!header){ + response.json().then((responseJson)=>{ + dialog.alert({ + content: fileTypeName+" 생성 중 오류가 발생하였습니다." + +"
" + +responseJson.description, + init: () => { setDialogZindex(); } + }); + }); + new Error(""); + } var parts = header.split(';'); filenameInHeader = decodeURIComponent(parts[1].split('=')[1]); return response.blob(); }) .then((blob) => { openPDF(blob, filenameInHeader); - }); + }) + .catch(()=>{}); } else { var parameter = toQuery(submitParam); document.location.href = url + "?" + parameter; diff --git a/src/main/webapp/WEB-INF/jsp/fims/sndb/sndb01120-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/sndb/sndb01120-info.jsp index cf453c5c..d6292927 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/sndb/sndb01120-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/sndb/sndb01120-info.jsp @@ -338,8 +338,10 @@ // if (fileType == "pdf") { url = wctx.url("/sprt/sprt01/150/makeNhtPdf.do"); + fileTypeName = "PDF 파일"; } else if (fileType == "outsourcing") { url = wctx.url("/sprt/sprt01/150/makeNhtOutsourcing.do"); + fileTypeName = "외주 요청 파일"; } let params = { @@ -361,6 +363,17 @@ fetch(url + "?" + parameter) .then((response) => { let header = response.headers.get('Content-Disposition'); + if(!header){ + response.json().then((responseJson)=>{ + dialog.alert({ + content: fileTypeName+" 생성 중 오류가 발생하였습니다." + +"
" + +responseJson.description, + init: () => { setDialogZindex(); } + }); + }); + new Error(""); + } let parts = header.split(';'); filenameInHeader = decodeURIComponent(parts[1].split('=')[1]); @@ -368,7 +381,8 @@ }) .then((blob) => { openPDF(blob, filenameInHeader); - }); + }) + .catch(()=>{}); } else { let parameter = toQuery(params); document.location.href = url + "?" + parameter; 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 e6e117a4..9e2831f5 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 @@ -140,10 +140,13 @@ $(document).ready(function(){ var taskSeCd = $P.provided.getInfo(sample).TASK_SE_CD; var url = ""; + var fileTypeName = ""; if(fileType == "pdf"){ url = wctx.url("/sprt/sprt01/140/makeAdvntcePdf.do"); + fileTypeName = "PDF 파일"; } else if(fileType == "outsourcing"){ url = wctx.url("/sprt/sprt01/140/makeAdvntceOutsourcing.do"); + fileTypeName = "외주 요청 파일"; } var formFields = new FimsFormFields("#frmEdit--${pageName}"); @@ -170,13 +173,25 @@ $(document).ready(function(){ fetch(url + "?" + parameter) .then((response) => { var header = response.headers.get('Content-Disposition'); + if(!header){ + response.json().then((responseJson)=>{ + dialog.alert({ + content: fileTypeName+" 생성 중 오류가 발생하였습니다." + +"
" + +responseJson.description, + init: () => { setDialogZindex(); } + }); + }); + new Error(""); + } var parts = header.split(';'); filenameInHeader = decodeURIComponent(parts[1].split('=')[1]); return response.blob(); }) .then((blob) => { openPDF(blob, filenameInHeader); - }); + }) + .catch(()=>{}); } else { var parameter = toQuery(submitParam); document.location.href = url + "?" + parameter; 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 ade06113..fbccf5f5 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 @@ -137,10 +137,13 @@ $(document).ready(function(){ var taskSeCd = $P.provided.getInfo(sample).TASK_SE_CD; var url = ""; + var fileTypeName = ""; if(fileType == "pdf"){ url = wctx.url("/sprt/sprt01/150/makeNhtPdf.do"); + fileTypeName = "PDF 파일"; } else if(fileType == "outsourcing"){ url = wctx.url("/sprt/sprt01/150/makeNhtOutsourcing.do"); + fileTypeName = "외주 요청 파일"; } var formFields = new FimsFormFields("#frmEdit--${pageName}"); @@ -165,14 +168,25 @@ $(document).ready(function(){ fetch(url + "?" + parameter) .then((response) => { var header = response.headers.get('Content-Disposition'); + if(!header){ + response.json().then((responseJson)=>{ + dialog.alert({ + content: fileTypeName+" 생성 중 오류가 발생하였습니다." + +"
" + +responseJson.description, + init: () => { setDialogZindex(); } + }); + }); + new Error(""); + } var parts = header.split(';'); filenameInHeader = decodeURIComponent(parts[1].split('=')[1]); return response.blob(); }) .then((blob) => { openPDF(blob, filenameInHeader); - }); - + }) + .catch(()=>{}); } else { var parameter = toQuery(submitParam); document.location.href = url + "?" + parameter; diff --git a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt02020-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt02020-info.jsp index 204bf7b5..06d964d5 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt02020-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt02020-info.jsp @@ -738,8 +738,10 @@ // if (fileType == "pdf") { url = wctx.url("/sprt/sprt01/150/makeNhtPdf.do"); + fileTypeName = "PDF 파일"; } else if (fileType == "outsourcing") { url = wctx.url("/sprt/sprt01/150/makeNhtOutsourcing.do"); + fileTypeName = "외주 요청 파일"; } let params = { @@ -761,6 +763,18 @@ fetch(url + "?" + parameter) .then((response) => { let header = response.headers.get('Content-Disposition'); + if(!header){ + response.json().then((responseJson)=>{ + dialog.alert({ + content: fileTypeName+" 생성 중 오류가 발생하였습니다." + +"
" + +responseJson.description, + init: () => { setDialogZindex(); } + }); + }); + new Error(""); + } + let parts = header.split(';'); filenameInHeader = decodeURIComponent(parts[1].split('=')[1]); @@ -768,7 +782,8 @@ }) .then((blob) => { openPDF(blob, filenameInHeader); - }); + }) + .catch(()=>{}); } else { let parameter = toQuery(params); document.location.href = url + "?" + parameter; diff --git a/src/main/webapp/WEB-INF/jsp/fims/stng01010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/stng01010-main.jsp index 246b6814..7d4ba136 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/stng01010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/stng01010-main.jsp @@ -763,13 +763,26 @@ $(document).ready(function(){ fetch(url + "?" + parameter) .then((response) => { var header = response.headers.get('Content-Disposition'); + if(!header){ + response.json().then((responseJson)=>{ + dialog.alert({ + content: "PDF 파일 생성 중 오류가 발생하였습니다." + +"
" + +responseJson.description, + init: () => { setDialogZindex(); } + }); + }); + new Error(""); + } + var parts = header.split(';'); filenameInHeader = decodeURIComponent(parts[1].split('=')[1]); return response.blob(); }) .then((blob) => { openPDF(blob, "pdf_sample"); - }); + }) + .catch(()=>{}); }