From 1bc6685a42f70325ec4d04d460e8feb7515d3cb6 Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Wed, 28 Feb 2024 10:34:00 +0900 Subject: [PATCH] =?UTF-8?q?PDF=EC=B6=9C=EB=A0=A5=20=EB=8B=A4=EC=9A=B4?= =?UTF-8?q?=EB=A1=9C=EB=93=9C=20=EB=A1=9C=EA=B7=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cokr/xit/base/file/pdf/PDFWriter.java | 47 +++++++++++++++++-- .../cmmn/pdf/print/DefaultOtptArtclStng.java | 10 ++++ .../fims/cmmn/pdf/print/format/Advntce.java | 16 +++---- .../xit/fims/cmmn/pdf/print/format/Nht.java | 16 +++---- .../xit/fims/sndb/web/Sndb01Controller.java | 3 +- .../xit/fims/sprt/web/Sprt01Controller.java | 6 ++- 6 files changed, 74 insertions(+), 24 deletions(-) diff --git a/src/main/java/cokr/xit/base/file/pdf/PDFWriter.java b/src/main/java/cokr/xit/base/file/pdf/PDFWriter.java index fd2c5c30..0df18e80 100644 --- a/src/main/java/cokr/xit/base/file/pdf/PDFWriter.java +++ b/src/main/java/cokr/xit/base/file/pdf/PDFWriter.java @@ -56,20 +56,57 @@ public class PDFWriter { } } - public void setFormat(PDFPrintFormat format) { - this.format = format; - }; public void setPrint(Print print) { this.print = print; }; + public void setFormat(PDFPrintFormat format) { + this.format = format; + } + public PDFPrintFormat getFormat() { + return this.format; + } public void setOtptBscStng(DataObject otptBscStng) { this.otptBscStng = otptBscStng; - }; + } + public void setOtptArtclStngList(List otptArtclStngList) { this.otptArtclStngList = otptArtclStngList; - }; + } + + public List getOtptArtclStngList() { + return this.otptArtclStngList; + } + + /** + * 서식에서 사용하는 출력항목 중 사용하는 항목만 추출한다. + */ + public List filterUsedArtcls() { + List otptArtclNmList = this.otptArtclStngList.stream().map((item) -> { return item.string("OTPT_ARTCL_NM"); }).toList(); + + List result = this.getFormat().getPrototypeStngs().stream() + .filter((item) -> { + return otptArtclNmList.contains(item.getOtptArtclNm()); + }).toList(); + + return result; + } + + /** + * 다운로드 이력에 남길 항목명을 추출한다. + */ + public List filterDownloadDataNames() { + + List result = this.filterUsedArtcls().stream() + .filter((item) -> { + return item.isDownloadData(); + }) + .map(DefaultOtptArtclStng::getDscrp).toList(); + + return result; + } + public Map makePdfFile(String formatType, String formatName, PrintOption printOption, List dataObjectList) { Map result = new HashMap<>(); diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/print/DefaultOtptArtclStng.java b/src/main/java/cokr/xit/fims/cmmn/pdf/print/DefaultOtptArtclStng.java index 15f2485a..f854908a 100644 --- a/src/main/java/cokr/xit/fims/cmmn/pdf/print/DefaultOtptArtclStng.java +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/print/DefaultOtptArtclStng.java @@ -29,6 +29,7 @@ public class DefaultOtptArtclStng { this.forPost = false; this.unique = false; + this.downloadData = true; } /** @@ -57,6 +58,14 @@ public class DefaultOtptArtclStng { return this; } + /** + * 해당 출력요소를 다운로드 이력 제외 항목으로 설정한다. + */ + public DefaultOtptArtclStng offLog() { + this.downloadData = false; + return this; + } + /** * 출력요소의 기본 텍스트정렬을 설정한다. */ @@ -119,6 +128,7 @@ public class DefaultOtptArtclStng { private String otptBscVl; //기본값 private boolean unique; //출력물 내 유일 요소 여부 private boolean forPost; //우편물 관련 요소 여부 + private boolean downloadData; //다운로드 이력 기재 항목 여부 private String dscrp; //출력항목 설명 private String otptArtclNm; //출력항목명 diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/print/format/Advntce.java b/src/main/java/cokr/xit/fims/cmmn/pdf/print/format/Advntce.java index f13ca08e..6a2e560a 100644 --- a/src/main/java/cokr/xit/fims/cmmn/pdf/print/format/Advntce.java +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/print/format/Advntce.java @@ -78,16 +78,16 @@ public class Advntce extends PDFPrintFormat { text("vrActno10","가상계좌번호10",""), text("epayNo","전자납부번호",""), - text("otptYmd","출력일자",""), - text("otptDt","출력일시",""), - text("otptYYYY","출력년도",""), - text("otptMM","출력월",""), - text("otptDD","출력일",""), + text("otptYmd","출력일자","").offLog(), + text("otptDt","출력일시","").offLog(), + text("otptYYYY","출력년도","").offLog(), + text("otptMM","출력월","").offLog(), + text("otptDD","출력일","").offLog(), - text("offcsText","관인명",""), - image("offcs","관인이미지","").size(20, 20), + text("offcsText","관인명","").offLog(), + image("offcs","관인이미지","").size(20, 20).offLog(), - text("undefined","(미정)","미정항목") + text("undefined","(미정)","미정항목").offLog() ); } diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/print/format/Nht.java b/src/main/java/cokr/xit/fims/cmmn/pdf/print/format/Nht.java index 5e2c16aa..5101d1b3 100644 --- a/src/main/java/cokr/xit/fims/cmmn/pdf/print/format/Nht.java +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/print/format/Nht.java @@ -83,16 +83,16 @@ public class Nht extends PDFPrintFormat { text("vrActno10","가상계좌번호10",""), text("epayNo","전자납부번호",""), - text("otptYmd","출력일자",""), - text("otptDt","출력일시",""), - text("otptYYYY","출력년도",""), - text("otptMM","출력월",""), - text("otptDD","출력일",""), + text("otptYmd","출력일자","").offLog(), + text("otptDt","출력일시","").offLog(), + text("otptYYYY","출력년도","").offLog(), + text("otptMM","출력월","").offLog(), + text("otptDD","출력일","").offLog(), - text("offcsText","관인명",""), - image("offcs","관인이미지","").size(20, 20), + text("offcsText","관인명","").offLog(), + image("offcs","관인이미지","").size(20, 20).offLog(), - text("undefined","(미정)","미정항목") + text("undefined","(미정)","미정항목").offLog() ); } diff --git a/src/main/java/cokr/xit/fims/sndb/web/Sndb01Controller.java b/src/main/java/cokr/xit/fims/sndb/web/Sndb01Controller.java index ef4110ff..fe104be6 100644 --- a/src/main/java/cokr/xit/fims/sndb/web/Sndb01Controller.java +++ b/src/main/java/cokr/xit/fims/sndb/web/Sndb01Controller.java @@ -1745,7 +1745,8 @@ public class Sndb01Controller extends ApplicationController { Map result = pdfWriter.makePdfFile("info", "advntce", printOption, dataObjectList); mav.addAllObjects(result); - + mav.addObject("downloadData", dataObjectList); + mav.addObject("dataNames", pdfWriter.filterDownloadDataNames()); return mav; } 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 88e75fb2..d305fdbe 100644 --- a/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java +++ b/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java @@ -755,7 +755,8 @@ public class Sprt01Controller extends ApplicationController { Map result = pdfWriter.makePdfFile("info", "advntce", printOption, dataObjectList); mav.addAllObjects(result); - + mav.addObject("downloadData", dataObjectList); + mav.addObject("dataNames", pdfWriter.filterDownloadDataNames()); return mav; } @@ -911,7 +912,8 @@ public class Sprt01Controller extends ApplicationController { Map result = pdfWriter.makePdfFile("info", "nht", printOption, dataObjectList); mav.addAllObjects(result); - + mav.addObject("downloadData", dataObjectList); + mav.addObject("dataNames", pdfWriter.filterDownloadDataNames()); return mav; }