1. 공통 메소드 추가(차량번호 검증, 차량번호 추출, 연월일시분초 포맷 검증)

2. 단속시간 조회조건 추가
main
이범준 2 weeks ago
parent 2dd516b522
commit 0e14a7292f

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

@ -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 extends CrdnQuery> T setCrdnTm(String crdnTm) {
this.crdnTm = crdnTm;
return self();
}
public String getSchDmndYmdFrom() {
return ifEmpty(schDmndYmdFrom, () -> null);
}

@ -131,15 +131,21 @@ WHERE C.DEL_YN = 'N'
<if test="schCrdnYmdFrom != null">AND C.CRDN_YMD <![CDATA[ >= ]]> #{schCrdnYmdFrom} </if>
<if test="schCrdnYmdTo != null">AND C.CRDN_YMD <![CDATA[ <= ]]> #{schCrdnYmdTo} </if>
</if>
<if test="crdnSttsCd != null">
<if test="@org.egovframe.rte.fdl.string.EgovStringUtil@isNotEmpty(crdnSttsCd)">
AND C.CRDN_STTS_CD = #{crdnSttsCd}
</if>
<if test="towngYn != null">
<if test="@org.egovframe.rte.fdl.string.EgovStringUtil@isNotEmpty(towngYn)">
AND CA.TOWNG_YN = #{towngYn}
</if>
<if test="epayno != null">
<if test="@org.egovframe.rte.fdl.string.EgovStringUtil@isNotEmpty(epayno)">
AND L.EPAYNO = #{epayno}
</if>
<if test="@org.egovframe.rte.fdl.string.EgovStringUtil@isNotEmpty(crdnYmd)">
AND C.CRDN_YMD = #{crdnYmd}
</if>
<if test="@org.egovframe.rte.fdl.string.EgovStringUtil@isNotEmpty(crdnTm)">
AND C.CRDN_TM = #{crdnTm}
</if>
<if test="schRegDateFrom != null or schRegDateTo != null">
<if test="schRegDateOpt == 'regDt'">
<if test="schRegDateFrom != null"> AND C.REG_DT <![CDATA[>=]]> CONCAT(#{schRegDateFrom},'000000') </if>

Loading…
Cancel
Save