@ -280,11 +280,28 @@ public class CarFfnlgTrgtServiceImpl extends EgovAbstractServiceImpl implements
// 3) 데이터 라인 생성 (각 항목 2줄)
for ( CarFfnlgTrgtVO row : list ) {
// 차량번호 별표 처리
String vhclno = nvl ( row . getVhclno ( ) ) ;
String vhclnoAsterisk = " " ;
if ( vhclno . startsWith ( "*" ) ) {
vhclnoAsterisk = "*" ;
vhclno = vhclno . substring ( 1 ) ; // 별표 제거
}
// 최종등록일 별표 처리
String lastRegYmd = nvl ( row . getLastRegYmd ( ) ) ;
String lastRegYmdAsterisk = " " ;
if ( lastRegYmd . startsWith ( "*" ) ) {
lastRegYmdAsterisk = "*" ;
lastRegYmd = lastRegYmd . substring ( 1 ) ; // 별표 제거
}
// 첫째줄: 고정폭 필드들 연결
String firstLine =
padRightBytes ( nvl ( row . getInspstnCd ( ) ) , parseConfig . getFirstLineLength ( "inspstn-cd" ) , encoding ) +
padRightBytes ( row . getInspYmd ( ) , parseConfig . getFirstLineLength ( "insp-ymd" ) , encoding ) +
padRightBytes ( nvl ( row . getVhclno ( ) ) , parseConfig . getFirstLineLength ( "vhclno" ) , encoding ) +
padRightBytes ( vhclnoAsterisk , parseConfig . getFirstLineLength ( "vhclno-asterisk" ) , encoding ) +
padRightBytes ( vhclno , parseConfig . getFirstLineLength ( "vhclno" ) , encoding ) +
padRightBytes ( nvl ( row . getOwnrNm ( ) ) , parseConfig . getFirstLineLength ( "ownr-nm" ) , encoding ) +
padRightBytes ( nvl ( row . getRrno ( ) ) , parseConfig . getFirstLineLength ( "rrno" ) , encoding ) +
padRightBytes ( nvl ( row . getCarNm ( ) ) , parseConfig . getFirstLineLength ( "car-nm" ) , encoding ) +
@ -299,7 +316,8 @@ public class CarFfnlgTrgtServiceImpl extends EgovAbstractServiceImpl implements
// 둘째줄: skip + 나머지 필드
String secondLine =
padRightBytes ( "" , parseConfig . getSecondLineLength ( "skip" ) , encoding ) +
padRightBytes ( row . getLastRegYmd ( ) , parseConfig . getSecondLineLength ( "last-reg-ymd" ) , encoding ) +
padRightBytes ( lastRegYmdAsterisk , parseConfig . getSecondLineLength ( "last-reg-ymd-asterisk" ) , encoding ) +
padRightBytes ( lastRegYmd , parseConfig . getSecondLineLength ( "last-reg-ymd" ) , encoding ) +
padRightBytes ( nvl ( row . getAddr ( ) ) , parseConfig . getSecondLineLength ( "addr" ) , encoding ) +
padRightBytes ( row . getVldPrdExpryYmd ( ) , parseConfig . getSecondLineLength ( "vld-prd-expry-ymd" ) , encoding ) +
padRightBytes ( nvl ( row . getTrdGds ( ) ) , parseConfig . getSecondLineLength ( "trd-gds" ) , encoding ) ;
@ -467,12 +485,24 @@ public class CarFfnlgTrgtServiceImpl extends EgovAbstractServiceImpl implements
String inspYmd = extractByteLength ( firstBytes , pos , len , encoding ) . trim ( ) ;
log . info ( "[DEBUG_LOG] 검사일자(inspYmd) [{}바이트, 위치 {}-{}] = [{}]" , len , pos , pos + len , inspYmd ) ;
pos + = len ;
// 차량번호 (13바이트)
// 차량번호 별표 공간 (1바이트)
len = parseConfig . getFirstLineLength ( "vhclno-asterisk" ) ;
String vhclnoAsterisk = extractByteLength ( firstBytes , pos , len , encoding ) ;
log . info ( "[DEBUG_LOG] 차량번호 별표(vhclnoAsterisk) [{}바이트, 위치 {}-{}] = [{}]" , len , pos , pos + len , vhclnoAsterisk ) ;
pos + = len ;
// 차량번호 (12바이트)
len = parseConfig . getFirstLineLength ( "vhclno" ) ;
String vhclno = extractByteLength ( firstBytes , pos , len , encoding ) . trim ( ) ;
log . info ( "[DEBUG_LOG] 차량번호(vhclno) [{}바이트, 위치 {}-{}] = [{}]" , len , pos , pos + len , vhclno ) ;
pos + = len ;
// 별표가 있으면 차량번호 앞에 붙임
if ( "*" . equals ( vhclnoAsterisk . trim ( ) ) ) {
vhclno = "*" + vhclno ;
log . info ( "[DEBUG_LOG] 차량번호에 별표 추가: [{}]" , vhclno ) ;
}
// 소유자명 (31바이트)
len = parseConfig . getFirstLineLength ( "ownr-nm" ) ;
@ -509,8 +539,8 @@ public class CarFfnlgTrgtServiceImpl extends EgovAbstractServiceImpl implements
String inspEndYmd = extractByteLength ( firstBytes , pos , len , encoding ) . trim ( ) ;
log . info ( "[DEBUG_LOG] 종료일(inspEndYmd) [{}바이트, 위치 {}-{}] = [{}]" , len , pos , pos + len , inspEndYmd ) ;
pos + = len ;
// 일수 ( 8바이트 )
// 일수 ( 별표 포함 )
len = parseConfig . getFirstLineLength ( "daycnt" ) ;
String daycnt = extractByteLength ( firstBytes , pos , len , encoding ) . trim ( ) ;
log . info ( "[DEBUG_LOG] 일수(daycnt) [{}바이트, 위치 {}-{}] = [{}]" , len , pos , pos + len , daycnt ) ;
@ -531,12 +561,24 @@ public class CarFfnlgTrgtServiceImpl extends EgovAbstractServiceImpl implements
len = parseConfig . getSecondLineLength ( "skip" ) ;
log . info ( "[DEBUG_LOG] 공백 스킵 [{}바이트]" , len ) ;
pos + = len ;
// 최종등록일 (12바이트)
// 최종등록일 별표 공간 (1바이트)
len = parseConfig . getSecondLineLength ( "last-reg-ymd-asterisk" ) ;
String lastRegYmdAsterisk = extractByteLength ( secondBytes , pos , len , encoding ) ;
log . info ( "[DEBUG_LOG] 최종등록일 별표(lastRegYmdAsterisk) [{}바이트, 위치 {}-{}] = [{}]" , len , pos , pos + len , lastRegYmdAsterisk ) ;
pos + = len ;
// 최종등록일 (11바이트)
len = parseConfig . getSecondLineLength ( "last-reg-ymd" ) ;
String lastRegYmd = extractByteLength ( secondBytes , pos , len , encoding ) . trim ( ) ;
log . info ( "[DEBUG_LOG] 최종등록일(lastRegYmd) [{}바이트, 위치 {}-{}] = [{}]" , len , pos , pos + len , lastRegYmd ) ;
pos + = len ;
// 별표가 있으면 최종등록일 앞에 붙임
if ( "*" . equals ( lastRegYmdAsterisk . trim ( ) ) ) {
lastRegYmd = "*" + lastRegYmd ;
log . info ( "[DEBUG_LOG] 최종등록일에 별표 추가: [{}]" , lastRegYmd ) ;
}
// 주소 (88바이트)
len = parseConfig . getSecondLineLength ( "addr" ) ;