From 5354a34aa6da4cd278d4b651c40bd32945c805c2 Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Mon, 11 Dec 2023 17:05:53 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B3=A0=EC=A7=80=EC=84=9C=20ocr=EB=B0=B4?= =?UTF-8?q?=EB=93=9C=20=EC=B6=9C=EB=A0=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cokr/xit/fims/cmmn/CmmnUtil.java | 85 +++++++++++++++++++ .../cokr/xit/fims/cmmn/pdf/PDFFormat.java | 24 +++--- .../xit/fims/cmmn/pdf/format/Advntce.java | 2 + .../cokr/xit/fims/cmmn/pdf/format/Nht.java | 59 +++++++++++++ .../xit/fims/sndb/service/bean/SndngBean.java | 12 +-- .../fims/sprt/service/bean/OtptStngBean.java | 6 ++ .../fims/sprt/integrationSearch-mapper.xml | 1 + .../WEB-INF/jsp/fims/sprt/sprt01140-info.jsp | 1 + .../WEB-INF/jsp/fims/sprt/sprt01150-info.jsp | 1 + .../WEB-INF/jsp/fims/sprt/sprt01200-main.jsp | 4 +- 10 files changed, 178 insertions(+), 17 deletions(-) diff --git a/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java b/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java index 2faa8103..762e1c79 100644 --- a/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java +++ b/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java @@ -21,6 +21,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; +import cokr.xit.fims.sndb.service.bean.SndngBean; + public class CmmnUtil { /** @@ -273,4 +275,87 @@ public class CmmnUtil { return convert; } + public static String getOcrband1(String deptCode, String fyr, String acntgSeCd, String txitmCd, String levyNo, String inspySn) { + if(deptCode.equals("")) { + deptCode = "0000000"; + } + if(fyr.equals("")) { + fyr = "0000"; + } + if(acntgSeCd.equals("")) { + acntgSeCd = "00"; + } + if(txitmCd.equals("")) { + txitmCd = "000000"; + } + if(levyNo.equals("")) { + levyNo = "000000"; + } + if(inspySn.equals("")) { + inspySn = "00"; + } + String band1 = deptCode + "0000" + fyr + acntgSeCd + txitmCd + levyNo + inspySn; + + String ocrVrfcCode = SndngBean.getOcrVrfcCode("12357", band1, 31); + band1 = band1+ocrVrfcCode; + return band1; + } + + public static String getOcrband2(String band1, String levySeCd, int sumAmt, String dudtYmd) { + if(dudtYmd.endsWith("")) { + dudtYmd = "00000000"; + } + + String levySeCd1 = ""; + if (levySeCd.equals("01")) { + levySeCd1 = "1" ; + } else if (levySeCd.equals("02")) { + levySeCd1 = "2" ; + } else { + levySeCd1 = "2" ; + } + + String band2 = levySeCd1 + + String.format("%011d", sumAmt) + + dudtYmd + + "0"; + String ocrVrfcCode = SndngBean.getOcrVrfcCode("23571", band1 + band2, 53); + + band2 = band2 + ocrVrfcCode; + band2 = band1 + band2; + return band2; + } + + public static String getOcrband3(String band2, int sumAmt, String dudtYmd, int afterSumAmt) { + if(dudtYmd.endsWith("")) { + dudtYmd = "00000000"; + } + + // OCR 2번째줄 54 + // band3 = 국세 + 국세요율(납기후에 추가되는 가산금의 비율) + 시도세 + 시도세요율 + 시군구세 + 시군구세요율 + String band3 = "0000000000" + + "00" + + "0000000000" + + "00" + + String.format("%011d", sumAmt) + + "00"; + String ocrVrfcCode = SndngBean.getOcrVrfcCode("35712", band3, 36); + + // band4 = 부과월 + 납기후처리 + 납기후금액(12자리) + // 0=납기후 수납가능, 1=납기후 수납불가, 2=납기 무관, 7~9=납기후 수납가능 + String band4 = dudtYmd.substring(4, 6) + + "1" + + String.format("%012d", afterSumAmt); + ocrVrfcCode = SndngBean.getOcrVrfcCode("57123", band3 + band4, 52); + band4 = band4 + ocrVrfcCode; + + // band5 = 전체 합산해서 검코드 구하기용, 사용하지는 않음 + String band5 = band2 + band3 + band4; + ocrVrfcCode = SndngBean.getOcrVrfcCode("71235", band5, 107); + + // band6 + String band6 = band3 + band4 + ocrVrfcCode; + return band6; + } + } 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 2342c4cd..3c7297de 100644 --- a/src/main/java/cokr/xit/fims/cmmn/pdf/PDFFormat.java +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/PDFFormat.java @@ -83,18 +83,22 @@ public abstract class PDFFormat { */ public void appendOtptAttribute(List otptArtclStngList) { - List prototypeStngs = this.getPrototypeStngs(); + if(otptArtclStngList!=null && !otptArtclStngList.isEmpty()) { + List prototypeStngs = this.getPrototypeStngs(); + + for(DataObject otptArtclStng : otptArtclStngList) { + String otptArtclNm = (String) otptArtclStng.get("OTPT_ARTCL_NM"); + DefaultOtptArtclStng prototypeStng = prototypeStngs.stream() + .filter(item -> item.getOtptArtclNm().equals(otptArtclNm)).toList().get(0); + + otptArtclStng.set("UNIQUE_YN", prototypeStng.isUnique() ? "Y" : "N"); + otptArtclStng.set("DSCRP", prototypeStng.getDscrp()); + otptArtclStng.set("COMPONENT_TYPE", prototypeStng.getComponentType()); + otptArtclStng.set("POST_YN", prototypeStng.isForPost() ? "Y" : "N"); + } + } - for(DataObject otptArtclStng : otptArtclStngList) { - String otptArtclNm = (String) otptArtclStng.get("OTPT_ARTCL_NM"); - DefaultOtptArtclStng prototypeStng = prototypeStngs.stream() - .filter(item -> item.getOtptArtclNm().equals(otptArtclNm)).toList().get(0); - otptArtclStng.set("UNIQUE_YN", prototypeStng.isUnique() ? "Y" : "N"); - otptArtclStng.set("DSCRP", prototypeStng.getDscrp()); - otptArtclStng.set("COMPONENT_TYPE", prototypeStng.getComponentType()); - otptArtclStng.set("POST_YN", prototypeStng.isForPost() ? "Y" : "N"); - } } /** 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 b69af6bf..631107fe 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 @@ -332,6 +332,8 @@ public class Advntce extends PDFFormat { dataObject.put("VR_ACTNO10", "101010-00-000000"); dataObject.put("EPAY_NO", "00000-0-00-00-000000000"); dataObject.put("FFNLG_CRDN_AMT", "100000"); + dataObject.put("ADVNTCE_AMT", "80000"); + dataObject.put("ADVNTCE_DUDT_YMD", "20231231"); dataObject.put("CRDN_PHOTO1", "samplefiles/crdn1.png"); dataObject.put("CRDN_PHOTO2", "samplefiles/crdn2.png"); diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/format/Nht.java b/src/main/java/cokr/xit/fims/cmmn/pdf/format/Nht.java index 82ce10d5..bd141441 100644 --- a/src/main/java/cokr/xit/fims/cmmn/pdf/format/Nht.java +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/format/Nht.java @@ -36,6 +36,10 @@ public class Nht extends PDFFormat { images("crdnPhoto","단속사진","").a4(110, 100).letter(116, 95).size(90, 80), image("rprsCrdnPhoto","대표단속사진","").a4(10, 200).letter(10, 186).size(80, 80), + text("ocr1","OCR32자리",""), + text("ocr2","OCR54자리1",""), + text("ocr3","OCR54자리2",""), + text("rtpyrNm","수신자명",""), text("rtpyrNo","수신자번호",""), text("rtpyrAddr","수신자주소",""), @@ -193,6 +197,48 @@ public class Nht extends PDFFormat { result = dataObject.string("EPAY_NO"); } + case "ocr1" -> { + + String deptCode = dataObject.string("DEPT_CD"); + String fyr = dataObject.string("FYR"); + String acntgSeCd = dataObject.string("ACNTG_SE_CD"); + String txitmCd = dataObject.string("TXITM_CD"); + String levyNo = dataObject.string("LEVY_NO"); + String inspySn = dataObject.string("INSPY_SN"); + result = CmmnUtil.getOcrband1(deptCode,fyr, acntgSeCd, txitmCd, levyNo, inspySn); + } + case "ocr2" -> { + String deptCode = dataObject.string("DEPT_CD"); + String fyr = dataObject.string("FYR"); + String acntgSeCd = dataObject.string("ACNTG_SE_CD"); + String txitmCd = dataObject.string("TXITM_CD"); + String levyNo = dataObject.string("LEVY_NO"); + String inspySn = dataObject.string("INSPY_SN"); + String ocrBand1 = CmmnUtil.getOcrband1(deptCode, fyr, acntgSeCd, txitmCd, levyNo, inspySn); + + String levySeCd = dataObject.string("LEVY_SE_CD"); + int sumAmt = dataObject.number("SUM_AMT").intValue(); // 합계 금액 + String dudtYmd = dataObject.string("DUDT_YMD"); + result = CmmnUtil.getOcrband2(ocrBand1, levySeCd, sumAmt, dudtYmd); + } + case "ocr3" -> { + String deptCode = dataObject.string("DEPT_CD"); + String fyr = dataObject.string("FYR"); + String acntgSeCd = dataObject.string("ACNTG_SE_CD"); + String txitmCd = dataObject.string("TXITM_CD"); + String levyNo = dataObject.string("LEVY_NO"); + String inspySn = dataObject.string("INSPY_SN"); + String ocrBand1 = CmmnUtil.getOcrband1(deptCode, fyr, acntgSeCd, txitmCd, levyNo, inspySn); + + String levySeCd = dataObject.string("LEVY_SE_CD"); + int sumAmt = dataObject.number("SUM_AMT").intValue(); // 합계 금액 + String dudtYmd = dataObject.string("DUDT_YMD"); + String ocrBand2 = CmmnUtil.getOcrband2(ocrBand1, levySeCd, sumAmt, dudtYmd); + + int afterSumAmt = dataObject.number("DUDT_AFTR_AMT").intValue(); // 납기후 금액 + result = CmmnUtil.getOcrband3(ocrBand2, sumAmt, dudtYmd, afterSumAmt); + } + case "otptYmd" -> { result = DataFormat.yyyy_mm_dd(pdfPrintUtil.getPrintRequestDt().substring(0,8)); } @@ -327,6 +373,19 @@ public class Nht extends PDFFormat { dataObject.put("VR_ACTNO10", "101010-00-000000"); dataObject.put("EPAY_NO", "00000-0-00-00-000000000"); dataObject.put("FFNLG_CRDN_AMT", "100000"); + dataObject.put("ADVNTCE_AMT", "80000"); + dataObject.put("ADVNTCE_DUDT_YMD", "20231231"); + + dataObject.put("DEPT_CD", "4060411"); + dataObject.put("FYR", "2023"); + dataObject.put("ACNTG_SE_CD", "61"); + dataObject.put("TXITM_CD", "234006"); + dataObject.put("LEVY_NO", "123456"); + dataObject.put("INSPY_SN", "00"); + dataObject.put("LEVY_SE_CD", "01"); + dataObject.put("SUM_AMT", "80000"); + dataObject.put("DUDT_YMD", "20231215"); + dataObject.put("DUDT_AFTR_AMT", "20231231"); dataObject.put("CRDN_PHOTO1", "samplefiles/crdn1.png"); dataObject.put("CRDN_PHOTO2", "samplefiles/crdn2.png"); diff --git a/src/main/java/cokr/xit/fims/sndb/service/bean/SndngBean.java b/src/main/java/cokr/xit/fims/sndb/service/bean/SndngBean.java index 3d251b67..05570291 100644 --- a/src/main/java/cokr/xit/fims/sndb/service/bean/SndngBean.java +++ b/src/main/java/cokr/xit/fims/sndb/service/bean/SndngBean.java @@ -6,8 +6,6 @@ import javax.annotation.Resource; import org.springframework.stereotype.Component; -import cokr.xit.foundation.AbstractComponent; -import cokr.xit.foundation.data.DataObject; import cokr.xit.base.file.service.FileQuery; import cokr.xit.base.file.service.bean.FileBean; import cokr.xit.base.user.service.bean.UserBean; @@ -22,12 +20,14 @@ import cokr.xit.fims.epst.service.bean.EpostRcptRegBean; import cokr.xit.fims.levy.Levy; import cokr.xit.fims.levy.service.bean.LevyBean; import cokr.xit.fims.nxrp.dao.NxrpMtchgMapper; -import cokr.xit.fims.sndb.dao.SndngMapper; -import cokr.xit.fims.sndb.dao.SvbtcMapper; +import cokr.xit.fims.sndb.SndbQuery; import cokr.xit.fims.sndb.Sndng; import cokr.xit.fims.sndb.SndngDtl; import cokr.xit.fims.sndb.Svbtc; -import cokr.xit.fims.sndb.SndbQuery; +import cokr.xit.fims.sndb.dao.SndngMapper; +import cokr.xit.fims.sndb.dao.SvbtcMapper; +import cokr.xit.foundation.AbstractComponent; +import cokr.xit.foundation.data.DataObject; /**발송 대장 정보 관리 Bean * @@ -1188,7 +1188,7 @@ public class SndngBean extends AbstractComponent { *
  • 그렇지 않으면 false
  • * */ - public String getOcrVrfcCode(String vrfcCode, String strData, int totalLength) { + public static String getOcrVrfcCode(String vrfcCode, String strData, int totalLength) { int temp = 0; int cdTemp = 0; String retCode = ""; diff --git a/src/main/java/cokr/xit/fims/sprt/service/bean/OtptStngBean.java b/src/main/java/cokr/xit/fims/sprt/service/bean/OtptStngBean.java index 7f6f5c9b..38d1ec6b 100644 --- a/src/main/java/cokr/xit/fims/sprt/service/bean/OtptStngBean.java +++ b/src/main/java/cokr/xit/fims/sprt/service/bean/OtptStngBean.java @@ -12,6 +12,7 @@ import org.springframework.stereotype.Component; import cokr.xit.fims.cmmn.pdf.DefaultOtptArtclStng; import cokr.xit.fims.cmmn.pdf.PDFFormat; import cokr.xit.fims.cmmn.pdf.format.Advntce; +import cokr.xit.fims.cmmn.pdf.format.Nht; import cokr.xit.fims.sprt.OtptArtclStng; import cokr.xit.fims.sprt.OtptForm; import cokr.xit.fims.sprt.OtptStngQuery; @@ -45,8 +46,13 @@ public class OtptStngBean extends AbstractComponent { case "02" : pdfFormat = new Advntce(); break; + case "03" : + pdfFormat = new Nht(); + break; + } + List otptArtclStngList = otptStngMapper.selectOtptArtclStngList(query); if(otptArtclStngList == null) { otptArtclStngList = new ArrayList(); 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 966507bf..7033805b 100644 --- a/src/main/resources/sql/mapper/fims/sprt/integrationSearch-mapper.xml +++ b/src/main/resources/sql/mapper/fims/sprt/integrationSearch-mapper.xml @@ -82,6 +82,7 @@ , L.LEVY_NO /* 부과 번호 */ , L.INSPY_SN /* 분납 순번 */ , (CONCAT(L.FYR, '-', L.LEVY_NO)) AS GOJI_NO /* 고지번호 */ + , L.LEVY_SE_CD /* 부과 구분 코드 */ , (SELECT GET_CODE_NM('FIM040', L.LEVY_SE_CD) FROM DUAL) AS LEVY_SE_NM /* 부과 구분 명 */ , L.LEVY_PCPTAX /* 부과 본세 */ , L.LEVY_ADAMT /* 부과 가산금 */ diff --git a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01140-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01140-info.jsp index 0aec4cdb..3c9b668a 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01140-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01140-info.jsp @@ -187,6 +187,7 @@ $(document).ready(function(){ taskSeSelectbox.attr("disabled","disabled"); } + $("#"+dialogId).find("form[name='frmSearch']").find("[name='sndngSeCd']").val("02"); } , onClose : () => { } }); diff --git a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01150-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01150-info.jsp index 3510a6da..db2b3573 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01150-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01150-info.jsp @@ -185,6 +185,7 @@ $(document).ready(function(){ taskSeSelectbox.attr("disabled","disabled"); } + $("#"+dialogId).find("form[name='frmSearch']").find("[name='sndngSeCd']").val("03"); } , onClose : () => { } }); diff --git a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01200-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01200-main.jsp index 59fe117c..88ea6687 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01200-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01200-main.jsp @@ -751,6 +751,8 @@ $(document).ready(function(){ var url = ""; if(submitParam.sndngSeCd == "02"){ url = wctx.url("/sprt/sprt01/140/makeAdvntcePdf.do"); + } else if(submitParam.sndngSeCd == "03"){ + url = wctx.url("/sprt/sprt01/150/makeNhtPdf.do"); } if(url == ""){ @@ -844,7 +846,7 @@ $(document).ready(function(){ fnMakeRowNumberingTable(document.getElementById('tbodyUnique--${pageName}'), markerFinder, markerSetter); fnMakeRowNumberingTable(document.getElementById('tbodyMultiple--${pageName}'), markerFinder, markerSetter); - + }); \ No newline at end of file