From 0e14a7292ff2f243709b95b545fceaea28b7073b Mon Sep 17 00:00:00 2001 From: leebj Date: Thu, 31 Oct 2024 10:30:08 +0900 Subject: [PATCH] =?UTF-8?q?1.=20=EA=B3=B5=ED=86=B5=20=EB=A9=94=EC=86=8C?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80(=EC=B0=A8=EB=9F=89=EB=B2=88?= =?UTF-8?q?=ED=98=B8=20=EA=B2=80=EC=A6=9D,=20=EC=B0=A8=EB=9F=89=EB=B2=88?= =?UTF-8?q?=ED=98=B8=20=EC=B6=94=EC=B6=9C,=20=EC=97=B0=EC=9B=94=EC=9D=BC?= =?UTF-8?q?=EC=8B=9C=EB=B6=84=EC=B4=88=20=ED=8F=AC=EB=A7=B7=20=EA=B2=80?= =?UTF-8?q?=EC=A6=9D)=202.=20=EB=8B=A8=EC=86=8D=EC=8B=9C=EA=B0=84=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=EC=A1=B0=EA=B1=B4=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 | 86 +++++++++++++++++++ .../java/cokr/xit/fims/crdn/CrdnQuery.java | 10 +++ .../sql/mapper/fims/crdn/crdn-list-mapper.xml | 12 ++- 3 files changed, 105 insertions(+), 3 deletions(-) diff --git a/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java b/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java index e8f43843..77d3ddf2 100644 --- a/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java +++ b/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java @@ -102,6 +102,92 @@ public class CmmnUtil { return Pattern.matches(REGEXP_PATTERN_KOR, str); } + /** + * 문자열이 차량번호인지 체크한다. + * @param 문자열 + * @return boolean + */ + public static boolean isValidCarNumber(String carNum){ + boolean returnValue = false; + try{ + String regex = "^\\d{2,3}[가|나|다|라|마|거|너|더|러|머|버|서|어|저|고|노|도|로|모|보|소|오|조|구|누|두|루|무|부|수|우|주|바|사|아|자|허|배|호|하\\x20]\\d{4}/*$"; + + Pattern p = Pattern.compile(regex); + Matcher m = p.matcher(carNum); + if (m.matches()) { + returnValue = true; + }else{ + //2번째 패턴 처리 + regex = "^[서울|부산|대구|인천|대전|광주|울산|제주|경기|강원|충남|전남|전북|경남|경북|세종]{2}\\d{2}[가|나|다|라|마|거|너|더|러|머|버|서|어|저|고|노|도|로|모|보|소|오|조|구|누|두|루|무|부|수|우|주|바|사|아|자|허|배|호|하\\x20]\\d{4}$"; + p = Pattern.compile(regex); + m = p.matcher(carNum); + if (m.matches()) { + returnValue = true; + } + } + + return returnValue; + + }catch(Exception e){ + return false; + } + } + + /** + * 문자열에서 차량번호를 추출한다. + * @param 문자열 + * @return String 차량번호 + */ + public static String extractCarNumber(String carNum){ + //String returnStr = ""; + + try{ + String regex = "[서울|부산|대구|인천|대전|광주|울산|제주|경기|강원|충남|전남|전북|경남|경북|세종]{2}\\d{2}[가|나|다|라|마|거|너|더|러|머|버|서|어|저|고|노|도|로|모|보|소|오|조|구|누|두|루|무|부|수|우|주|바|사|아|자|허|배|호|하\\x20]\\d{4}"; + Pattern p = Pattern.compile(regex); + Matcher m = p.matcher(carNum); + if (m.find()) { + return m.group(); + } + + + regex = "\\d{3}[가|나|다|라|마|거|너|더|러|머|버|서|어|저|고|노|도|로|모|보|소|오|조|구|누|두|루|무|부|수|우|주|바|사|아|자|허|배|호|하\\x20]\\d{4}"; + p = Pattern.compile(regex); + m = p.matcher(carNum); + if (m.find()) { + return m.group(); + } + + regex = "\\d{2}[가|나|다|라|마|거|너|더|러|머|버|서|어|저|고|노|도|로|모|보|소|오|조|구|누|두|루|무|부|수|우|주|바|사|아|자|허|배|호|하\\x20]\\d{4}"; + p = Pattern.compile(regex); + m = p.matcher(carNum); + if (m.find()) { + return m.group(); + } + + return ""; + + }catch(Exception e){ + return ""; + } + } + + /** + * "연-월-일 시:분:초" 형식 여부를 체크한다. + * @param 문자열 + * @return boolean + */ + public static boolean isDateTimePattern(String str){ + String DATETIME_PATTERN = "(19|20)\\d{2}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1]) (2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9]"; + Pattern datetimePattern = Pattern.compile(DATETIME_PATTERN); + + if(datetimePattern.matcher(str).matches()) { + return true; + } else { + return false; + } + } + + /** * 순서를 숫자에서 알파벳문자로 변환한다. * @param index 순서번호, 대소문자여부(대문자일경우 true, 소문자일경우 false), startFromZero 0부터 시작 여부(0부터 시작시 true, 1부터 시작시 false) diff --git a/src/main/java/cokr/xit/fims/crdn/CrdnQuery.java b/src/main/java/cokr/xit/fims/crdn/CrdnQuery.java index b610382c..959be330 100644 --- a/src/main/java/cokr/xit/fims/crdn/CrdnQuery.java +++ b/src/main/java/cokr/xit/fims/crdn/CrdnQuery.java @@ -43,6 +43,7 @@ public class CrdnQuery extends CmmnQuery { private String crdnYmd; private String schCrdnYmdFrom; private String schCrdnYmdTo; + private String crdnTm; private String schDmndYmdFrom; private String schDmndYmdTo; @@ -265,6 +266,15 @@ public class CrdnQuery extends CmmnQuery { return self(); } + public String getCrdnTm() { + return ifEmpty(crdnTm, () -> null); + } + + public T setCrdnTm(String crdnTm) { + this.crdnTm = crdnTm; + return self(); + } + public String getSchDmndYmdFrom() { return ifEmpty(schDmndYmdFrom, () -> null); } diff --git a/src/main/resources/sql/mapper/fims/crdn/crdn-list-mapper.xml b/src/main/resources/sql/mapper/fims/crdn/crdn-list-mapper.xml index a6ba8c1e..b9e06c9f 100644 --- a/src/main/resources/sql/mapper/fims/crdn/crdn-list-mapper.xml +++ b/src/main/resources/sql/mapper/fims/crdn/crdn-list-mapper.xml @@ -131,15 +131,21 @@ WHERE C.DEL_YN = 'N' AND C.CRDN_YMD = ]]> #{schCrdnYmdFrom} AND C.CRDN_YMD #{schCrdnYmdTo} - + AND C.CRDN_STTS_CD = #{crdnSttsCd} - + AND CA.TOWNG_YN = #{towngYn} - + AND L.EPAYNO = #{epayno} + +AND C.CRDN_YMD = #{crdnYmd} + + +AND C.CRDN_TM = #{crdnTm} + AND C.REG_DT =]]> CONCAT(#{schRegDateFrom},'000000')