diff --git a/src/main/java/cokr/xit/fims/cmmn/hwp/AddUtil.java b/src/main/java/cokr/xit/fims/cmmn/hwp/AddUtil.java index 48154c3a..fea10113 100644 --- a/src/main/java/cokr/xit/fims/cmmn/hwp/AddUtil.java +++ b/src/main/java/cokr/xit/fims/cmmn/hwp/AddUtil.java @@ -5,11 +5,12 @@ import kr.dogfoot.hwplib.object.HWPFile; import kr.dogfoot.hwplib.object.bodytext.ParagraphListInterface; import kr.dogfoot.hwplib.object.bodytext.control.Control; import kr.dogfoot.hwplib.object.bodytext.control.ControlType; -import kr.dogfoot.hwplib.object.bodytext.control.table.Cell; import kr.dogfoot.hwplib.object.bodytext.paragraph.Paragraph; import kr.dogfoot.hwplib.object.bodytext.paragraph.ParagraphList; +import kr.dogfoot.hwplib.tool.objectfinder.CellFinder; import kr.dogfoot.hwplib.tool.objectfinder.ControlFilter; import kr.dogfoot.hwplib.tool.paragraphadder.ParagraphAdder; +import kr.dogfoot.hwplib.tool.paragraphadder.ParagraphMerger; public class AddUtil { @@ -37,14 +38,14 @@ public class AddUtil { * @param attachHWPFile 테이블을 가져올 외부파일, baseHWPFile 기준 파일, cell 기준 파일의 테이블셀 * @return */ - public static void insertTableInCell(HWPFile attachHWPFile, HWPFile baseHWPFile, Cell cell) throws Exception { + public static void insertTableInCell(HWPFile attachHWPFile, HWPFile baseHWPFile, String cellFieldName) throws Exception { - Paragraph attachParagraph = attachHWPFile.getBodyText().getSectionList().get(0).getParagraph(0); + ParagraphList cpl = CellFinder.findAll(baseHWPFile, cellFieldName).get(0).getParagraphList(); + boolean isEmptyCell = true; - boolean isEmptyCell = true; + Paragraph attachParagraph = attachHWPFile.getBodyText().getSectionList().get(0).getParagraph(0); - ParagraphList cpl = cell.getParagraphList(); if(cpl.getParagraphCount() >= 1) { ArrayList cl = cpl.getParagraph(0).getControlList(); if(cl != null && cl.size() != 0) { @@ -71,7 +72,15 @@ public class AddUtil { cpl.deleteAllParagraphs(); } - ParagraphAdder paraAdder = new ParagraphAdder(baseHWPFile, cpl); + ParagraphAdder paraAdder = new ParagraphAdder(baseHWPFile, cpl); paraAdder.add(attachHWPFile, attachParagraph); + + if(!isEmptyCell) { + ParagraphList cpl0 = CellFinder.findAll(baseHWPFile, cellFieldName).get(0).getParagraphList(); + ParagraphMerger paraMerger = new ParagraphMerger(); + paraMerger.merge(cpl0.getParagraph(1), cpl0.getParagraph(0)); + + cpl0.deleteParagraph(1); + } } } diff --git a/src/main/java/cokr/xit/fims/cmmn/hwp/PrintUtil.java b/src/main/java/cokr/xit/fims/cmmn/hwp/PrintUtil.java index 416b5a1c..18471ce9 100644 --- a/src/main/java/cokr/xit/fims/cmmn/hwp/PrintUtil.java +++ b/src/main/java/cokr/xit/fims/cmmn/hwp/PrintUtil.java @@ -3,7 +3,6 @@ package cokr.xit.fims.cmmn.hwp; import java.io.File; import java.io.InputStream; import java.text.SimpleDateFormat; -import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -16,9 +15,7 @@ import cokr.xit.foundation.UserInfo; import cokr.xit.foundation.data.DataFormat; import cokr.xit.foundation.data.DataObject; import kr.dogfoot.hwplib.object.HWPFile; -import kr.dogfoot.hwplib.object.bodytext.control.table.Cell; import kr.dogfoot.hwplib.reader.HWPReader; -import kr.dogfoot.hwplib.tool.objectfinder.CellFinder; import kr.dogfoot.hwplib.writer.HWPWriter; public class PrintUtil { @@ -113,7 +110,14 @@ public class PrintUtil { this.recordPerPartFile = 6; break; } - + case "requestForDelivery": { + this.recordPerPartFile = 7; + break; + } + case "reportOnClaims": { + this.recordPerPartFile = 7; + break; + } } } @@ -130,7 +134,18 @@ public class PrintUtil { this.attachFormatFilePath = "format/crdnList_inner.hwp"; break; } - + case "requestForDelivery": { + this.formatKorName = "교부청구서"; + this.baseFormatFilePath = "format/requestForDelivery_root.hwp"; + this.attachFormatFilePath = "format/requestForDelivery_inner.hwp"; + break; + } + case "reportOnClaims": { + this.formatKorName = "채권신고서"; + this.baseFormatFilePath = "format/reportOnClaims_root.hwp"; + this.attachFormatFilePath = "format/reportOnClaims_inner.hwp"; + break; + } } } @@ -210,6 +225,15 @@ public class PrintUtil { } baseFileEditor.set("발신", instNm); } + else if(this.formatName.equals("requestForDelivery")){ + //TODO : + //파라미터 : 문서번호,사건번호 + //체납자성명,체납자번호,차량번호,주소,교부청구금액,교부청구금액한글, + + } + else if(this.formatName.equals("reportOnClaims")){ + //TODO : + } } /**한글파일 서식에 대해 데이터 건별로 처리한다. @@ -244,13 +268,16 @@ public class PrintUtil { attachFileEditor.set("납부기한", DataFormat.yyyy_mm_dd(dataObject.string("DUDT_YMD"))); attachFileEditor.set("수납일자", DataFormat.yyyy_mm_dd(dataObject.string("RCVMT_YMD"))); } + else if(this.formatName.equals("requestForDelivery")){ + //TODO : - - ArrayList cellList = CellFinder.findAll(baseFile, "내부"); - Cell cell = cellList.get(0); + } + else if(this.formatName.equals("reportOnClaims")){ + //TODO : + } - AddUtil.insertTableInCell(attachFormatFile, baseFile, cell); + AddUtil.insertTableInCell(attachFormatFile, baseFile, "내부"); } else { 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 cdb9b26c..22c12366 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 @@ -106,6 +106,14 @@ public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Serv } } + } else if(formatName.equals("requestForDelivery")) { + //TODO : + //query.set(); + //dataObjectList = Mapper.selectList(query); + } else if(formatName.equals("reportOnClaims")) { + //TODO : + //query.set(); + //dataObjectList = Mapper.selectList(query); } int totalDataCount = dataObjectList.size(); 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 0616de20..d2d171a0 100644 --- a/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java +++ b/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java @@ -290,11 +290,11 @@ public class Sprt01Controller extends ApplicationController { */ public ModelAndView makeCrdnListFileFromHwpFormat(String privateInfoYn, String[] crdnIds) { Map result = null; - String format = "crdnList"; + PrintOption printOption = new PrintOption(); printOption.setPrivateInfoYn(privateInfoYn); - result = sprt01Service.makeFileFromHwpFormat("list", format, printOption ,crdnIds); + result = sprt01Service.makeFileFromHwpFormat("list", "crdnList", printOption ,crdnIds); ModelAndView mav = new ModelAndView("jsonView"); mav.addAllObjects(result); @@ -306,10 +306,10 @@ public class Sprt01Controller extends ApplicationController { */ public ModelAndView makeCrdnConfirmFileFromHwpFormat(String[] crdnIds) { Map result = null; - String format = "crdnConfirm"; + PrintOption printOption = new PrintOption(); - result = sprt01Service.makeFileFromHwpFormat("info", format, printOption, crdnIds); + result = sprt01Service.makeFileFromHwpFormat("info", "crdnConfirm", printOption, crdnIds); ModelAndView mav = new ModelAndView("jsonView"); mav.addAllObjects(result); @@ -334,8 +334,8 @@ public class Sprt01Controller extends ApplicationController { public ModelAndView makeRequestForDeliveryFileFromHwpFormat(PrintOption printOption, String[] crdnIds) { ModelAndView mav = new ModelAndView("jsonView"); - //TODO : 교부청구서 한글 파일 작성 - + Map result = sprt01Service.makeFileFromHwpFormat("list", "requestForDelivery", printOption, crdnIds); + mav.addAllObjects(result); return mav; } @@ -345,7 +345,8 @@ public class Sprt01Controller extends ApplicationController { public ModelAndView makeReportOnClaimsFileFromHwpFormat(PrintOption printOption, String[] crdnIds) { ModelAndView mav = new ModelAndView("jsonView"); - //TODO : 채권신고서 한글 파일 작성 + Map result = sprt01Service.makeFileFromHwpFormat("list", "reportOnClaims", printOption, crdnIds); + mav.addAllObjects(result); return mav; } diff --git a/src/main/resources/format/crdnList_inner.hwp b/src/main/resources/format/crdnList_inner.hwp index a1d23a61..f0f7c432 100644 Binary files a/src/main/resources/format/crdnList_inner.hwp and b/src/main/resources/format/crdnList_inner.hwp differ diff --git a/src/main/resources/format/crdnList_root.hwp b/src/main/resources/format/crdnList_root.hwp index 97c77309..bbeb63fa 100644 Binary files a/src/main/resources/format/crdnList_root.hwp and b/src/main/resources/format/crdnList_root.hwp differ