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 @@