@ -50,7 +50,8 @@ public class CarFfnlgTrgtServiceImpl extends EgovAbstractServiceImpl implements
// 날짜 형식 (YYYYMMDD)
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter . ofPattern ( "yyyyMMdd" ) ;
private static final DateTimeFormatter DATE_FORMATTER_DASH = DateTimeFormatter . ofPattern ( "yyyy-MM-dd" ) ;
@Override
public int selectListTotalCount ( CarFfnlgTrgtVO vo ) {
return mapper . selectListTotalCount ( vo ) ;
@ -200,8 +201,8 @@ public class CarFfnlgTrgtServiceImpl extends EgovAbstractServiceImpl implements
// 업무 처리 상태 및 등록자 설정
vo . setTaskPrcsSttsCd ( TaskPrcsSttsConstants . TASK_PRCS_STTS_CD_01_RCPT ) ; // 01=접수
vo . setTaskPrcsYmd ( LocalDate . now ( ) . format ( DATE_FORMATTER ) ) ;
vo . setRcptYmd ( LocalDate . now ( ) . format ( DATE_FORMATTER ) ) ; // 접수일자는 현재 날짜
vo . setTaskPrcsYmd ( LocalDate . now ( ) . format ( DATE_FORMATTER _DASH ) ) ;
vo . setRcptYmd ( LocalDate . now ( ) . format ( DATE_FORMATTER _DASH ) ) ; // 접수일자는 현재 날짜
vo . setRgtr ( rgtr ) ;
// DB 저장
@ -282,14 +283,14 @@ public class CarFfnlgTrgtServiceImpl extends EgovAbstractServiceImpl implements
// 첫째줄: 고정폭 필드들 연결
String firstLine =
padRightBytes ( nvl ( row . getInspstnCd ( ) ) , parseConfig . getFirstLineLength ( "inspstn-cd" ) , encoding ) +
padRightBytes ( formatYmd( row. getInspYmd ( ) , true ) , parseConfig . getFirstLineLength ( "insp-ymd" ) , encoding ) +
padRightBytes ( row. getInspYmd ( ) , parseConfig . getFirstLineLength ( "insp-ymd" ) , encoding ) +
padRightBytes ( nvl ( row . getVhclno ( ) ) , 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 ) +
padRightBytes ( nvl ( row . getCarKnd ( ) ) , parseConfig . getFirstLineLength ( "car-knd" ) , encoding ) +
padRightBytes ( nvl ( row . getCarUsg ( ) ) , parseConfig . getFirstLineLength ( "car-usg" ) , encoding ) +
padRightBytes ( formatYmd( row. getInspEndYmd ( ) , true ) , parseConfig . getFirstLineLength ( "insp-end-ymd" ) , encoding ) +
padRightBytes ( row. getInspEndYmd ( ) , parseConfig . getFirstLineLength ( "insp-end-ymd" ) , encoding ) +
padLeftBytes ( nvl ( row . getDaycnt ( ) ) , parseConfig . getFirstLineLength ( "daycnt" ) , encoding ) +
padLeftBytes ( formatAmtToManWon ( row . getFfnlgAmt ( ) ) , parseConfig . getFirstLineLength ( "ffnlg-amt" ) , encoding ) ;
@ -298,9 +299,9 @@ public class CarFfnlgTrgtServiceImpl extends EgovAbstractServiceImpl implements
// 둘째줄: skip + 나머지 필드
String secondLine =
padRightBytes ( "" , parseConfig . getSecondLineLength ( "skip" ) , encoding ) +
padRightBytes ( formatYmd( row. getLastRegYmd ( ) , true ) , parseConfig . getSecondLineLength ( "last-reg-ymd" ) , encoding ) +
padRightBytes ( row. getLastRegYmd ( ) , parseConfig . getSecondLineLength ( "last-reg-ymd" ) , encoding ) +
padRightBytes ( nvl ( row . getAddr ( ) ) , parseConfig . getSecondLineLength ( "addr" ) , encoding ) +
padRightBytes ( formatYmd( row. getVldPrdExpryYmd ( ) , true ) , parseConfig . getSecondLineLength ( "vld-prd-expry-ymd" ) , encoding ) +
padRightBytes ( row. getVldPrdExpryYmd ( ) , parseConfig . getSecondLineLength ( "vld-prd-expry-ymd" ) , encoding ) +
padRightBytes ( nvl ( row . getTrdGds ( ) ) , parseConfig . getSecondLineLength ( "trd-gds" ) , encoding ) ;
sb . append ( secondLine ) . append ( "\r\n" ) ;
@ -554,11 +555,12 @@ public class CarFfnlgTrgtServiceImpl extends EgovAbstractServiceImpl implements
String trdGds = extractByteLength ( secondBytes , pos , len , encoding ) . trim ( ) ;
log . info ( "[DEBUG_LOG] 매매상품(trdGds) [{}바이트, 위치 {}~끝] = [{}]" , len , pos , trdGds ) ;
// 날짜 형식 변환 (YYYY-MM-DD -> YYYYMMDD)
inspYmd = convertDateFormat ( inspYmd ) ;
inspEndYmd = convertDateFormat ( inspEndYmd ) ;
lastRegYmd = convertDateFormat ( lastRegYmd ) ;
vldPrdExpryYmd = convertDateFormat ( vldPrdExpryYmd ) ;
// 날짜에 '*' 특수문자가 붙는 경우때문에
// 날짜 형식 변환 하지않고 원본 그대로 저장 (YYYY-MM-DD -> YYYYMMDD)
//inspYmd = convertDateFormat(inspYmd);
//inspEndYmd = convertDateFormat(inspEndYmd);
//lastRegYmd = convertDateFormat(lastRegYmd);
//vldPrdExpryYmd = convertDateFormat(vldPrdExpryYmd);
log . info ( "[DEBUG_LOG] 날짜 변환 후 - inspYmd: [{}], inspEndYmd: [{}], lastRegYmd: [{}], vldPrdExpryYmd: [{}]" ,
inspYmd , inspEndYmd , lastRegYmd , vldPrdExpryYmd ) ;
@ -693,10 +695,11 @@ public class CarFfnlgTrgtServiceImpl extends EgovAbstractServiceImpl implements
// 2. 검사일자 검증
if ( vo . getInspYmd ( ) = = null | | vo . getInspYmd ( ) . isEmpty ( ) ) {
errors . add ( String . format ( "[데이터 %d] 검사일자가 누락되었습니다. 차량번호: %s" , dataLineNumber , vhclno ) ) ;
} else if ( ! isValidDate ( vo . getInspYmd ( ) ) ) {
errors . add ( String . format ( "[데이터 %d] 검사일자 형식이 올바르지 않습니다. 검사일자: %s (YYYYMMDD 형식이어야 함), 차량번호: %s" ,
dataLineNumber , vo . getInspYmd ( ) , vhclno ) ) ;
}
/ * else if ( ! isValidDate ( vo . getInspYmd ( ) ) ) {
errors . add ( String . format ( "[데이터 %d] 검사일자 형식이 올바르지 않습니다. 검사일자: %s (YYYY-MM-DD 형식이어야 함), 차량번호: %s" ,
dataLineNumber , vo . getInspYmd ( ) , vhclno ) ) ;
} * /
// 3. 차량번호 검증
if ( vo . getVhclno ( ) = = null | | vo . getVhclno ( ) . isEmpty ( ) ) {
@ -760,21 +763,21 @@ public class CarFfnlgTrgtServiceImpl extends EgovAbstractServiceImpl implements
dataLineNumber , vo . getAddr ( ) . length ( ) , vhclno ) ) ;
}
// 8. 선택 필드 날짜 검증 (값이 있는 경우에만)
if ( vo . getInspEndYmd ( ) ! = null & & ! vo . getInspEndYmd ( ) . isEmpty ( ) & & ! isValidDate ( vo . getInspEndYmd ( ) ) ) {
errors . add ( String . format ( "[데이터 %d] 검사종료일자 형식이 올바르지 않습니다. 검사종료일자: %s (YYYYMMDD 형식), 차량번호: %s" ,
dataLineNumber , vo . getInspEndYmd ( ) , vhclno ) ) ;
}
if ( vo . getLastRegYmd ( ) ! = null & & ! vo . getLastRegYmd ( ) . isEmpty ( ) & & ! isValidDate ( vo . getLastRegYmd ( ) ) ) {
errors . add ( String . format ( "[데이터 %d] 최종등록일자 형식이 올바르지 않습니다. 최종등록일자: %s (YYYYMMDD 형식), 차량번호: %s" ,
dataLineNumber , vo . getLastRegYmd ( ) , vhclno ) ) ;
}
if ( vo . getVldPrdExpryYmd ( ) ! = null & & ! vo . getVldPrdExpryYmd ( ) . isEmpty ( ) & & ! isValidDate ( vo . getVldPrdExpryYmd ( ) ) ) {
errors . add ( String . format ( "[데이터 %d] 유효기간만료일자 형식이 올바르지 않습니다. 유효기간만료일자: %s (YYYYMMDD 형식), 차량번호: %s" ,
dataLineNumber , vo . getVldPrdExpryYmd ( ) , vhclno ) ) ;
}
// 8. 선택 필드 날짜 검증 (값이 있는 경우에만) , '*' 특수문자 들어간 경우때문에 일자형식 틀어짐, 제거
//if (vo.getInspEndYmd() != null && !vo.getInspEndYmd().isEmpty() && !isValidDate(vo.getInspEndYmd())) {
// errors.add(String.format("[데이터 %d] 검사종료일자 형식이 올바르지 않습니다. 검사종료일자: %s (YYYYMMDD 형식), 차량번호: %s",
// dataLineNumber, vo.getInspEndYmd(), vhclno));
//}
//
//if (vo.getLastRegYmd() != null && !vo.getLastRegYmd().isEmpty() && !isValidDate(vo.getLastRegYmd())) {
// errors.add(String.format("[데이터 %d] 최종등록일자 형식이 올바르지 않습니다. 최종등록일자: %s (YYYYMMDD 형식), 차량번호: %s",
// dataLineNumber, vo.getLastRegYmd(), vhclno));
//}
//
//if (vo.getVldPrdExpryYmd() != null && !vo.getVldPrdExpryYmd().isEmpty() && !isValidDate(vo.getVldPrdExpryYmd())) {
// errors.add(String.format("[데이터 %d] 유효기간만료일자 형식이 올바르지 않습니다. 유효기간만료일자: %s (YYYYMMDD 형식), 차량번호: %s",
// dataLineNumber, vo.getVldPrdExpryYmd(), vhclno));
//}
// 9. 일수 검증 (값이 있는 경우에만)
// 일수에 '*' 특수문자가 포함될 수 있음 (재검여부 표시용)