PDF파일 생성시 오류 메시지 추가

main
이범준 5 months ago
parent 20ec46ad64
commit 8e47ef0f93

@ -3,6 +3,7 @@ package cokr.xit.fims.cmmn;
import java.io.BufferedWriter; import java.io.BufferedWriter;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -254,6 +255,8 @@ public class OutsourcingFileMaker {
result.put("download", this.getDownloadable().setFilename(zipFileName)); result.put("download", this.getDownloadable().setFilename(zipFileName));
result.put("downloadData", data); result.put("downloadData", data);
result.put("dataNames", this.filterDownloadDataNames()); result.put("dataNames", this.filterDownloadDataNames());
} catch(FileNotFoundException e) {
throw new RuntimeException("파일을 찾을 수 없습니다.");
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException("외주파일생성 중 오류가 발생하였습니다."); throw new RuntimeException("외주파일생성 중 오류가 발생하였습니다.");
} }

@ -2,6 +2,7 @@ package cokr.xit.fims.cmmn.pdf.print.format;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
@ -450,6 +451,8 @@ public abstract class PDFPrintFormat {
result.put("downloadData", data); result.put("downloadData", data);
result.put("dataNames", this.filterDownloadDataNames()); result.put("dataNames", this.filterDownloadDataNames());
} catch(FileNotFoundException e) {
throw new RuntimeException("파일을 찾을 수 없습니다.");
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("출력오류."+e); throw new RuntimeException("출력오류."+e);
} }

