From 08da87490d2c6c8a8b5bfdc68181e9738d459b85 Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Wed, 24 Apr 2024 17:14:54 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9A=B0=ED=8E=B8=EB=B2=88=ED=98=B8,=EB=93=B1?= =?UTF-8?q?=EA=B8=B0=EB=B2=88=ED=98=B8=EC=97=90=20=ED=95=98=EC=9D=B4?= =?UTF-8?q?=ED=94=88=20=EB=AC=B8=EC=9E=90(-)=20=EC=B6=94=EA=B0=80=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=EB=A9=94=EC=86=8C=EB=93=9C=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 | 52 +++++++++++++------ .../xit/fims/cmmn/OutsourcingFileMaker.java | 8 +-- 2 files changed, 38 insertions(+), 22 deletions(-) diff --git a/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java b/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java index 7d757333..f987d96f 100644 --- a/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java +++ b/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java @@ -310,22 +310,6 @@ public class CmmnUtil { return yyyyMMddFormat.format(cal.getTime()); } - /** - * 날짜형 문자열 입력받아 요일을 한글 문자 하나로 반환한다. - * @param dateStr 날짜 - * @return 요일 - */ - public static String getDayOfWeek(String dateStr) { - int y = Integer.parseInt(dateStr.substring(0,4)); - int m = Integer.parseInt(dateStr.substring(4,6)); - int d = Integer.parseInt(dateStr.substring(6,8)); - LocalDate date = LocalDate.of(y, m, d); - DayOfWeek dayOfWeek = date.getDayOfWeek(); - String dow = dayOfWeek.getDisplayName(TextStyle.SHORT, Locale.KOREAN); - return dow; - } - - public static String dateNFormat(String dateStr, String pattern) { if(dateStr.length() == 8) { return CmmnUtil.date8Format(dateStr, pattern); @@ -354,6 +338,42 @@ public class CmmnUtil { return dataFormats.format(pattern, date); } + /**'-'로 구분된 우편번호를 반환한다. + * @param zipCode '-'이 없는 우편번호 + * @return '-'로 구분된 우편번호 + */ + public static String zipCodeFormat(String zipCode) { + if(zipCode != null && zipCode.length() == 6) { + return zipCode.substring(0,3)+"-"+zipCode.substring(3); + } + return zipCode; + } + + /**'-'로 구분된 등기번호를 반환한다. + * @param rgNo '-'이 없는 등기번호 + * @return '-'로 구분된 등기번호 + */ + public static String rgNoFormat(String rgNo) { + if(rgNo != null && rgNo.length() == 13) { + return rgNo.substring(0,5)+"-"+rgNo.substring(5); + } + return rgNo; + } + + /** + * 날짜형 문자열 입력받아 요일을 한글 문자 하나로 반환한다. + * @param dateStr 날짜 + * @return 요일 + */ + public static String getDayOfWeek(String dateStr) { + int y = Integer.parseInt(dateStr.substring(0,4)); + int m = Integer.parseInt(dateStr.substring(4,6)); + int d = Integer.parseInt(dateStr.substring(6,8)); + LocalDate date = LocalDate.of(y, m, d); + DayOfWeek dayOfWeek = date.getDayOfWeek(); + String dow = dayOfWeek.getDisplayName(TextStyle.SHORT, Locale.KOREAN); + return dow; + } /** 숫자를 한글로 표시한다. * @param number diff --git a/src/main/java/cokr/xit/fims/cmmn/OutsourcingFileMaker.java b/src/main/java/cokr/xit/fims/cmmn/OutsourcingFileMaker.java index 571b10ea..3169709d 100644 --- a/src/main/java/cokr/xit/fims/cmmn/OutsourcingFileMaker.java +++ b/src/main/java/cokr/xit/fims/cmmn/OutsourcingFileMaker.java @@ -153,15 +153,11 @@ public class OutsourcingFileMaker { String formatting = printStngItem.string("FORMATTING"); switch (formatting) { case "zip(hypen)": { - if(artclValue.length() == 6) { - artclValue = artclValue.substring(0,3)+"-"+artclValue.substring(3); - } + artclValue = CmmnUtil.zipCodeFormat(artclValue); break; } case "rgNo(hypen)": { - if(artclValue.length() == 13) { - artclValue = artclValue.substring(0,5)+"-"+artclValue.substring(5); - } + artclValue = CmmnUtil.rgNoFormat(artclValue); break; } case "amount(comma)": {