diff --git a/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java b/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java index d0113515..e616e16b 100644 --- a/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java +++ b/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java @@ -317,4 +317,8 @@ public class CmmnUtil { return result.toString(); } + public static String convertNumberToHangul(int number) { + String numStr = Integer.toString(number); + return convertNumberToHangul(numStr); + } } diff --git a/src/main/java/cokr/xit/fims/cmmn/FactionUtil.java b/src/main/java/cokr/xit/fims/cmmn/FactionUtil.java index 46717546..e462f0a9 100644 --- a/src/main/java/cokr/xit/fims/cmmn/FactionUtil.java +++ b/src/main/java/cokr/xit/fims/cmmn/FactionUtil.java @@ -11,7 +11,7 @@ public class FactionUtil { if(instNm.endsWith("구") || instNm.endsWith("군")) { instNm += "청"; } - if(!jang) { + if(jang) { instNm += "장"; } return instNm; 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 fea10113..3f4417d0 100644 --- a/src/main/java/cokr/xit/fims/cmmn/hwp/AddUtil.java +++ b/src/main/java/cokr/xit/fims/cmmn/hwp/AddUtil.java @@ -1,14 +1,9 @@ package cokr.xit.fims.cmmn.hwp; -import java.util.ArrayList; - 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.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; @@ -20,16 +15,18 @@ public class AddUtil { */ public static void appendToLast(HWPFile attachHWPFile, HWPFile baseHWPFile) throws Exception { - if (attachHWPFile != null && baseHWPFile != null) { - - - Paragraph attachParagraph = attachHWPFile.getBodyText().getSectionList().get(0).getParagraph(0); + if (attachHWPFile != null && baseHWPFile != null) { + Paragraph[] ps = attachHWPFile.getBodyText().getSectionList().get(0).getParagraphs(); - ParagraphListInterface baseSection = baseHWPFile.getBodyText().getSectionList().get(0); + ParagraphListInterface baseSection = baseHWPFile.getBodyText().getLastSection(); ParagraphAdder paraAdder = new ParagraphAdder(baseHWPFile, baseSection); - paraAdder.add(attachHWPFile, attachParagraph); + + for(int i=0; i= 1) { - ArrayList cl = cpl.getParagraph(0).getControlList(); - if(cl != null && cl.size() != 0) { - - ControlFilter tableFilter = (control, paragrpah, section) -> { - ControlType ct = control.getType(); - if(ct.getCtrlId() == ControlType.Table.getCtrlId()) { - return true; - } else { - return false; - } - }; - - for(Control c : cl) { - boolean matched = tableFilter.isMatched(c, null, null); - if(matched) { - isEmptyCell = false; - } - } - } - } - - if(isEmptyCell) { - cpl.deleteAllParagraphs(); - } - 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); - } + 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/InsertingImageCell.java b/src/main/java/cokr/xit/fims/cmmn/hwp/InsertingImageCell.java index 2cede7a2..2eb33c6c 100644 --- a/src/main/java/cokr/xit/fims/cmmn/hwp/InsertingImageCell.java +++ b/src/main/java/cokr/xit/fims/cmmn/hwp/InsertingImageCell.java @@ -47,11 +47,12 @@ public class InsertingImageCell { public static void IMPL_InsertPicture(HWPFile hwpFile, String fieldName, String imgFilePath) throws IOException { if(imgFilePath != null && !imgFilePath.equals("")) { - InsertingImageCell tii = new InsertingImageCell(); - tii.insertShapeWithImage(hwpFile, fieldName, imgFilePath); + File file = new File(imgFilePath); + if(file.exists()) { + InsertingImageCell tii = new InsertingImageCell(); + tii.insertShapeWithImage(hwpFile, fieldName, imgFilePath); + } } - - } private final String imageFileExt = "jpg"; @@ -69,6 +70,7 @@ public class InsertingImageCell { private void insertShapeWithImage(HWPFile hwpFile, String fieldName, String imgFilePath) throws IOException { + this.hwpFile = hwpFile; this.fieldName = fieldName; this.imageFilePath = imgFilePath; 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 d8b635d4..d295b50d 100644 --- a/src/main/java/cokr/xit/fims/cmmn/hwp/PrintUtil.java +++ b/src/main/java/cokr/xit/fims/cmmn/hwp/PrintUtil.java @@ -34,6 +34,8 @@ public class PrintUtil { private int totalPartFileCount; + private int fileNameIndex; + public String getFormatType() { return this.formatType; } @@ -173,7 +175,8 @@ public class PrintUtil { if(!formatFileResultFolder.exists()) { formatFileResultFolder.mkdirs(); } - String resultHwpPath = formatFileResultFolderPath + File.separator + currentTime + ".hwp"; + String resultHwpPath = formatFileResultFolderPath + + File.separator + currentTime + "_" + (this.fileNameIndex++) + ".hwp"; HWPWriter.toFile(baseFormatFile, resultHwpPath); return resultHwpPath; @@ -191,11 +194,11 @@ public class PrintUtil { public void setGlobalInfo(PrintOption printOption, List dataObjectList, HWPFile baseFile) { int totalDataCount = dataObjectList.size(); - boolean privateInfoYn = true; if(printOption.getPrivateInfoYn() != null && printOption.getPrivateInfoYn().equals("N")) { privateInfoYn = false; } + Map globalVariable = printOption.getGlobalVariable(); if(this.formatName.equals("crdnList")){ @@ -225,13 +228,85 @@ public class PrintUtil { baseFileEditor.set("발신", instNm); } else if(this.formatName.equals("requestForDelivery")){ - //TODO : - //파라미터 : 문서번호,사건번호 - //체납자성명,체납자번호,차량번호,주소,교부청구금액,교부청구금액한글, + ClickHereEditor baseFileEditor = new ClickHereEditor(baseFile); + + baseFileEditor.set("문서번호", globalVariable.get("docNo")); + baseFileEditor.set("사건번호", globalVariable.get("caseNo")); + baseFileEditor.set("수신", globalVariable.get("receiver")); + baseFileEditor.set("체납자성명", globalVariable.get("rtpyrNm")); + baseFileEditor.set("체납자번호", globalVariable.get("rtpyrNo")); + baseFileEditor.set("차량번호", globalVariable.get("vhrno")); + baseFileEditor.set("주소", globalVariable.get("rtpyrFullAddr")); + + int sumOfList = dataObjectList.stream().mapToInt(item -> item.number("SUM_AMT").intValue()).sum(); + + baseFileEditor.set("합계금액", CmmnUtil.addCommaToNumber(sumOfList)); + baseFileEditor.set("교부청구금액", CmmnUtil.addCommaToNumber(sumOfList)); + baseFileEditor.set("교부청구금액한글", CmmnUtil.convertNumberToHangul(sumOfList)); + + baseFileEditor.set("개설은행", globalVariable.get("dtbnBankNm")); + baseFileEditor.set("계좌번호", globalVariable.get("dtbnActno")); + + String instNm = (String) this.printRequestUserInfo.getInfo().get("instNm"); + String deptNm = (String) this.printRequestUserInfo.getInfo().get("deptNm"); + baseFileEditor.set("예금주", instNm + " " + deptNm); + + String printRequestYmd = this.printRequestDt.substring(0, 8); + String yyyy = printRequestYmd.substring(0, 4); + String mm = printRequestYmd.substring(4, 6); + String dd = printRequestYmd.substring(6, 8); + String ymd = yyyy+"년 "+mm+"월 "+dd+"일"; + baseFileEditor.set("연월일", ymd); + + instNm = FactionUtil.getLastWord(instNm); + instNm = FactionUtil.getInstituteLeader(instNm, false); + baseFileEditor.set("발신", instNm); + + try { + InsertingImageCell.IMPL_InsertPicture(baseFile, "직인", globalVariable.get("offcsFilePath")); + } catch (Exception e) { + throw new RuntimeException("한글 파일 출력 중 오류가 발생하였습니다."); + } } else if(this.formatName.equals("reportOnClaims")){ - //TODO : + + ClickHereEditor baseFileEditor = new ClickHereEditor(baseFile); + + baseFileEditor.set("주소", globalVariable.get("deptAddr")); + baseFileEditor.set("전화", globalVariable.get("deptTelno")); + baseFileEditor.set("팩스", globalVariable.get("deptFxno")); + baseFileEditor.set("담당자", this.printRequestUserInfo.getName()); + + baseFileEditor.set("사건번호", globalVariable.get("caseNo")); + baseFileEditor.set("체납자성명", globalVariable.get("rtpyrNm")); + baseFileEditor.set("체납자번호", globalVariable.get("rtpyrNo")); + baseFileEditor.set("체납자주소", globalVariable.get("rtpyrFullAddr")); + + int sumOfList = dataObjectList.stream().mapToInt(item -> item.number("SUM_AMT").intValue()).sum(); + + baseFileEditor.set("채권청구액", CmmnUtil.addCommaToNumber(sumOfList)); + baseFileEditor.set("합계금액", CmmnUtil.addCommaToNumber(sumOfList)); + baseFileEditor.set("합계금액한글", CmmnUtil.convertNumberToHangul(sumOfList)); + + String printRequestYmd = this.printRequestDt.substring(0, 8); + String yyyy = printRequestYmd.substring(0, 4); + String mm = printRequestYmd.substring(4, 6); + String dd = printRequestYmd.substring(6, 8); + String ymd = yyyy+"년 "+mm+"월 "+dd+"일"; + baseFileEditor.set("연월일", ymd); + + String instNm = (String) this.printRequestUserInfo.getInfo().get("instNm"); + instNm = FactionUtil.getLastWord(instNm); + instNm = FactionUtil.getInstituteLeader(instNm, false); + baseFileEditor.set("발신", instNm); + + try { + InsertingImageCell.IMPL_InsertPicture(baseFile, "직인", globalVariable.get("offcsFilePath")); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("한글 파일 출력 중 오류가 발생하였습니다."); + } } } @@ -268,11 +343,22 @@ public class PrintUtil { attachFileEditor.set("수납일자", DataFormat.yyyy_mm_dd(dataObject.string("RCVMT_YMD"))); } else if(this.formatName.equals("requestForDelivery")){ - //TODO : + + attachFileEditor.set("징수과목", dataObject.string("TXITM_NM")); + attachFileEditor.set("고지번호", dataObject.string("GOJI_NO")); + attachFileEditor.set("과태료계", CmmnUtil.addCommaToNumber(dataObject.string("SUM_AMT"))); + attachFileEditor.set("법정기일", DataFormat.yyyy_mm_dd(dataObject.string("DUDT_YMD"))); } else if(this.formatName.equals("reportOnClaims")){ - //TODO : + + attachFileEditor.set("년도", dataObject.string("FYR")); + attachFileEditor.set("과세번호", dataObject.string("GOJI_NO")); + attachFileEditor.set("법정기일", DataFormat.yyyy_mm_dd(dataObject.string("DUDT_YMD"))); + attachFileEditor.set("세목", dataObject.string("TXITM_NM")); + attachFileEditor.set("세액", CmmnUtil.addCommaToNumber(dataObject.string("LEVY_PCPTAX"))); + attachFileEditor.set("가산금", CmmnUtil.addCommaToNumber(dataObject.string("LEVY_ADAMT"))); + attachFileEditor.set("합계", CmmnUtil.addCommaToNumber(dataObject.string("SUM_AMT"))); } diff --git a/src/main/java/cokr/xit/fims/sprt/SprtQuery.java b/src/main/java/cokr/xit/fims/sprt/SprtQuery.java index 19a4585d..a2ac84a6 100644 --- a/src/main/java/cokr/xit/fims/sprt/SprtQuery.java +++ b/src/main/java/cokr/xit/fims/sprt/SprtQuery.java @@ -14,6 +14,8 @@ public class SprtQuery extends CmmnQuery { private String[] cvlcptDscsnIDs; // ID private String crdnId; // 단속 ID + private String[] crdnIDs; + private String rtpyrId; // 납부자 ID private String levyExclId; // 부과 제외 ID private String opnnId; // 의견 ID @@ -66,6 +68,16 @@ public class SprtQuery extends CmmnQuery { return self(); } + public String[] getCrdnIDs() { + return ifEmpty(crdnIDs, () -> null); + } + + public T setCrdnIDs(String... crdnIDs) { + this.crdnIDs = crdnIDs; + + return self(); + } + public String getRtpyrId() { return ifEmpty(rtpyrId, () -> null); } 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 11d5865e..ac1a0c8a 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 @@ -20,6 +20,7 @@ import cokr.xit.fims.crdn.CrdnQuery; import cokr.xit.fims.crdn.dao.CrdnListMapper; import cokr.xit.fims.sprt.PrintOption; import cokr.xit.fims.sprt.SprtQuery; +import cokr.xit.fims.sprt.dao.IntegrationSearchMapper; import cokr.xit.fims.sprt.service.Sprt01Service; import cokr.xit.foundation.UserInfo; import cokr.xit.foundation.component.AbstractServiceBean; @@ -57,6 +58,9 @@ public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Serv @Resource(name = "stngBean") protected StngBean stngBean; + @Resource(name = "integrationSearchMapper") + protected IntegrationSearchMapper integrationSearchMapper; + @Override public List getIntegrationDataList(SprtQuery query) { return sprt01Bean.getIntegrationDataList(query); @@ -80,6 +84,9 @@ public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Serv factionBean.initUserInfo(userInfo); printUtil.setPrintRequestUserInfo(userInfo); + DataObject sggStngInfo = stngBean.getStng("sgg"); + DataObject deptStngInfo = stngBean.getStng("dept"); + List dataObjectList = null; if(formatName.equals("crdnList")) { @@ -111,21 +118,33 @@ public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Serv } } else if(formatName.equals("requestForDelivery")) { - //TODO : - //query.set(); - //dataObjectList = Mapper.selectList(query); + SprtQuery sprtQuery = new SprtQuery(); + sprtQuery.setCrdnIDs(crdnIds); + dataObjectList = integrationSearchMapper.selectIntegrationDataList(sprtQuery); - DataObject stngInfo = stngBean.getStng("dept"); Map globalVariable = printOption.getGlobalVariable(); - globalVariable.put("dtbnBankNm", stngInfo.string("DTBN_BANK_NM")); - globalVariable.put("dtbnActno", stngInfo.string("DTBN_ACTNO")); + + globalVariable.put("dtbnBankNm", deptStngInfo.string("DTBN_BANK_NM")); + globalVariable.put("dtbnActno", deptStngInfo.string("DTBN_ACTNO")); + globalVariable.put("offcsFilePath", sggStngInfo.string("OFFCS_FILE_PATH")); + printOption.setGlobalVariable(globalVariable); } else if(formatName.equals("reportOnClaims")) { - //TODO : - //query.set(); - //dataObjectList = Mapper.selectList(query); + SprtQuery sprtQuery = new SprtQuery(); + sprtQuery.setCrdnIDs(crdnIds); + dataObjectList = integrationSearchMapper.selectIntegrationDataList(sprtQuery); + Map globalVariable = printOption.getGlobalVariable(); + + String deptNm = (String) printUtil.getPrintRequestUserInfo().getInfo().get("deptNm"); + String deptAddr = sggStngInfo.string("INST_FULL_ADDR") + " " + deptNm; + globalVariable.put("deptAddr", deptAddr); + globalVariable.put("deptTelno", deptStngInfo.string("DEPT_TELNO")); + globalVariable.put("deptFxno", deptStngInfo.string("DEPT_FXNO")); + globalVariable.put("offcsFilePath", sggStngInfo.string("OFFCS_FILE_PATH")); + + printOption.setGlobalVariable(globalVariable); } int totalDataCount = dataObjectList.size(); @@ -136,7 +155,6 @@ public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Serv try { int dataIndex = 0; - for(int partFileIndex = 0; partFileIndex < printUtil.getTotalPartFileCount(); partFileIndex++) { //새 파일 생성 diff --git a/src/main/resources/format/reportOnClaims_inner.hwp b/src/main/resources/format/reportOnClaims_inner.hwp new file mode 100644 index 00000000..59bc6a66 Binary files /dev/null and b/src/main/resources/format/reportOnClaims_inner.hwp differ diff --git a/src/main/resources/format/reportOnClaims_root.hwp b/src/main/resources/format/reportOnClaims_root.hwp new file mode 100644 index 00000000..6f8c5447 Binary files /dev/null and b/src/main/resources/format/reportOnClaims_root.hwp differ diff --git a/src/main/resources/format/requestForDelivery_inner.hwp b/src/main/resources/format/requestForDelivery_inner.hwp new file mode 100644 index 00000000..48754ea7 Binary files /dev/null and b/src/main/resources/format/requestForDelivery_inner.hwp differ diff --git a/src/main/resources/format/requestForDelivery_root.hwp b/src/main/resources/format/requestForDelivery_root.hwp new file mode 100644 index 00000000..424be877 Binary files /dev/null and b/src/main/resources/format/requestForDelivery_root.hwp differ diff --git a/src/main/resources/sql/mapper/fims/cmmn/stng-mapper.xml b/src/main/resources/sql/mapper/fims/cmmn/stng-mapper.xml index 4f7a80f2..1b005098 100644 --- a/src/main/resources/sql/mapper/fims/cmmn/stng-mapper.xml +++ b/src/main/resources/sql/mapper/fims/cmmn/stng-mapper.xml @@ -13,6 +13,8 @@ SELECT USER_ID /* 시군구 설정정보 조회 stngMapper.selectSggStng) */ SELECT SGG_CD + , (CASE + WHEN INST_DADDR IS NULL OR INST_DADDR = '' + THEN INST_ADDR + ELSE CONCAT(INST_ADDR,' ',INST_DADDR) + END) AS INST_FULL_ADDR , OFFCS_FILE_PATH , OFFCS_FILE_NM FROM TB_SGG_INFO diff --git a/src/main/resources/sql/mapper/fims/sprt/integrationSearch-mapper.xml b/src/main/resources/sql/mapper/fims/sprt/integrationSearch-mapper.xml index e375df96..8f0477b0 100644 --- a/src/main/resources/sql/mapper/fims/sprt/integrationSearch-mapper.xml +++ b/src/main/resources/sql/mapper/fims/sprt/integrationSearch-mapper.xml @@ -159,6 +159,9 @@ LEFT OUTER JOIN TB_PAYER P ON (C.RTPYR_ID = P.RTPYR_ID) LEFT OUTER JOIN TB_LEVY L ON (C.CRDN_ID = L.CRDN_ID AND L.DEL_YN = 'N') /* 부과 대장 */ LEFT OUTER JOIN TB_RCVMT R ON (L.LEVY_ID = R.LEVY_ID AND R.DEL_YN = 'N') /* 수납 대장 */ WHERE C.DEL_YN = 'N' + + AND C.CRDN_ID IN (#{CRDN_ID}) + AND C.SGG_CD = #{sggCd}