@ -709,11 +709,8 @@ public class CarFfnlgTrgtServiceImpl extends EgovAbstractServiceImpl implements
dataLineNumber , vo . getVhclno ( ) ) ) ;
}
// 4. 소유자명 검증
if ( vo . getOwnrNm ( ) = = null | | vo . getOwnrNm ( ) . isEmpty ( ) ) {
errors . add ( String . format ( "[데이터 %d] 소유자명이 누락되었습니다. 차량번호: %s" ,
dataLineNumber , vhclno ) ) ;
} else if ( vo . getOwnrNm ( ) . length ( ) > 75 ) {
// 4. 소유자명 검증 (소유자명에 null or 공백 들어올수 있음 - 필수 아님)
if ( vo . getOwnrNm ( ) ! = null & & ! vo . getOwnrNm ( ) . isEmpty ( ) & & vo . getOwnrNm ( ) . length ( ) > 75 ) {
errors . add ( String . format ( "[데이터 %d] 소유자명이 너무 깁니다. 소유자명: %s (최대 75자), 차량번호: %s" ,
dataLineNumber , vo . getOwnrNm ( ) , vhclno ) ) ;
}
@ -780,10 +777,16 @@ public class CarFfnlgTrgtServiceImpl extends EgovAbstractServiceImpl implements
}
// 9. 일수 검증 (값이 있는 경우에만)
if ( vo . getDaycnt ( ) ! = null & & ! vo . getDaycnt ( ) . isEmpty ( ) & & ! isNumeric ( vo . getDaycnt ( ) ) ) {
errors . add ( String . format ( "[데이터 %d] 일수는 숫자여야 합니다. 일수: %s, 차량번호: %s" ,
// 일수에 '*' 특수문자가 포함될 수 있음 (재검여부 표시용)
if ( vo . getDaycnt ( ) ! = null & & ! vo . getDaycnt ( ) . isEmpty ( ) ) {
String daycnt = vo . getDaycnt ( ) . trim ( ) ;
// '*' 제거 후 숫자 검증
String daycntWithoutAsterisk = daycnt . replace ( "*" , "" ) . trim ( ) ;
if ( ! daycntWithoutAsterisk . isEmpty ( ) & & ! isNumeric ( daycntWithoutAsterisk ) ) {
errors . add ( String . format ( "[데이터 %d] 일수는 숫자 또는 '*숫자' 형식이어야 합니다. 일수: %s, 차량번호: %s" ,
dataLineNumber , vo . getDaycnt ( ) , vhclno ) ) ;
}
}
return errors ;
}
@ -831,6 +834,7 @@ public class CarFfnlgTrgtServiceImpl extends EgovAbstractServiceImpl implements
* 유 효 한 형 식 :
* - 일 반 : 12 가 3456 , 123 가 4567 ( 2 ~ 3 자 리 숫 자 + 한 글 + 4 자 리 숫 자 )
* - 특 수 : 경 기 11 사 2222 ( 지 역 명 + 숫 자 + 한 글 + 숫 자 )
* - '*' 특 수 문 자 포 함 가 능 ( 전 출 차 량 등 특 정 상 황 표 시 )
*
* @param vhclno 차 량 번 호
* @return 유 효 성 여 부
@ -843,32 +847,40 @@ public class CarFfnlgTrgtServiceImpl extends EgovAbstractServiceImpl implements
// 공백 제거
vhclno = vhclno . trim ( ) ;
// 최소 길이 체크 (예: 12가3456 = 7자)
if ( vhclno . length ( ) < 7 ) {
// '*' 특수문자를 임시로 제거하여 검증 (전출차량 등 특정 상황 표시용)
String vhclnoWithoutAsterisk = vhclno . replace ( "*" , "" ) ;
// '*'만 있는 경우는 제외
if ( vhclnoWithoutAsterisk . isEmpty ( ) ) {
return false ;
}
// 최소 길이 체크 (예: 12가3456 = 7자, *12가3456 = 8자)
if ( vhclnoWithoutAsterisk . length ( ) < 7 ) {
return false ;
}
// 패턴1: 일반 차량번호 (2~3자리 숫자 + 한글 1자 + 4자리 숫자)
// 예: 12가3456, 123가4567
if ( vhclno . matches ( "\\d{2,3}[가-힣]\\d{4}" ) ) {
// 예: 12가3456, 123가4567 , *12가3456
if ( vhclno WithoutAsterisk . matches ( "\\d{2,3}[가-힣]\\d{4}" ) ) {
return true ;
}
// 패턴2: 지역명이 포함된 차량번호 (한글 + 숫자 + 한글 + 숫자)
// 예: 경기11사2222, 서울12가3456
if ( vhclno . matches ( "[가-힣]+\\d+[가-힣]\\d+" ) ) {
// 예: 경기11사2222, 서울12가3456 , *경기11사2222
if ( vhclno WithoutAsterisk . matches ( "[가-힣]+\\d+[가-힣]\\d+" ) ) {
return true ;
}
// 패턴3: 특수 차량번호 (숫자 + 한글 + 숫자)
// 예: 22고2222, 33마3333
if ( vhclno . matches ( "\\d+[가-힣]+\\d+" ) ) {
// 예: 22고2222, 33마3333 , *22고2222
if ( vhclno WithoutAsterisk . matches ( "\\d+[가-힣]+\\d+" ) ) {
return true ;
}
// 그 외의 경우는 일단 허용 (실제 차량번호 형식이 다양할 수 있음)
// 최소한 한글과 숫자가 모두 포함되어 있는지 확인
return vhclno . matches ( ".*[가-힣].*" ) & & vhclno . matches ( ".*\\d.*" ) ;
return vhclno WithoutAsterisk . matches ( ".*[가-힣].*" ) & & vhclno WithoutAsterisk . matches ( ".*\\d.*" ) ;
}
/ * *