diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/DefaultOtptStng.java b/src/main/java/cokr/xit/fims/cmmn/pdf/DefaultOtptStng.java index 5e44670a..0ae57d80 100644 --- a/src/main/java/cokr/xit/fims/cmmn/pdf/DefaultOtptStng.java +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/DefaultOtptStng.java @@ -1,6 +1,5 @@ package cokr.xit.fims.cmmn.pdf; -import cokr.xit.fims.cmmn.pdf.format.Pstn; import lombok.Getter; import lombok.Setter; @@ -8,10 +7,9 @@ import lombok.Setter; @Setter public class DefaultOtptStng { - public DefaultOtptStng(String contentType, String otptNm, String colNm, String otptBscVl){ + public DefaultOtptStng(String contentType, String otptNm, String otptBscVl){ this.contentType = contentType; this.otptNm=otptNm; - this.colNm=colNm; this.otptBscVl=otptBscVl; this.widthSz=0; @@ -72,7 +70,6 @@ public class DefaultOtptStng { private String contentType; private String otptNm; - private String colNm; private String otptBscVl; private Pstn a4; private Pstn letter; diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/PDFFormat.java b/src/main/java/cokr/xit/fims/cmmn/pdf/PDFFormat.java index 8fd11f36..fca836e7 100644 --- a/src/main/java/cokr/xit/fims/cmmn/pdf/PDFFormat.java +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/PDFFormat.java @@ -3,7 +3,10 @@ package cokr.xit.fims.cmmn.pdf; import java.util.ArrayList; import java.util.List; -public class PDFFormat { +import cokr.xit.fims.sprt.PrintOption; +import cokr.xit.foundation.data.DataObject; + +public abstract class PDFFormat { protected List defaultOtptStng = new ArrayList(); @@ -11,12 +14,12 @@ public class PDFFormat { return this.defaultOtptStng; } - public DefaultOtptStng text(String otptNm, String colNm, String otptBscVl){ - return new DefaultOtptStng("text", otptNm, colNm, otptBscVl); + public DefaultOtptStng text(String otptNm, String otptBscVl){ + return new DefaultOtptStng("text", otptNm, otptBscVl); } - public DefaultOtptStng image(String otptNm, String colNm){ - return new DefaultOtptStng("image" ,otptNm, colNm, ""); + public DefaultOtptStng image(String otptNm, String otptBscVl){ + return new DefaultOtptStng("image", otptNm, otptBscVl); } public void add(DefaultOtptStng... defaultOtptStngs){ @@ -25,4 +28,7 @@ public class PDFFormat { } } + public abstract String getMappingValue(String otptNm, String defaultValue, + DataObject dataObject, PrintOption printOption, PDFPrintUtil pdfPrintUtil); + } diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/PDFPrintUtil.java b/src/main/java/cokr/xit/fims/cmmn/pdf/PDFPrintUtil.java index 45b19104..9be96f80 100644 --- a/src/main/java/cokr/xit/fims/cmmn/pdf/PDFPrintUtil.java +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/PDFPrintUtil.java @@ -175,39 +175,6 @@ public class PDFPrintUtil extends PrintUtil { } } - public String getTextValue(DefaultOtptStng defaultStng, DataObject sggStng, DataObject dataObject) { - String textValue = ""; - if(sggStng != null && !sggStng.isEmpty() && !sggStng.string("COL_NM").equals("")) { - - textValue = dataObject.string(sggStng.string("COL_NM")); - if(textValue.equals("")) { - textValue = sggStng.string("OTPT_BSC_VL"); - } - - } else { - - textValue = dataObject.string(defaultStng.getColNm()); - if(textValue.equals("")) { - textValue = defaultStng.getOtptBscVl(); - } - - } - - return textValue; - } - - public String getImagePath(DefaultOtptStng defaultStng, DataObject sggStng, DataObject dataObject) { - if(sggStng != null && !sggStng.isEmpty() && !sggStng.string("COL_NM").equals("")) { - - return dataObject.string(sggStng.string("COL_NM")); - - } else { - - return dataObject.string(defaultStng.getColNm()); - - } - } - public float[] getSize(DefaultOtptStng defaultStng, DataObject sggStng) { if(sggStng != null && !sggStng.isEmpty()) { return new float[] { diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/format/Pstn.java b/src/main/java/cokr/xit/fims/cmmn/pdf/Pstn.java similarity index 83% rename from src/main/java/cokr/xit/fims/cmmn/pdf/format/Pstn.java rename to src/main/java/cokr/xit/fims/cmmn/pdf/Pstn.java index 4dc90e15..f794f723 100644 --- a/src/main/java/cokr/xit/fims/cmmn/pdf/format/Pstn.java +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/Pstn.java @@ -1,4 +1,4 @@ -package cokr.xit.fims.cmmn.pdf.format; +package cokr.xit.fims.cmmn.pdf; import lombok.Getter; import lombok.Setter; diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/format/Advntce.java b/src/main/java/cokr/xit/fims/cmmn/pdf/format/Advntce.java index 74cdb9c7..c600afe0 100644 --- a/src/main/java/cokr/xit/fims/cmmn/pdf/format/Advntce.java +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/format/Advntce.java @@ -1,6 +1,10 @@ package cokr.xit.fims.cmmn.pdf.format; import cokr.xit.fims.cmmn.pdf.PDFFormat; +import cokr.xit.fims.cmmn.pdf.PDFPrintUtil; +import cokr.xit.fims.sprt.PrintOption; +import cokr.xit.foundation.data.DataFormat; +import cokr.xit.foundation.data.DataObject; /** * 사전통지서 @@ -9,12 +13,32 @@ public class Advntce extends PDFFormat { public Advntce(){ add( - text("CRDN_YMD","CRDN_YMD","").a4(105, 150).letter(0, 0), - text("VHRNO","VHRNO","").a4(30, 30).letter(0, 0) + text("CRDN_YMD","").a4(105, 150).letter(0, 0), + text("VHRNO","").a4(30, 30).letter(0, 0) //image("OFFCS1","OFFCS").a4(0, 0).letter(0, 0).size(0, 0), //image("OFFCS2","OFFCS").a4(0, 0).letter(0, 0).size(0, 0), //image("OFFCS3","OFFCS").a4(0, 0).letter(0, 0).size(0, 0) ); } + + @Override + public String getMappingValue(String otptNm, String defaultValue, + DataObject dataObject, PrintOption printOption, PDFPrintUtil pdfPrintUtil) { + + String result = ""; + + switch(otptNm) { + case "VHRNO" -> { + result = dataObject.string("VHRNO"); + } + case "CRDN_YMD" -> { + result = DataFormat.yyyy_mm_dd("CRDN_YMD"); + } + + } + + return result; + } + } diff --git a/src/main/java/cokr/xit/fims/sprt/service/bean/Sprt01ServiceBean.java b/src/main/java/cokr/xit/fims/sprt/service/bean/Sprt01ServiceBean.java index 1a170b5a..a1280f15 100644 --- a/src/main/java/cokr/xit/fims/sprt/service/bean/Sprt01ServiceBean.java +++ b/src/main/java/cokr/xit/fims/sprt/service/bean/Sprt01ServiceBean.java @@ -353,26 +353,30 @@ public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Serv for(DefaultOtptStng predefined : predefinedList) { - - DataObject otptItemStng = byOtptItemStng.get(predefined.getOtptNm()); + String otptNm = predefined.getOtptNm(); + DataObject otptItemStng = byOtptItemStng.get(otptNm); float[] pstn = pdfPrintUtil.getPstnStng(predefined, otptItemStng, otptPaperSeCd); - if(predefined.getContentType().equals("text")) { + String defaultValue = predefined.getOtptBscVl(); - String textValue = pdfPrintUtil.getTextValue(predefined, otptItemStng, dataObject); + if(predefined.getContentType().equals("text")) { PDType0Font font = pdfPrintUtil.getFontStng(predefined, otptItemStng, fontMap); int fontSz = pdfPrintUtil.getFontSize(predefined, otptItemStng); RenderingMode fontStyle = pdfPrintUtil.getFontStyle(predefined, otptItemStng); PDColor fontColor = pdfPrintUtil.getFontColor(predefined, otptItemStng); + String textValue = pdfFormat.getMappingValue(otptNm,defaultValue,dataObject,printOption,pdfPrintUtil); + pdfPrintUtil.writeText(contentStream, textValue, pstn, font, fontSz, fontStyle, fontColor); } else if(predefined.getContentType().equals("image")) { - String imagePath = pdfPrintUtil.getImagePath(predefined, otptItemStng, dataObject); float[] size = pdfPrintUtil.getSize(predefined, otptItemStng); + + String imagePath = pdfFormat.getMappingValue(otptNm,defaultValue,dataObject,printOption,pdfPrintUtil); + pdfPrintUtil.insertImage(doc, contentStream, imagePath, pstn, size); } diff --git a/src/main/resources/sql/mapper/fims/sprt/otptStng-mapper.xml b/src/main/resources/sql/mapper/fims/sprt/otptStng-mapper.xml index 1340bc56..4a1c1fbd 100644 --- a/src/main/resources/sql/mapper/fims/sprt/otptStng-mapper.xml +++ b/src/main/resources/sql/mapper/fims/sprt/otptStng-mapper.xml @@ -9,9 +9,7 @@ SELECT OTPT_FORM_ID , TASK_SE_CD , SNDNG_SE_CD , OTPT_PAPER_SE_CD - , COL_NM , OTPT_NM - , OTPT_BSC_VL , LEFT_PSTN , TOP_PSTN , WIDTH_SZ