From 755c6fb3913b626d2c40ea319d7f185b7b63ff56 Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Tue, 2 Apr 2024 09:33:56 +0900 Subject: [PATCH] =?UTF-8?q?=EC=82=AC=EC=A0=84=ED=86=B5=EC=A7=80=EC=84=9C?= =?UTF-8?q?=20=EC=99=B8=EC=A3=BC=EC=9A=94=EC=B2=AD=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=84=9C=EC=8B=9D=20=ED=95=AD=EB=AA=A9=EB=B3=84=20=ED=8F=AC?= =?UTF-8?q?=EB=A7=B7=ED=8C=85=20=EC=84=A4=EC=A0=95=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/file/etc/OutsourcingFileWriter.java | 34 ++++++++++++++++++- .../java/cokr/xit/fims/cmmn/CmmnUtil.java | 29 ++++++++++++++++ .../WEB-INF/jsp/fims/stng01030-main.jsp | 17 +++++++++- 3 files changed, 78 insertions(+), 2 deletions(-) diff --git a/src/main/java/cokr/xit/base/file/etc/OutsourcingFileWriter.java b/src/main/java/cokr/xit/base/file/etc/OutsourcingFileWriter.java index 635228a8..b8e35cb4 100644 --- a/src/main/java/cokr/xit/base/file/etc/OutsourcingFileWriter.java +++ b/src/main/java/cokr/xit/base/file/etc/OutsourcingFileWriter.java @@ -150,7 +150,39 @@ public class OutsourcingFileWriter { //포매팅 if(!printStngItem.string("FORMATTING").equals("")) { - //TODO : 등기번호,우편번호,금액,날짜 + String formatting = printStngItem.string("FORMATTING"); + switch (formatting) { + case "zip(hypen)": { + if(artclValue.length() == 6) { + artclValue = artclValue.substring(0,3)+"-"+artclValue.substring(3); + } + break; + } + case "rgNo(hypen)": { + if(artclValue.length() == 13) { + artclValue = artclValue.substring(0,5)+"-"+artclValue.substring(5); + } + break; + } + case "amount(comma)": { + artclValue = CmmnUtil.addCommaToNumber(artclValue); + break; + } + default: + if(formatting.startsWith("date(")) { + String dtlFormatting = formatting.substring(5, formatting.length()-1); + + if(dtlFormatting.contains("~") && artclValue.contains("~")) { + String from = CmmnUtil.dateNFormat(artclValue.split("~",-1)[0], dtlFormatting.split("~",-1)[0]); + String to = CmmnUtil.dateNFormat(artclValue.split("~",-1)[1], dtlFormatting.split("~",-1)[1]); + + artclValue = from + "~" + to; + } else { + artclValue = CmmnUtil.dateNFormat(artclValue, dtlFormatting); + } + } + } + } //공백 패딩 방향 diff --git a/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java b/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java index e7546da7..9647f525 100644 --- a/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java +++ b/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java @@ -39,6 +39,7 @@ import cokr.xit.base.file.xls.XLSWriter; import cokr.xit.base.file.xls.XLSWriter.CommentSupport; import cokr.xit.fims.sndb.service.bean.SndngBean; import cokr.xit.foundation.data.DataObject; +import cokr.xit.foundation.util.DateFormats; public class CmmnUtil { @@ -336,6 +337,34 @@ public class CmmnUtil { + " " + dateStr.substring(8, 10) + ":" + dateStr.substring(10, 12) + ":" + dateStr.substring(12, 14); } + public static String dateNFormat(String dateStr, String pattern) { + if(dateStr.length() == 8) { + return CmmnUtil.date8Format(dateStr, pattern); + } else if(dateStr.length() == 12) { + return CmmnUtil.date12Format(dateStr, pattern); + } else if(dateStr.length() == 14) { + return CmmnUtil.date14Format(dateStr, pattern); + } else { + return dateStr; + } + } + + public static String date8Format(String dateStr, String pattern) { + DateFormats dataFormats = new DateFormats(); + Date date = dataFormats.parse("yyyyMMdd", dateStr); + return dataFormats.format(pattern, date); + } + public static String date12Format(String dateStr, String pattern) { + DateFormats dataFormats = new DateFormats(); + Date date = dataFormats.parse("yyyyMMddHHmm", dateStr); + return dataFormats.format(pattern, date); + } + public static String date14Format(String dateStr, String pattern) { + DateFormats dataFormats = new DateFormats(); + Date date = dataFormats.parse("yyyyMMddHHmmss", dateStr); + return dataFormats.format(pattern, date); + } + /** 숫자형 문자열에 세자리 마다 콤마를 찍어 반환한다. * @param str 숫자형 문자열 * @return 콤마가 표시된 숫자형 문자열 diff --git a/src/main/webapp/WEB-INF/jsp/fims/stng01030-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/stng01030-main.jsp index 204c385d..572b44c7 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/stng01030-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/stng01030-main.jsp @@ -114,7 +114,22 @@ - + +