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')