diff --git a/src/main/java/cokr/xit/fims/cmmn/OutsourcingFileMaker.java b/src/main/java/cokr/xit/fims/cmmn/OutsourcingFileMaker.java index 2c4d0abb..b52804b1 100644 --- a/src/main/java/cokr/xit/fims/cmmn/OutsourcingFileMaker.java +++ b/src/main/java/cokr/xit/fims/cmmn/OutsourcingFileMaker.java @@ -10,6 +10,7 @@ import java.io.OutputStream; import java.nio.file.Files; import java.nio.file.StandardCopyOption; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -38,6 +39,34 @@ public class OutsourcingFileMaker { this.printStngItems = printStngItems; } + /** + * 서식에서 사용하는 출력항목 중 사용하는 항목만 추출한다. + */ + public List filterUsedArtcls() { + List otptArtclNmList = this.printStngItems.stream().map((item) -> { return item.string("ARTCL_NM"); }).toList(); + + List result = OutsourcingFileMaker.predifinedSetForOutsourcing().stream() + .filter((item) -> { + return otptArtclNmList.contains(item.getArtclNm()); + }).toList(); + + return result; + } + + /** + * 다운로드 이력에 남길 항목명을 추출한다. + */ + public List filterDownloadDataNames() { + + List result = this.filterUsedArtcls().stream() + .filter((item) -> { + return item.isDownloadData(); + }) + .map(PredefinedSet::getArtclDscrp).toList(); + + return result; + + } public Map makeFile() { Map result = new HashMap<>(); @@ -225,7 +254,8 @@ public class OutsourcingFileMaker { resultZipFilePath = zipFilePath; result.put("download", this.getDownloadable().setFilename(zipFileName)); - + result.put("downloadData", data); + result.put("dataNames", this.filterDownloadDataNames()); } catch (IOException e) { throw new RuntimeException("외주파일생성 중 오류가 발생하였습니다."); } @@ -250,4 +280,37 @@ public class OutsourcingFileMaker { .setContentType("application/zip") .setWriter(this::write); } + + public static List predifinedSetForOutsourcing() { + List predefinedSetList = new ArrayList<>(); + predefinedSetList.add(new PredefinedSet("SNDNG_DTL_ID", "발송상세아이디").offLog()); + predefinedSetList.add(new PredefinedSet("VLTN_LAW_NM", "위반법명")); + predefinedSetList.add(new PredefinedSet("BARCODE", "바코드").offLog()); + predefinedSetList.add(new PredefinedSet("CRDN_DT", "단속일시")); + predefinedSetList.add(new PredefinedSet("DUDT_YMD", "납부기한")); + predefinedSetList.add(new PredefinedSet("VHRNO", "차량번호")); + predefinedSetList.add(new PredefinedSet("FFNLG_CARMDL_NM", "과태료차종명")); + predefinedSetList.add(new PredefinedSet("VHCL_NM", "차량명")); + predefinedSetList.add(new PredefinedSet("CRDN_PLC", "단속장소")); + predefinedSetList.add(new PredefinedSet("RTPYR_ADDR", "납부자기본주소")); + predefinedSetList.add(new PredefinedSet("RTPYR_DTL_ADDR", "납부자상세주소")); + predefinedSetList.add(new PredefinedSet("RTPYR_ZIP", "납부자우편번호")); + predefinedSetList.add(new PredefinedSet("RTPYR_NM", "납부자명")); + predefinedSetList.add(new PredefinedSet("OPNN_RANGE", "의견진술기간")); + predefinedSetList.add(new PredefinedSet("CRDN_SE_NM", "단속구분명")); + predefinedSetList.add(new PredefinedSet("ATCH_FILE_CNT", "첨부파일갯수")); + predefinedSetList.add(new PredefinedSet("FFNLG_CRDN_AMT", "과태료단속금액")); + predefinedSetList.add(new PredefinedSet("SUM_AMT", "합계금액")); + predefinedSetList.add(new PredefinedSet("RG_NO", "등기번호")); + predefinedSetList.add(new PredefinedSet("OCR0", "OCR0").offLog()); + predefinedSetList.add(new PredefinedSet("OCR0_1", "OCR0_1").offLog()); + predefinedSetList.add(new PredefinedSet("OCR0_2", "OCR0_2").offLog()); + predefinedSetList.add(new PredefinedSet("OCR_BAND1", "OCR_BAND1").offLog()); + predefinedSetList.add(new PredefinedSet("OCR_BAND2", "OCR_BAND2").offLog()); + predefinedSetList.add(new PredefinedSet("BANK_NM", "가상계좌은행명")); + predefinedSetList.add(new PredefinedSet("VR_ACTNO", "가상계좌")); + predefinedSetList.add(new PredefinedSet("EPAYNO", "전자납부번호")); + predefinedSetList.add(new PredefinedSet("EMPTY", "공백").offLog()); + return predefinedSetList; + } } diff --git a/src/main/java/cokr/xit/fims/cmmn/PredefinedSet.java b/src/main/java/cokr/xit/fims/cmmn/PredefinedSet.java index d77ae73b..1d804481 100644 --- a/src/main/java/cokr/xit/fims/cmmn/PredefinedSet.java +++ b/src/main/java/cokr/xit/fims/cmmn/PredefinedSet.java @@ -10,7 +10,17 @@ public class PredefinedSet { public PredefinedSet(String artclNm, String artclDscrp) { this.artclNm = artclNm; this.artclDscrp = artclDscrp; + this.downloadData = true; + } + protected String artclNm; + protected String artclDscrp; + protected boolean downloadData; //다운로드 이력 기재 항목 여부 + + /** + * 해당 항목을 다운로드 이력 제외 항목으로 설정한다. + */ + public PredefinedSet offLog() { + this.downloadData = false; + return this; } - private String artclNm; - private String artclDscrp; } 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 ff39a17b..83d15760 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 @@ -30,7 +30,7 @@ public class DefaultOtptArtclStng extends PredefinedSet { this.forPost = false; this.unique = false; - this.downloadData = true; + } /** @@ -59,9 +59,7 @@ public class DefaultOtptArtclStng extends PredefinedSet { return this; } - /** - * 해당 출력요소를 다운로드 이력 제외 항목으로 설정한다. - */ + @Override public DefaultOtptArtclStng offLog() { this.downloadData = false; return this; @@ -129,7 +127,7 @@ public class DefaultOtptArtclStng extends PredefinedSet { private String otptBscVl; //기본값 private boolean unique; //출력물 내 유일 요소 여부 private boolean forPost; //우편물 관련 요소 여부 - private boolean downloadData; //다운로드 이력 기재 항목 여부 + private Pstn a4; //A4 위치값 private Pstn letter; //레터 위치값 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 34beecaa..9e99bf5a 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 @@ -42,6 +42,7 @@ public abstract class PDFPrintFormat { protected List otptArtclStngList; protected String paperSeCd; protected float[] paperMilimeter = new float[2]; + protected List prototypeStngs = new ArrayList(); public abstract void initDefaultStng(); @@ -89,8 +90,6 @@ public abstract class PDFPrintFormat { }; - protected List prototypeStngs = new ArrayList(); - /** * 포맷원형을 반환한다. */ diff --git a/src/main/java/cokr/xit/fims/cmmn/service/bean/OutsourcingStngBean.java b/src/main/java/cokr/xit/fims/cmmn/service/bean/OutsourcingStngBean.java index 135d6cf8..31c58c83 100644 --- a/src/main/java/cokr/xit/fims/cmmn/service/bean/OutsourcingStngBean.java +++ b/src/main/java/cokr/xit/fims/cmmn/service/bean/OutsourcingStngBean.java @@ -11,6 +11,7 @@ import javax.annotation.Resource; import org.springframework.stereotype.Component; import cokr.xit.fims.cmmn.OutsourcingArtclStng; +import cokr.xit.fims.cmmn.OutsourcingFileMaker; import cokr.xit.fims.cmmn.OutsourcingForm; import cokr.xit.fims.cmmn.OutsourcingStngQuery; import cokr.xit.fims.cmmn.PredefinedSet; @@ -33,36 +34,8 @@ public class OutsourcingStngBean extends AbstractComponent { public Map getArtclStngMap(OutsourcingStngQuery query) { Map outsourcingStngMap = new HashMap(); - List predefinedSetList = new ArrayList<>(); - predefinedSetList.add(new PredefinedSet("SNDNG_DTL_ID", "발송상세아이디")); - predefinedSetList.add(new PredefinedSet("VLTN_LAW_NM", "위반법명")); - predefinedSetList.add(new PredefinedSet("BARCODE", "바코드")); - predefinedSetList.add(new PredefinedSet("CRDN_DT", "단속일시")); - predefinedSetList.add(new PredefinedSet("DUDT_YMD", "납부기한")); - predefinedSetList.add(new PredefinedSet("VHRNO", "차량번호")); - predefinedSetList.add(new PredefinedSet("FFNLG_CARMDL_NM", "과태료차종명")); - predefinedSetList.add(new PredefinedSet("VHCL_NM", "차량명")); - predefinedSetList.add(new PredefinedSet("CRDN_PLC", "단속장소")); - predefinedSetList.add(new PredefinedSet("RTPYR_ADDR", "납부자기본주소")); - predefinedSetList.add(new PredefinedSet("RTPYR_DTL_ADDR", "납부자상세주소")); - predefinedSetList.add(new PredefinedSet("RTPYR_ZIP", "납부자우편번호")); - predefinedSetList.add(new PredefinedSet("RTPYR_NM", "납부자명")); - predefinedSetList.add(new PredefinedSet("OPNN_RANGE", "의견진술기간")); - predefinedSetList.add(new PredefinedSet("CRDN_SE_NM", "단속구분명")); - predefinedSetList.add(new PredefinedSet("ATCH_FILE_CNT", "첨부파일갯수")); - predefinedSetList.add(new PredefinedSet("FFNLG_CRDN_AMT", "과태료단속금액")); - predefinedSetList.add(new PredefinedSet("SUM_AMT", "합계금액")); - predefinedSetList.add(new PredefinedSet("RG_NO", "등기번호")); - predefinedSetList.add(new PredefinedSet("OCR0", "OCR0")); - predefinedSetList.add(new PredefinedSet("OCR0_1", "OCR0_1")); - predefinedSetList.add(new PredefinedSet("OCR0_2", "OCR0_2")); - predefinedSetList.add(new PredefinedSet("OCR_BAND1", "OCR_BAND1")); - predefinedSetList.add(new PredefinedSet("OCR_BAND2", "OCR_BAND2")); - predefinedSetList.add(new PredefinedSet("BANK_NM", "가상계좌은행명")); - predefinedSetList.add(new PredefinedSet("VR_ACTNO", "가상계좌")); - predefinedSetList.add(new PredefinedSet("EPAYNO", "전자납부번호")); - predefinedSetList.add(new PredefinedSet("EMPTY", "공백")); - outsourcingStngMap.put("predefinedSetList", predefinedSetList); + List predefinedSetList = OutsourcingFileMaker.predifinedSetForOutsourcing(); + outsourcingStngMap.put("predefinedSetList", OutsourcingFileMaker.predifinedSetForOutsourcing()); // List outsourcingArtclStngList = outsourcingStngMapper.selectArtclStngList(query);