@ -505,10 +505,13 @@
}; };
let url = ""; let url = "";
let fileTypeName = "";
if (fileType == "pdf") { if (fileType == "pdf") {
url = wctx.url("/" + submitParam.taskSeCd + "${infoPrefixUrl}" + "/080/makeAdvntcePdf.do"); url = wctx.url("/" + submitParam.taskSeCd + "${infoPrefixUrl}" + "/080/makeAdvntcePdf.do");
fileTypeName = "PDF 파일";
} else if (fileType == "outsourcing") { } else if (fileType == "outsourcing") {
url = wctx.url("/" + submitParam.taskSeCd + "${infoPrefixUrl}" + "/080/makeAdvntceOutsourcing.do"); url = wctx.url("/" + submitParam.taskSeCd + "${infoPrefixUrl}" + "/080/makeAdvntceOutsourcing.do");
fileTypeName = "외주 요청 파일";
} }
let inBrowser = false; let inBrowser = false;
@ -524,13 +527,25 @@
fetch(url + "?" + parameter) fetch(url + "?" + parameter)
.then((response) => { .then((response) => {
var header = response.headers.get('Content-Disposition'); var header = response.headers.get('Content-Disposition');
if(!header){
response.json().then((responseJson)=>{
dialog.alert({
content: fileTypeName+" 생성 중 오류가 발생하였습니다."
+"<br/>"
+responseJson.description,
init: () => { setDialogZindex(); }
});
});
new Error("");
}
var parts = header.split(';'); var parts = header.split(';');
filenameInHeader = decodeURIComponent(parts[1].split('=')[1]); filenameInHeader = decodeURIComponent(parts[1].split('=')[1]);
return response.blob(); return response.blob();
}) })
.then((blob) => { .then((blob) => {
openPDF(blob, filenameInHeader); openPDF(blob, filenameInHeader);
}); })
.catch(()=>{});
} else { } else {
var parameter = toQuery(submitParam); var parameter = toQuery(submitParam);
document.location.href = url + "?" + parameter; document.location.href = url + "?" + parameter;

@ -338,8 +338,10 @@
// //
if (fileType == "pdf") { if (fileType == "pdf") {
url = wctx.url("/sprt/sprt01/150/makeNhtPdf.do"); url = wctx.url("/sprt/sprt01/150/makeNhtPdf.do");
fileTypeName = "PDF 파일";
} else if (fileType == "outsourcing") { } else if (fileType == "outsourcing") {
url = wctx.url("/sprt/sprt01/150/makeNhtOutsourcing.do"); url = wctx.url("/sprt/sprt01/150/makeNhtOutsourcing.do");
fileTypeName = "외주 요청 파일";
} }
let params = { let params = {
@ -361,6 +363,17 @@
fetch(url + "?" + parameter) fetch(url + "?" + parameter)
.then((response) => { .then((response) => {
let header = response.headers.get('Content-Disposition'); let header = response.headers.get('Content-Disposition');
if(!header){
response.json().then((responseJson)=>{
dialog.alert({
content: fileTypeName+" 생성 중 오류가 발생하였습니다."
+"<br/>"
+responseJson.description,
init: () => { setDialogZindex(); }
});
});
new Error("");
}
let parts = header.split(';'); let parts = header.split(';');
filenameInHeader = decodeURIComponent(parts[1].split('=')[1]); filenameInHeader = decodeURIComponent(parts[1].split('=')[1]);
@ -368,7 +381,8 @@
}) })
.then((blob) => { .then((blob) => {
openPDF(blob, filenameInHeader); openPDF(blob, filenameInHeader);
}); })
.catch(()=>{});
} else { } else {
let parameter = toQuery(params); let parameter = toQuery(params);
document.location.href = url + "?" + parameter; document.location.href = url + "?" + parameter;

@ -140,10 +140,13 @@ $(document).ready(function(){
var taskSeCd = $P.provided.getInfo(sample).TASK_SE_CD; var taskSeCd = $P.provided.getInfo(sample).TASK_SE_CD;
var url = ""; var url = "";
var fileTypeName = "";
if(fileType == "pdf"){ if(fileType == "pdf"){
url = wctx.url("/sprt/sprt01/140/makeAdvntcePdf.do"); url = wctx.url("/sprt/sprt01/140/makeAdvntcePdf.do");
fileTypeName = "PDF 파일";
} else if(fileType == "outsourcing"){ } else if(fileType == "outsourcing"){
url = wctx.url("/sprt/sprt01/140/makeAdvntceOutsourcing.do"); url = wctx.url("/sprt/sprt01/140/makeAdvntceOutsourcing.do");
fileTypeName = "외주 요청 파일";
} }
var formFields = new FimsFormFields("#frmEdit--${pageName}"); var formFields = new FimsFormFields("#frmEdit--${pageName}");
@ -170,13 +173,25 @@ $(document).ready(function(){
fetch(url + "?" + parameter) fetch(url + "?" + parameter)
.then((response) => { .then((response) => {
var header = response.headers.get('Content-Disposition'); var header = response.headers.get('Content-Disposition');
if(!header){
response.json().then((responseJson)=>{
dialog.alert({
content: fileTypeName+" 생성 중 오류가 발생하였습니다."
+"<br/>"
+responseJson.description,
init: () => { setDialogZindex(); }
});
});
new Error("");
}
var parts = header.split(';'); var parts = header.split(';');
filenameInHeader = decodeURIComponent(parts[1].split('=')[1]); filenameInHeader = decodeURIComponent(parts[1].split('=')[1]);
return response.blob(); return response.blob();
}) })
.then((blob) => { .then((blob) => {
openPDF(blob, filenameInHeader); openPDF(blob, filenameInHeader);
}); })
.catch(()=>{});
} else { } else {
var parameter = toQuery(submitParam); var parameter = toQuery(submitParam);
document.location.href = url + "?" + parameter; document.location.href = url + "?" + parameter;

@ -137,10 +137,13 @@ $(document).ready(function(){
var taskSeCd = $P.provided.getInfo(sample).TASK_SE_CD; var taskSeCd = $P.provided.getInfo(sample).TASK_SE_CD;
var url = ""; var url = "";
var fileTypeName = "";
if(fileType == "pdf"){ if(fileType == "pdf"){
url = wctx.url("/sprt/sprt01/150/makeNhtPdf.do"); url = wctx.url("/sprt/sprt01/150/makeNhtPdf.do");
fileTypeName = "PDF 파일";
} else if(fileType == "outsourcing"){ } else if(fileType == "outsourcing"){
url = wctx.url("/sprt/sprt01/150/makeNhtOutsourcing.do"); url = wctx.url("/sprt/sprt01/150/makeNhtOutsourcing.do");
fileTypeName = "외주 요청 파일";
} }
var formFields = new FimsFormFields("#frmEdit--${pageName}"); var formFields = new FimsFormFields("#frmEdit--${pageName}");
@ -165,14 +168,25 @@ $(document).ready(function(){
fetch(url + "?" + parameter) fetch(url + "?" + parameter)
.then((response) => { .then((response) => {
var header = response.headers.get('Content-Disposition'); var header = response.headers.get('Content-Disposition');
if(!header){
response.json().then((responseJson)=>{
dialog.alert({
content: fileTypeName+" 생성 중 오류가 발생하였습니다."
+"<br/>"
+responseJson.description,
init: () => { setDialogZindex(); }
});
});
new Error("");
}
var parts = header.split(';'); var parts = header.split(';');
filenameInHeader = decodeURIComponent(parts[1].split('=')[1]); filenameInHeader = decodeURIComponent(parts[1].split('=')[1]);
return response.blob(); return response.blob();
}) })
.then((blob) => { .then((blob) => {
openPDF(blob, filenameInHeader); openPDF(blob, filenameInHeader);
}); })
.catch(()=>{});
} else { } else {
var parameter = toQuery(submitParam); var parameter = toQuery(submitParam);
document.location.href = url + "?" + parameter; document.location.href = url + "?" + parameter;

@ -738,8 +738,10 @@
// //
if (fileType == "pdf") { if (fileType == "pdf") {
url = wctx.url("/sprt/sprt01/150/makeNhtPdf.do"); url = wctx.url("/sprt/sprt01/150/makeNhtPdf.do");
fileTypeName = "PDF 파일";
} else if (fileType == "outsourcing") { } else if (fileType == "outsourcing") {
url = wctx.url("/sprt/sprt01/150/makeNhtOutsourcing.do"); url = wctx.url("/sprt/sprt01/150/makeNhtOutsourcing.do");
fileTypeName = "외주 요청 파일";
} }
let params = { let params = {
@ -761,6 +763,18 @@
fetch(url + "?" + parameter) fetch(url + "?" + parameter)
.then((response) => { .then((response) => {
let header = response.headers.get('Content-Disposition'); let header = response.headers.get('Content-Disposition');
if(!header){
response.json().then((responseJson)=>{
dialog.alert({
content: fileTypeName+" 생성 중 오류가 발생하였습니다."
+"<br/>"
+responseJson.description,
init: () => { setDialogZindex(); }
});
});
new Error("");
}
let parts = header.split(';'); let parts = header.split(';');
filenameInHeader = decodeURIComponent(parts[1].split('=')[1]); filenameInHeader = decodeURIComponent(parts[1].split('=')[1]);
@ -768,7 +782,8 @@
}) })
.then((blob) => { .then((blob) => {
openPDF(blob, filenameInHeader); openPDF(blob, filenameInHeader);
}); })
.catch(()=>{});
} else { } else {
let parameter = toQuery(params); let parameter = toQuery(params);
document.location.href = url + "?" + parameter; document.location.href = url + "?" + parameter;

@ -763,13 +763,26 @@ $(document).ready(function(){
fetch(url + "?" + parameter) fetch(url + "?" + parameter)
.then((response) => { .then((response) => {
var header = response.headers.get('Content-Disposition'); var header = response.headers.get('Content-Disposition');
if(!header){
response.json().then((responseJson)=>{
dialog.alert({
content: "PDF 파일 생성 중 오류가 발생하였습니다."
+"<br/>"
+responseJson.description,
init: () => { setDialogZindex(); }
});
});
new Error("");
}
var parts = header.split(';'); var parts = header.split(';');
filenameInHeader = decodeURIComponent(parts[1].split('=')[1]); filenameInHeader = decodeURIComponent(parts[1].split('=')[1]);
return response.blob(); return response.blob();
}) })
.then((blob) => { .then((blob) => {
openPDF(blob, "pdf_sample"); openPDF(blob, "pdf_sample");
}); })
.catch(()=>{});
} }

Loading…
Cancel
Save