지연 - 명의이전 - 일단 접수 02 상태 그대로

main
박성영 7 days ago
parent 7985785bd4
commit 733986b838

@ -20,12 +20,8 @@ import org.springframework.stereotype.Service;
public class ComparisonOmServiceImpl extends EgovAbstractServiceImpl implements ComparisonOmService {
private final ProductUseOmChecker productUseOmChecker;
private final ProductUseOmChangeChecker productUseOmChangeChecker;
private final ProductCloseWithin31OmChecker productCloseWithin31OmChecker;
private final OwnerCloseWithin31OmChecker ownerCloseWithin31OmChecker;
private final ProductLevyOver31OmChecker productLevyOver31OmChecker;
private final OwnerLevyOver31OmChecker ownerLevyOver31OmChecker;
private final TransferOmChecker transferOmChecker;
private final OwnerTransferOmChecker ownerTransferOmChecker;
/**
*
@ -46,42 +42,14 @@ public class ComparisonOmServiceImpl extends EgovAbstractServiceImpl implements
return productUseResult;
}
// ========== 2. 상품용 체크 - api-1번호출.소유자명.contains("상품용-변경등록") ==========
String productUseChangeResult = productUseOmChangeChecker.check(existingData);
if (productUseChangeResult != null) {
log.info("========== 미필 비교 로직 종료 (상품용-변경등록): {} ==========", vhclno);
return productUseChangeResult;
// ========== 2. 명의이전 소유자 확인 (검사유효기간 종료일 이후 명의이전) ==========
String ownerTransferResult = ownerTransferOmChecker.check(existingData);
if (ownerTransferResult != null) {
log.info("========== 미필 비교 로직 종료 (명의이전 소유자 확인): {} ==========", vhclno);
return ownerTransferResult;
}
// ========== 3. 내사종결 체크 - 명의이전 이전소유자 상품용, 31일 이내 ==========
String investigationClosedByProductResult = productCloseWithin31OmChecker.check(existingData);
if (investigationClosedByProductResult != null) {
log.info("========== 미필 비교 로직 종료 (내사종결 - 명의이전 이전소유자 상품용, 31일 이내): {} ==========", vhclno);
return investigationClosedByProductResult;
}
// ========== 4. 내사종결 체크 - 명의이전, 31일 이내 ==========
String investigationClosedByOwnerChangeResult = ownerCloseWithin31OmChecker.check(existingData);
if (investigationClosedByOwnerChangeResult != null) {
log.info("========== 미필 비교 로직 종료 (내사종결 - 명의이전, 31일 이내): {} ==========", vhclno);
return investigationClosedByOwnerChangeResult;
}
// ========== 5. 날짜 수정 후 부과 체크 - 명의이전 이전소유자 상품용, 31일 초과 ==========
String dateModifiedLevyByProductResult = productLevyOver31OmChecker.check(existingData);
if (dateModifiedLevyByProductResult != null) {
log.info("========== 미필 비교 로직 종료 (날짜 수정 후 부과 - 명의이전 이전소유자, 31일 초과): {} ==========", vhclno);
return dateModifiedLevyByProductResult;
}
// ========== 6. 날짜 수정 후 부과 체크 - 명의이전, 31일 초과 ==========
String dateModifiedLevyByOwnerChangeOverResult = ownerLevyOver31OmChecker.check(existingData);
if (dateModifiedLevyByOwnerChangeOverResult != null) {
log.info("========== 미필 비교 로직 종료 (날짜 수정 후 부과 - 명의이전, 31일 초과): {} ==========", vhclno);
return dateModifiedLevyByOwnerChangeOverResult;
}
// ========== 7. 이첩 체크 ==========
// ========== 3. 이첩 체크 ==========
String transferResult = transferOmChecker.check(existingData);
if (transferResult != null) {
log.info("========== 미필 비교 로직 종료 (이첩): {} ==========", vhclno);

@ -1,236 +0,0 @@
package go.kr.project.carInspectionPenalty.registrationOm.service.impl.om_checker;
import egovframework.constant.TaskPrcsSttsConstants;
import egovframework.exception.MessageException;
import egovframework.util.DateUtil;
import go.kr.project.api.model.request.NewBasicRequest;
import go.kr.project.api.model.request.NewLedgerRequest;
import go.kr.project.api.model.response.NewBasicResponse;
import go.kr.project.api.model.response.NewLedgerResponse;
import go.kr.project.api.service.ExternalVehicleApiService;
import go.kr.project.api.service.VmisCarBassMatterInqireLogService;
import go.kr.project.api.service.VmisCarLedgerFrmbkLogService;
import go.kr.project.carInspectionPenalty.registrationOm.mapper.CarFfnlgTrgtIncmpMapper;
import go.kr.project.carInspectionPenalty.registrationOm.model.CarFfnlgTrgtIncmpVO;
import go.kr.project.carInspectionPenalty.registrationOm.service.impl.ComparisonOmRemarkBuilder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.time.LocalDate;
import java.util.List;
/**
* 4. - (31 ) ()
*
* <p> , </p>
* <p> = + 146</p>
*/
@Slf4j
@Component
public class OwnerCloseWithin31OmChecker extends AbstractComparisonOmChecker {
public OwnerCloseWithin31OmChecker(CarFfnlgTrgtIncmpMapper carFfnlgTrgtIncmpMapper,
ExternalVehicleApiService apiService,
VmisCarBassMatterInqireLogService bassMatterLogService,
VmisCarLedgerFrmbkLogService ledgerLogService) {
super(carFfnlgTrgtIncmpMapper, apiService, bassMatterLogService, ledgerLogService);
}
@Override
public String check(CarFfnlgTrgtIncmpVO existingData) {
String vhclno = existingData.getVhclno();
String levyCrtrYmd = existingData.getLevyCrtrYmd(); // 미필: 검사유효기간 종료일 + 146일
String inspVldPrd = existingData.getInspVldPrd(); // 검사유효기간
// 검사유효기간에서 시작일과 종료일 추출
String inspVldPrdStart = null;
String inspVldPrdEnd = null;
if (inspVldPrd != null && inspVldPrd.contains("~")) {
String[] dates = inspVldPrd.split("~");
inspVldPrdStart = dates[0].trim().replace("-", "");
inspVldPrdEnd = dates.length > 1 ? dates[1].trim().replace("-", "") : null;
}
try {
// ========== Step 1: 자동차기본정보 조회 (차량번호, 부과일자=검사유효기간 종료일+146일) ==========
log.info("[내사종결-명의이전-미필] Step 1: 자동차기본정보 조회 - 차량번호: {}, 부과일자: {}", vhclno, levyCrtrYmd);
NewBasicRequest step1Request = createBasicRequest(vhclno, null, levyCrtrYmd);
NewBasicResponse step1Response = apiService.getBasicInfo(step1Request);
bassMatterLogService.updateCarFfnlgTrgtIdByTxIdNewTx(step1Response, existingData.getCarFfnlgTrgtIncmpId());
if (step1Response == null || step1Response.getRecord() == null || step1Response.getRecord().isEmpty()) {
log.warn("[내사종결-명의이전-미필] Step 1 응답 없음 - 차량번호: {}", vhclno);
return null;
}
NewBasicResponse.Record step1Record = step1Response.getRecord().get(0);
String vin = step1Record.getVin(); // 차대번호
String step1OwnerName = step1Record.getRprsOwnrNm(); // 부과일자 기준 소유자명
String step1RprsvOwnrIdecno = step1Record.getRprsvOwnrIdecno(); // 부과일자 기준 대표소유자 회원번호
log.info("[내사종결-명의이전-미필] Step 1 결과 - 차대번호: {}, 소유자명: {}", vin, step1OwnerName);
// 부과일자 소유자가 상품용 아님
if (step1OwnerName != null && step1OwnerName.contains("상품용")) {
log.debug("[내사종결-명의이전-미필] 부과일자 소유자가 상품용 - 차량번호: {}, 소유자명: {}", vhclno, step1OwnerName);
return null;
}
log.info("[내사종결-명의이전-미필] 부과일자 소유자가 상품용 아님 - 차량번호: {}, 소유자명: {}", vhclno, step1OwnerName);
// ========== Step 2: 자동차기본정보 조회 (차대번호, 부과일자=오늘일자) ==========
String today = LocalDate.now().format(DATE_FORMATTER);
log.info("[내사종결-명의이전-미필] Step 2: 자동차기본정보 조회 - 차대번호: {}, 오늘일자: {}", vin, today);
NewBasicRequest step2Request = createBasicRequest(null, vin, today);
NewBasicResponse step2Response = apiService.getBasicInfo(step2Request);
bassMatterLogService.updateCarFfnlgTrgtIdByTxIdNewTx(step2Response, existingData.getCarFfnlgTrgtIncmpId());
if (step2Response == null || step2Response.getRecord() == null || step2Response.getRecord().isEmpty()) {
log.warn("[내사종결-명의이전-미필] Step 2 응답 없음 - 차대번호: {}", vin);
return null;
}
NewBasicResponse.Record step2Record = step2Response.getRecord().get(0);
String currentVhclno = step2Record.getVhrno();
String currentOwnerName = step2Record.getRprsOwnrNm();
String currentIdecno = step2Record.getRprsvOwnrIdecno();
String currentLegalDongCode = step2Record.getUsgsrhldStdgCd();
log.info("[내사종결-명의이전-미필] Step 2 결과 - 차량번호: {}, 성명: {}, 주민번호: {}, 법정동코드: {}",
currentVhclno, currentOwnerName, currentIdecno, currentLegalDongCode);
// ========== Step 3: 자동차등록원부(갑) 조회 ==========
log.info("[내사종결-명의이전-미필] Step 3: 자동차등록원부(갑) 조회 - 차량번호: {}, 성명: {}, 주민번호: {}, 법정동코드: {}",
currentVhclno, currentOwnerName, currentIdecno, currentLegalDongCode);
NewLedgerRequest step3Request = createLedgerRequest(currentVhclno, currentOwnerName, currentIdecno, currentLegalDongCode);
NewLedgerResponse step3Response = apiService.getLedgerInfo(step3Request);
ledgerLogService.updateCarFfnlgTrgtIdByTxIdNewTx(step3Response, existingData.getCarFfnlgTrgtIncmpId());
if (step3Response == null) {
log.warn("[내사종결-명의이전-미필] Step 3 응답 없음 - 차량번호: {}", currentVhclno);
return null;
}
List<NewLedgerResponse.Record> ledgerRecords = step3Response.getRecord();
if (ledgerRecords == null || ledgerRecords.isEmpty()) {
log.debug("[내사종결-명의이전-미필] 갑부 상세 내역 없음 - 차량번호: {}", vhclno);
return null;
}
// ========== 갑부 상세에서 검사유효기간 내 명의이전 레코드 찾기 (가장 최근 일자) ==========
log.info("[내사종결-명의이전-미필] 갑부 상세 레코드 검색 시작 - 검사유효기간 시작일: {}, 검사유효기간 종료일: {}", inspVldPrdStart, inspVldPrdEnd);
NewLedgerResponse.Record targetRecord = null;
LocalDate inspVldPrdStartDate = DateUtil.parseDate(inspVldPrdStart);
LocalDate inspVldPrdEndDate = DateUtil.parseDate(inspVldPrdEnd);
LocalDate latestChgDate = null;
for (NewLedgerResponse.Record record : ledgerRecords) {
String chgYmd = record.getChgYmd();
String chgTaskSeCd = record.getChgTaskSeCd();
// 조건: CHG_TASK_SE_CD == "11" (명의이전)
if (!"11".equals(chgTaskSeCd) || chgYmd == null) {
continue;
}
LocalDate chgDate = DateUtil.parseDate(chgYmd);
if (chgDate == null) {
continue;
}
// 조건: 검사유효기간 시작일 <= CHG_YMD <= 검사유효기간 종료일
if ((chgDate.isEqual(inspVldPrdStartDate) || chgDate.isAfter(inspVldPrdStartDate)) &&
(chgDate.isEqual(inspVldPrdEndDate) || chgDate.isBefore(inspVldPrdEndDate))) {
// 가장 최근 일자 선택
if (latestChgDate == null || chgDate.isAfter(latestChgDate)) {
targetRecord = record;
latestChgDate = chgDate;
log.debug("[내사종결-명의이전-미필] 검사유효기간 내 명의이전 발견 - 변경일자: {}, 변경업무: {}", chgYmd, chgTaskSeCd);
}
}
}
if (targetRecord == null) {
log.debug("[내사종결-명의이전-미필] 검사유효기간 내 명의이전 레코드 없음 - 차량번호: {}", vhclno);
return null;
}
String targetChgYmd = targetRecord.getChgYmd();
log.info("[내사종결-명의이전-미필] 검사유효기간 내 명의이전 발견! 변경일자: {}, 변경업무: {}", targetChgYmd, targetRecord.getChgTaskSeNm());
// ========== 명의이전일자 ~ 부과일자 사이의 일수 계산 ==========
LocalDate chgDate = DateUtil.parseDate(targetChgYmd);
LocalDate levyDate = DateUtil.parseDate(levyCrtrYmd);
long daysBetween = java.time.temporal.ChronoUnit.DAYS.between(chgDate, levyDate);
if (daysBetween < 0 || daysBetween > DAYS_THRESHOLD) {
log.debug("[내사종결-명의이전-미필] 명의이전일자가 부과일자의 {}일 이내가 아님 - 변경일자: {}, 부과일자: {}, 일수차이: {}일",
DAYS_THRESHOLD, targetChgYmd, levyCrtrYmd, daysBetween);
return null;
}
log.info("[내사종결-명의이전-미필] 명의이전일자가 부과일자의 {}일 이내 확인 - 변경일자: {}, 부과일자: {}, 일수차이: {}일",
DAYS_THRESHOLD, targetChgYmd, levyCrtrYmd, daysBetween);
// ========== Step 4: 자동차기본정보 조회 (차대번호, 부과일자=CHG_YMD) ==========
LocalDate targetDate = DateUtil.parseDate(targetChgYmd);
NewBasicRequest step4Request = createBasicRequest(null, vin, targetDate.format(DATE_FORMATTER));
NewBasicResponse step4Response = apiService.getBasicInfo(step4Request);
bassMatterLogService.updateCarFfnlgTrgtIdByTxIdNewTx(step4Response, existingData.getCarFfnlgTrgtIncmpId());
if (step4Response == null || step4Response.getRecord() == null || step4Response.getRecord().isEmpty()) {
log.warn("[내사종결-명의이전-미필] Step 4 응답 없음 - 차대번호: {}, 부과일자: {}", vin, targetDate.format(DATE_FORMATTER));
return null;
}
NewBasicResponse.Record step4Record = step4Response.getRecord().get(0);
String step4OwnerName = step4Record.getRprsOwnrNm(); // CHG_YMD 시점의 소유자명
String step4RprsvOwnrIdecno = step4Record.getRprsvOwnrIdecno(); // 대표소유자 회원번호
log.info("[내사종결-명의이전-미필] Step 4 결과 - 소유자명: {}", step4OwnerName);
// 검사유효기간내 명의변경 소유자와 부과일자의 소유자가 같냐
if (step4OwnerName == null || !step4RprsvOwnrIdecno.contains(step1RprsvOwnrIdecno)) {
log.debug("[내사종결-명의이전-미필] 명의이전 전 소유자가 상품용 - Step4 소유자명: {}", step4OwnerName);
return null;
}
log.info("[내사종결-명의이전-미필] 명의이전 전 소유자가 상품용 아님 - 소유자명: {}", step4OwnerName);
// ========== 비고 생성 ==========
String rmrk = ComparisonOmRemarkBuilder.buildOwnerChangeRemark(
step1Record, step4Record, targetRecord,
vhclno, levyCrtrYmd, inspVldPrdStart, inspVldPrdEnd, daysBetween
);
// ========== DB 업데이트 ==========
existingData.setCarBassMatterInqireId(step1Response.getGeneratedId());
existingData.setCarLedgerFrmbkId(step3Response.getGeneratedId());
existingData.setTaskPrcsSttsCd(TaskPrcsSttsConstants.TASK_PRCS_STTS_CD_04_INVESTIGATION_CLOSED);
existingData.setTaskPrcsYmd(LocalDate.now().format(DATE_FORMATTER));
existingData.setCarBscMttrInqFlnm(step4OwnerName);
existingData.setCarRegFrmbkChgTaskSeCd(targetRecord.getChgTaskSeCd());
existingData.setCarRegFrmbkChgTaskSeNm(targetRecord.getChgTaskSeNm());
existingData.setCarRegFrmbkChgYmd(targetRecord.getChgYmd().replace("-", ""));
existingData.setCarRegFrmbkDtl(ComparisonOmRemarkBuilder.buildLedgerRecordDetail(targetRecord));
existingData.setRmrk(rmrk);
int updateCount = carFfnlgTrgtIncmpMapper.update(existingData);
if (updateCount == 0) {
throw new MessageException(String.format("[내사종결-명의이전-미필] 업데이트 실패: %s", vhclno));
}
log.info("[내사종결-명의이전-미필] 처리 완료! 차량번호: {}", vhclno);
return TaskPrcsSttsConstants.TASK_PRCS_STTS_CD_04_INVESTIGATION_CLOSED;
} catch (Exception e) {
log.error("[내사종결-명의이전-미필] 검증 중 오류 발생 - 차량번호: {}", vhclno, e);
throw new MessageException(String.format("[내사종결-명의이전-미필] 검증 중 오류 발생 - 차량번호: %s", vhclno), e);
}
}
}

@ -1,236 +0,0 @@
package go.kr.project.carInspectionPenalty.registrationOm.service.impl.om_checker;
import egovframework.constant.TaskPrcsSttsConstants;
import egovframework.exception.MessageException;
import egovframework.util.DateUtil;
import go.kr.project.api.model.request.NewBasicRequest;
import go.kr.project.api.model.request.NewLedgerRequest;
import go.kr.project.api.model.response.NewBasicResponse;
import go.kr.project.api.model.response.NewLedgerResponse;
import go.kr.project.api.service.ExternalVehicleApiService;
import go.kr.project.api.service.VmisCarBassMatterInqireLogService;
import go.kr.project.api.service.VmisCarLedgerFrmbkLogService;
import go.kr.project.carInspectionPenalty.registrationOm.mapper.CarFfnlgTrgtIncmpMapper;
import go.kr.project.carInspectionPenalty.registrationOm.model.CarFfnlgTrgtIncmpVO;
import go.kr.project.carInspectionPenalty.registrationOm.service.impl.ComparisonOmRemarkBuilder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.time.LocalDate;
import java.util.List;
/**
* 6. - (31 ) ()
*
* <p> , , 31 </p>
* <p> = + 146</p>
*/
@Slf4j
@Component
public class OwnerLevyOver31OmChecker extends AbstractComparisonOmChecker {
public OwnerLevyOver31OmChecker(CarFfnlgTrgtIncmpMapper carFfnlgTrgtIncmpMapper,
ExternalVehicleApiService apiService,
VmisCarBassMatterInqireLogService bassMatterLogService,
VmisCarLedgerFrmbkLogService ledgerLogService) {
super(carFfnlgTrgtIncmpMapper, apiService, bassMatterLogService, ledgerLogService);
}
@Override
public String check(CarFfnlgTrgtIncmpVO existingData) {
String vhclno = existingData.getVhclno();
String levyCrtrYmd = existingData.getLevyCrtrYmd(); // 미필: 검사유효기간 종료일 + 146일
String inspVldPrd = existingData.getInspVldPrd(); // 검사유효기간
// 검사유효기간에서 시작일과 종료일 추출
String inspVldPrdStart = null;
String inspVldPrdEnd = null;
if (inspVldPrd != null && inspVldPrd.contains("~")) {
String[] dates = inspVldPrd.split("~");
inspVldPrdStart = dates[0].trim().replace("-", "");
inspVldPrdEnd = dates.length > 1 ? dates[1].trim().replace("-", "") : null;
}
try {
// ========== Step 1: 자동차기본정보 조회 (차량번호, 부과일자=검사유효기간 종료일+146일) ==========
log.info("[날짜수정후부과-명의이전-미필] Step 1: 자동차기본정보 조회 - 차량번호: {}, 부과일자: {}", vhclno, levyCrtrYmd);
NewBasicRequest step1Request = createBasicRequest(vhclno, null, levyCrtrYmd);
NewBasicResponse step1Response = apiService.getBasicInfo(step1Request);
bassMatterLogService.updateCarFfnlgTrgtIdByTxIdNewTx(step1Response, existingData.getCarFfnlgTrgtIncmpId());
if (step1Response == null || step1Response.getRecord() == null || step1Response.getRecord().isEmpty()) {
log.warn("[날짜수정후부과-명의이전-미필] Step 1 응답 없음 - 차량번호: {}", vhclno);
return null;
}
NewBasicResponse.Record step1Record = step1Response.getRecord().get(0);
String vin = step1Record.getVin(); // 차대번호
String step1OwnerName = step1Record.getRprsOwnrNm(); // 부과일자 기준 소유자명
String step1RprsvOwnrIdecno = step1Record.getRprsvOwnrIdecno(); // 부과일자 기준 대표소유자 회원번호
log.info("[날짜수정후부과-명의이전-미필] Step 1 결과 - 차대번호: {}, 소유자명: {}", vin, step1OwnerName);
// 부과일자 소유자가 상품용 아님
if (step1OwnerName != null && step1OwnerName.contains("상품용")) {
log.debug("[날짜수정후부과-명의이전-미필] 부과일자 소유자가 상품용 - 차량번호: {}, 소유자명: {}", vhclno, step1OwnerName);
return null;
}
log.info("[날짜수정후부과-명의이전-미필] 부과일자 소유자가 상품용 아님 - 차량번호: {}, 소유자명: {}", vhclno, step1OwnerName);
// ========== Step 2: 자동차기본정보 조회 (차대번호, 부과일자=오늘일자) ==========
String today = LocalDate.now().format(DATE_FORMATTER);
log.info("[날짜수정후부과-명의이전-미필] Step 2: 자동차기본정보 조회 - 차대번호: {}, 오늘일자: {}", vin, today);
NewBasicRequest step2Request = createBasicRequest(null, vin, today);
NewBasicResponse step2Response = apiService.getBasicInfo(step2Request);
bassMatterLogService.updateCarFfnlgTrgtIdByTxIdNewTx(step2Response, existingData.getCarFfnlgTrgtIncmpId());
if (step2Response == null || step2Response.getRecord() == null || step2Response.getRecord().isEmpty()) {
log.warn("[날짜수정후부과-명의이전-미필] Step 2 응답 없음 - 차대번호: {}", vin);
return null;
}
NewBasicResponse.Record step2Record = step2Response.getRecord().get(0);
String currentVhclno = step2Record.getVhrno();
String currentOwnerName = step2Record.getRprsOwnrNm();
String currentIdecno = step2Record.getRprsvOwnrIdecno();
String currentLegalDongCode = step2Record.getUsgsrhldStdgCd();
log.info("[날짜수정후부과-명의이전-미필] Step 2 결과 - 차량번호: {}, 성명: {}, 주민번호: {}, 법정동코드: {}",
currentVhclno, currentOwnerName, currentIdecno, currentLegalDongCode);
// ========== Step 3: 자동차등록원부(갑) 조회 ==========
log.info("[날짜수정후부과-명의이전-미필] Step 3: 자동차등록원부(갑) 조회 - 차량번호: {}, 성명: {}, 주민번호: {}, 법정동코드: {}",
currentVhclno, currentOwnerName, currentIdecno, currentLegalDongCode);
NewLedgerRequest step3Request = createLedgerRequest(currentVhclno, currentOwnerName, currentIdecno, currentLegalDongCode);
NewLedgerResponse step3Response = apiService.getLedgerInfo(step3Request);
ledgerLogService.updateCarFfnlgTrgtIdByTxIdNewTx(step3Response, existingData.getCarFfnlgTrgtIncmpId());
if (step3Response == null) {
log.warn("[날짜수정후부과-명의이전-미필] Step 3 응답 없음 - 차량번호: {}", currentVhclno);
return null;
}
List<NewLedgerResponse.Record> ledgerRecords = step3Response.getRecord();
if (ledgerRecords == null || ledgerRecords.isEmpty()) {
log.debug("[날짜수정후부과-명의이전-미필] 갑부 상세 내역 없음 - 차량번호: {}", vhclno);
return null;
}
// ========== 갑부 상세에서 검사유효기간 내 명의이전 레코드 찾기 ==========
log.info("[날짜수정후부과-명의이전-미필] 갑부 상세 레코드 검색 시작 - 검사유효기간 시작일: {}, 검사유효기간 종료일: {}", inspVldPrdStart, inspVldPrdEnd);
NewLedgerResponse.Record targetRecord = null;
LocalDate inspVldPrdStartDate = DateUtil.parseDate(inspVldPrdStart);
LocalDate inspVldPrdEndDate = DateUtil.parseDate(inspVldPrdEnd);
LocalDate latestChgDate = null;
for (NewLedgerResponse.Record record : ledgerRecords) {
String chgYmd = record.getChgYmd();
String chgTaskSeCd = record.getChgTaskSeCd();
// 조건: CHG_TASK_SE_CD == "11" (명의이전)
if (!"11".equals(chgTaskSeCd) || chgYmd == null) {
continue;
}
LocalDate chgDate = DateUtil.parseDate(chgYmd);
if (chgDate == null) {
continue;
}
// 조건: 검사유효기간 시작일 <= CHG_YMD <= 검사유효기간 종료일
if ((chgDate.isEqual(inspVldPrdStartDate) || chgDate.isAfter(inspVldPrdStartDate)) &&
(chgDate.isEqual(inspVldPrdEndDate) || chgDate.isBefore(inspVldPrdEndDate))) {
// 가장 최근 일자 선택
if (latestChgDate == null || chgDate.isAfter(latestChgDate)) {
targetRecord = record;
latestChgDate = chgDate;
log.debug("[내사종결-명의이전-미필] 검사유효기간 내 명의이전 발견 - 변경일자: {}, 변경업무: {}", chgYmd, chgTaskSeCd);
}
}
}
if (targetRecord == null) {
log.debug("[날짜수정후부과-명의이전-미필] 검사유효기간 내 명의이전 레코드 없음 - 차량번호: {}", vhclno);
return null;
}
String targetChgYmd = targetRecord.getChgYmd();
log.info("[날짜수정후부과-명의이전-미필] 검사유효기간 내 명의이전 발견! 변경일자: {}, 변경업무: {}", targetChgYmd, targetRecord.getChgTaskSeNm());
// ========== 명의이전일자 ~ 부과일자 사이의 일수 계산 ==========
LocalDate chgDate = DateUtil.parseDate(targetChgYmd);
LocalDate levyDate = DateUtil.parseDate(levyCrtrYmd);
long daysBetween = java.time.temporal.ChronoUnit.DAYS.between(chgDate, levyDate);
if (daysBetween <= DAYS_THRESHOLD) {
log.debug("[날짜수정후부과-명의이전-미필] 명의이전일자가 부과일자의 {}일 이내임 - 변경일자: {}, 부과일자: {}, 일수차이: {}일",
DAYS_THRESHOLD, targetChgYmd, levyCrtrYmd, daysBetween);
return null;
}
log.info("[날짜수정후부과-명의이전-미필] 명의이전일자가 부과일자의 {}일 초과 확인 - 변경일자: {}, 부과일자: {}, 일수차이: {}일",
DAYS_THRESHOLD, targetChgYmd, levyCrtrYmd, daysBetween);
// ========== Step 4: 자동차기본정보 조회 (차대번호, 부과일자=CHG_YMD) ==========
LocalDate targetDate = DateUtil.parseDate(targetChgYmd);
NewBasicRequest step4Request = createBasicRequest(null, vin, targetDate.format(DATE_FORMATTER));
NewBasicResponse step4Response = apiService.getBasicInfo(step4Request);
bassMatterLogService.updateCarFfnlgTrgtIdByTxIdNewTx(step4Response, existingData.getCarFfnlgTrgtIncmpId());
if (step4Response == null || step4Response.getRecord() == null || step4Response.getRecord().isEmpty()) {
log.warn("[날짜수정후부과-명의이전-미필] Step 4 응답 없음 - 차대번호: {}, 부과일자: {}", vin, targetDate.format(DATE_FORMATTER));
return null;
}
NewBasicResponse.Record step4Record = step4Response.getRecord().get(0);
String step4OwnerName = step4Record.getRprsOwnrNm(); // CHG_YMD 시점의 소유자명
String step4RprsvOwnrIdecno = step4Record.getRprsvOwnrIdecno(); // 대표소유자 회원번호
log.info("[날짜수정후부과-명의이전-미필] Step 4 결과 - 소유자명: {}", step4OwnerName);
// 검사유효기간내 명의변경 소유자와 부과일자의 소유자가 같냐
if (step4OwnerName == null || !step4RprsvOwnrIdecno.contains(step1RprsvOwnrIdecno)) {
log.debug("[내사종결-명의이전-미필] 명의이전 전 소유자가 상품용 - Step4 소유자명: {}", step4OwnerName);
return null;
}
log.info("[날짜수정후부과-명의이전-미필] 명의이전 전 소유자가 상품용 아님 - 소유자명: {}", step4OwnerName);
// ========== 비고 생성 ==========
String rmrk = ComparisonOmRemarkBuilder.buildOwnerChangeRemark(
step1Record, step4Record, targetRecord,
vhclno, levyCrtrYmd, inspVldPrdStart, inspVldPrdEnd, daysBetween
);
// ========== DB 업데이트 ==========
existingData.setCarBassMatterInqireId(step1Response.getGeneratedId());
existingData.setCarLedgerFrmbkId(step3Response.getGeneratedId());
existingData.setTaskPrcsSttsCd(TaskPrcsSttsConstants.TASK_PRCS_STTS_CD_05_DATE_MODIFIED_LEVY);
existingData.setTaskPrcsYmd(LocalDate.now().format(DATE_FORMATTER));
existingData.setCarBscMttrInqFlnm(step4OwnerName);
existingData.setCarRegFrmbkChgTaskSeCd(targetRecord.getChgTaskSeCd());
existingData.setCarRegFrmbkChgTaskSeNm(targetRecord.getChgTaskSeNm());
existingData.setCarRegFrmbkChgYmd(targetRecord.getChgYmd().replace("-", ""));
existingData.setCarRegFrmbkDtl(ComparisonOmRemarkBuilder.buildLedgerRecordDetail(targetRecord));
existingData.setRmrk(rmrk);
int updateCount = carFfnlgTrgtIncmpMapper.update(existingData);
if (updateCount == 0) {
throw new MessageException(String.format("[날짜수정후부과-명의이전-미필] 업데이트 실패: %s", vhclno));
}
log.info("[날짜수정후부과-명의이전-미필] 처리 완료! 차량번호: {}", vhclno);
return TaskPrcsSttsConstants.TASK_PRCS_STTS_CD_05_DATE_MODIFIED_LEVY;
} catch (Exception e) {
log.error("[날짜수정후부과-명의이전-미필] 검증 중 오류 발생 - 차량번호: {}", vhclno, e);
throw new MessageException(String.format("[날짜수정후부과-명의이전-미필] 검증 중 오류 발생 - 차량번호: %s", vhclno), e);
}
}
}

@ -20,19 +20,34 @@ import java.time.LocalDate;
import java.util.List;
/**
* 3. - , 31 ()
* -
*
* <p> , 31 </p>
* <p> = + 146</p>
* <p> , </p>
*
* API :
* 1) (, = +146) ,
* 2) (, =) , , ,
* 3) ()(, , , ) List
* 4) (, =-1)
*
* :
* - 1: "상품용"
* - 2: ( 11)
* CHG_YMD >
*
* CHG_TASK_SE_CD == "11" ()
* - 3: 4 API
* "상품용" (05), : ()
* "상품용" (04), : ()
*/
@Slf4j
@Component
public class ProductCloseWithin31OmChecker extends AbstractComparisonOmChecker {
public class OwnerTransferOmChecker extends AbstractComparisonOmChecker {
public ProductCloseWithin31OmChecker(CarFfnlgTrgtIncmpMapper carFfnlgTrgtIncmpMapper,
ExternalVehicleApiService apiService,
VmisCarBassMatterInqireLogService bassMatterLogService,
VmisCarLedgerFrmbkLogService ledgerLogService) {
public OwnerTransferOmChecker(CarFfnlgTrgtIncmpMapper carFfnlgTrgtIncmpMapper,
ExternalVehicleApiService apiService,
VmisCarBassMatterInqireLogService bassMatterLogService,
VmisCarLedgerFrmbkLogService ledgerLogService) {
super(carFfnlgTrgtIncmpMapper, apiService, bassMatterLogService, ledgerLogService);
}
@ -51,16 +66,21 @@ public class ProductCloseWithin31OmChecker extends AbstractComparisonOmChecker {
inspVldPrdEnd = dates.length > 1 ? dates[1].trim().replace("-", "") : null;
}
if (inspVldPrdEnd == null) {
log.debug("[명의이전-미필] 검사유효기간 종료일 없음 - 차량번호: {}", vhclno);
return null;
}
try {
// ========== Step 1: 자동차기본정보 조회 (차량번호, 부과일자=검사유효기간 종료일+146일) ==========
log.info("[내사종결-명의이전 상품용-미필] Step 1: 자동차기본정보 조회 - 차량번호: {}, 부과일자: {}", vhclno, levyCrtrYmd);
log.info("[명의이전-미필] Step 1: 자동차기본정보 조회 - 차량번호: {}, 부과일자: {}", vhclno, levyCrtrYmd);
NewBasicRequest step1Request = createBasicRequest(vhclno, null, levyCrtrYmd);
NewBasicResponse step1Response = apiService.getBasicInfo(step1Request);
bassMatterLogService.updateCarFfnlgTrgtIdByTxIdNewTx(step1Response, existingData.getCarFfnlgTrgtIncmpId());
if (step1Response == null || step1Response.getRecord() == null || step1Response.getRecord().isEmpty()) {
log.warn("[내사종결-명의이전 상품용-미필] Step 1 응답 없음 - 차량번호: {}", vhclno);
log.warn("[명의이전-미필] Step 1 응답 없음 - 차량번호: {}", vhclno);
return null;
}
@ -68,26 +88,26 @@ public class ProductCloseWithin31OmChecker extends AbstractComparisonOmChecker {
String vin = step1Record.getVin(); // 차대번호
String step1OwnerName = step1Record.getRprsOwnrNm(); // 부과일자 기준 소유자명
log.info("[내사종결-명의이전 상품용-미필] Step 1 결과 - 차대번호: {}, 소유자명: {}", vin, step1OwnerName);
log.info("[명의이전-미필] Step 1 결과 - 차대번호: {}, 소유자명: {}", vin, step1OwnerName);
// 조건 1: 소유자명에 "상품용" 포함 여부 확인
if (step1OwnerName == null || step1OwnerName.contains("상품용")) {
log.debug("[내사종결-명의이전 상품용-미필] 소유자명에 '상품용' 포함 - 차량번호: {}, 소유자명: {}", vhclno, step1OwnerName);
// 조건 1: 소유자명에 "상품용" 포함 확인 (포함되면 다른 Checker에서 처리)
if (step1OwnerName != null && step1OwnerName.contains("상품용")) {
log.debug("[명의이전-미필] 소유자명에 '상품용' 포함 - 차량번호: {}, 소유자명: {}", vhclno, step1OwnerName);
return null;
}
log.info("[내사종결-명의이전 상품용-미필] 소유자명에 '상품용' 포함 확인! - 차량번호: {}, 소유자명: {}", vhclno, step1OwnerName);
log.info("[명의이전-미필] 소유자명에 '상품용' 포함 확인! - 차량번호: {}, 소유자명: {}", vhclno, step1OwnerName);
// ========== Step 2: 자동차기본정보 조회 (차대번호, 부과일자=오늘일자) ==========
String today = LocalDate.now().format(DATE_FORMATTER);
log.info("[내사종결-명의이전 상품용-미필] Step 2: 자동차기본정보 조회 - 차대번호: {}, 오늘일자: {}", vin, today);
log.info("[명의이전-미필] Step 2: 자동차기본정보 조회 - 차대번호: {}, 오늘일자: {}", vin, today);
NewBasicRequest step2Request = createBasicRequest(null, vin, today);
NewBasicResponse step2Response = apiService.getBasicInfo(step2Request);
bassMatterLogService.updateCarFfnlgTrgtIdByTxIdNewTx(step2Response, existingData.getCarFfnlgTrgtIncmpId());
if (step2Response == null || step2Response.getRecord() == null || step2Response.getRecord().isEmpty()) {
log.warn("[내사종결-명의이전 상품용-미필] Step 2 응답 없음 - 차대번호: {}", vin);
log.warn("[명의이전-미필] Step 2 응답 없음 - 차대번호: {}", vin);
return null;
}
@ -97,11 +117,11 @@ public class ProductCloseWithin31OmChecker extends AbstractComparisonOmChecker {
String currentIdecno = step2Record.getRprsvOwnrIdecno();
String currentLegalDongCode = step2Record.getUsgsrhldStdgCd();
log.info("[내사종결-명의이전 상품용-미필] Step 2 결과 - 차량번호: {}, 성명: {}, 주민번호: {}, 법정동코드: {}",
log.info("[명의이전-미필] Step 2 결과 - 차량번호: {}, 성명: {}, 주민번호: {}, 법정동코드: {}",
currentVhclno, currentOwnerName, currentIdecno, currentLegalDongCode);
// ========== Step 3: 자동차등록원부(갑) 조회 ==========
log.info("[내사종결-명의이전 상품용-미필] Step 3: 자동차등록원부(갑) 조회 - 차량번호: {}, 성명: {}, 주민번호: {}, 법정동코드: {}",
log.info("[명의이전-미필] Step 3: 자동차등록원부(갑) 조회 - 차량번호: {}, 성명: {}, 주민번호: {}, 법정동코드: {}",
currentVhclno, currentOwnerName, currentIdecno, currentLegalDongCode);
NewLedgerRequest step3Request = createLedgerRequest(currentVhclno, currentOwnerName, currentIdecno, currentLegalDongCode);
@ -109,22 +129,22 @@ public class ProductCloseWithin31OmChecker extends AbstractComparisonOmChecker {
ledgerLogService.updateCarFfnlgTrgtIdByTxIdNewTx(step3Response, existingData.getCarFfnlgTrgtIncmpId());
if (step3Response == null) {
log.warn("[내사종결-명의이전 상품용-미필] Step 3 응답 없음 - 차량번호: {}", currentVhclno);
log.warn("[명의이전-미필] Step 3 응답 없음 - 차량번호: {}", currentVhclno);
return null;
}
List<NewLedgerResponse.Record> ledgerRecords = step3Response.getRecord();
if (ledgerRecords == null || ledgerRecords.isEmpty()) {
log.debug("[내사종결-명의이전 상품용-미필] 갑부 상세 내역 없음 - 차량번호: {}", vhclno);
log.debug("[명의이전-미필] 갑부 상세 내역 없음 - 차량번호: {}", vhclno);
return null;
}
// ========== 갑부 상세에서 조건에 맞는 레코드 찾기 ==========
log.info("[내사종결-명의이전 상품용-미필] 갑부 상세 레코드 검색 시작 - 부과일자: {}, 검사유효기간 종료일: {}", levyCrtrYmd, inspVldPrdEnd);
log.info("[명의이전-미필] 갑부 상세 레코드 검색 시작 - 검사유효기간 종료일: {}", inspVldPrdEnd);
NewLedgerResponse.Record targetRecord = null;
LocalDate latestChgDate = null;
LocalDate levyDate = DateUtil.parseDate(levyCrtrYmd);
LocalDate inspVldPrdEndDate = DateUtil.parseDate(inspVldPrdEnd);
for (NewLedgerResponse.Record record : ledgerRecords) {
String chgYmd = record.getChgYmd();
@ -140,9 +160,9 @@ public class ProductCloseWithin31OmChecker extends AbstractComparisonOmChecker {
continue;
}
// 조건: CHG_YMD <= 부과일자
if (chgDate.isAfter(levyDate)) {
log.debug("[내사종결-명의이전 상품용-미필] CHG_YMD > 부과일자 - 변경일자: {}, 부과일자: {}", chgYmd, levyCrtrYmd);
// 조건: CHG_YMD > 검사유효기간 종료일
if (!chgDate.isAfter(inspVldPrdEndDate)) {
log.debug("[명의이전-미필] CHG_YMD <= 검사유효기간 종료일 - 변경일자: {}, 검사유효기간 종료일: {}", chgYmd, inspVldPrdEnd);
continue;
}
@ -150,65 +170,70 @@ public class ProductCloseWithin31OmChecker extends AbstractComparisonOmChecker {
if (latestChgDate == null || chgDate.isAfter(latestChgDate)) {
latestChgDate = chgDate;
targetRecord = record;
log.debug("[내사종결-명의이전 상품용-미필] 조건 충족 레코드 발견 - 변경일자: {}, 변경업무: {}", chgYmd, chgTaskSeCd);
log.debug("[명의이전-미필] 조건 충족 레코드 발견 - 변경일자: {}, 변경업무: {}", chgYmd, chgTaskSeCd);
}
}
if (targetRecord == null) {
log.debug("[내사종결-명의이전 상품용-미필] 조건에 맞는 명의이전 레코드 없음 - 차량번호: {}", vhclno);
return null;
}
// 조건: 가장 마지막 명의이전일자가 부과일자의 기준일수 이내인지 확인
long daysBetween = java.time.temporal.ChronoUnit.DAYS.between(latestChgDate, levyDate);
if (daysBetween < 0 || daysBetween > DAYS_THRESHOLD) {
log.debug("[내사종결-명의이전 상품용-미필] 명의이전일자가 부과일자의 {}일 이내가 아님 - 변경일자: {}, 부과일자: {}, 일수차이: {}일",
DAYS_THRESHOLD, targetRecord.getChgYmd(), levyCrtrYmd, daysBetween);
log.debug("[명의이전-미필] 조건에 맞는 명의이전 레코드 없음 - 차량번호: {}", vhclno);
return null;
}
log.info("[내사종결-명의이전 상품용-미필] 명의이전일자가 부과일자의 {}일 이내 확인 - 변경일자: {}, 부과일자: {}, 일수차이: {}일",
DAYS_THRESHOLD, targetRecord.getChgYmd(), levyCrtrYmd, daysBetween);
String targetChgYmd = targetRecord.getChgYmd();
log.info("[내사종결-명의이전 상품용-미필] 조건 충족 레코드 선택! 변경일자: {}, 변경업무: {}", targetChgYmd, targetRecord.getChgTaskSeNm());
log.info("[명의이전-미필] 조건 충족 레코드 선택! 변경일자: {}, 변경업무: {}", targetChgYmd, targetRecord.getChgTaskSeNm());
// ========== Step 4: 자동차기본정보 조회 (차대번호, 부과일자=CHG_YMD -1일) ==========
// ========== Step 4: 자동차기본정보 조회 (차대번호, 부과일자=명의이전일자-1) ==========
LocalDate targetDate = DateUtil.parseDate(targetChgYmd);
String targetChgYmdMinus1 = targetDate.minusDays(1).format(DATE_FORMATTER);
log.info("[내사종결-명의이전 상품용-미필] Step 4: 자동차기본정보 조회 - 차대번호: {}, 부과일자: {} (원본: {})", vin, targetChgYmdMinus1, targetChgYmd);
LocalDate step4Date = targetDate.minusDays(1);
String step4Ymd = step4Date.format(DATE_FORMATTER);
log.info("[명의이전-미필] Step 4: 자동차기본정보 조회 - 차대번호: {}, 부과일자: {} (명의이전일자-1)", vin, step4Ymd);
NewBasicRequest step4Request = createBasicRequest(null, vin, targetChgYmdMinus1);
NewBasicRequest step4Request = createBasicRequest(null, vin, step4Ymd);
NewBasicResponse step4Response = apiService.getBasicInfo(step4Request);
bassMatterLogService.updateCarFfnlgTrgtIdByTxIdNewTx(step4Response, existingData.getCarFfnlgTrgtIncmpId());
if (step4Response == null || step4Response.getRecord() == null || step4Response.getRecord().isEmpty()) {
log.warn("[내사종결-명의이전 상품용-미필] Step 4 응답 없음 - 차대번호: {}, 부과일자: {}", vin, targetChgYmdMinus1);
log.warn("[명의이전-미필] Step 4 응답 없음 - 차대번호: {}, 부과일자: {}", vin, step4Ymd);
return null;
}
NewBasicResponse.Record step4Record = step4Response.getRecord().get(0);
String step4OwnerName = step4Record.getRprsOwnrNm(); // CHG_YMD 시점의 소유자명
log.info("[내사종결-명의이전 상품용-미필] Step 4 결과 - 소유자명: {}", step4OwnerName);
// ========== 소유자명 비교 - 상품용 포함 여부 확인 ==========
if (step4OwnerName == null || !step4OwnerName.contains("상품용")) {
log.debug("[내사종결-명의이전 상품용-미필] 소유자명에 '상품용' 미포함 - Step4 소유자명: {}", step4OwnerName);
return null;
String step4OwnerName = step4Record.getRprsOwnrNm(); // 명의이전일자-1 시점의 소유자명
log.info("[명의이전-미필] Step 4 결과 - 소유자명: {}", step4OwnerName);
// ========== 소유자명 상품용 포함 여부에 따라 처리 분기 ==========
String taskPrcsSttsCd;
String rmrk;
long daysBetween = 0; // 미필의 경우 일수차이는 0으로 설정
if (step4OwnerName != null && step4OwnerName.contains("상품용")) {
// 상품용 포함
log.info("[명의이전-미필] 명의이전 전 소유자가 상품용");
taskPrcsSttsCd = TaskPrcsSttsConstants.TASK_PRCS_STTS_CD_02_PRODUCT_USE;
rmrk = ComparisonOmRemarkBuilder.buildProductCloseLevyRemark(
step1Record, step4Record, targetRecord,
vhclno, levyCrtrYmd, inspVldPrdStart, inspVldPrdEnd, daysBetween
);
} else {
// 상품용 미포함
log.info("[명의이전-미필] 명의이전 전 소유자가 상품용 아님");
taskPrcsSttsCd = TaskPrcsSttsConstants.TASK_PRCS_STTS_CD_02_PRODUCT_USE;
rmrk = ComparisonOmRemarkBuilder.buildOwnerChangeRemark(
step1Record, step4Record, targetRecord,
vhclno, levyCrtrYmd, inspVldPrdStart, inspVldPrdEnd, daysBetween
);
}
log.info("[내사종결-명의이전 상품용-미필] 모든 조건 충족! 차량번호: {}, 변경일자: {}", vhclno, targetChgYmd);
// ========== 비고 생성 ==========
String rmrk = ComparisonOmRemarkBuilder.buildProductCloseLevyRemark(
step1Record, step4Record, targetRecord,
vhclno, levyCrtrYmd, inspVldPrdStart, inspVldPrdEnd, daysBetween
);
log.info("[명의이전-미필] 모든 조건 충족! 차량번호: {}, 처리상태: {}", vhclno, taskPrcsSttsCd);
// ========== DB 업데이트 ==========
existingData.setCarBassMatterInqireId(step1Response.getGeneratedId());
existingData.setCarLedgerFrmbkId(step3Response.getGeneratedId());
existingData.setTaskPrcsSttsCd(TaskPrcsSttsConstants.TASK_PRCS_STTS_CD_04_INVESTIGATION_CLOSED);
existingData.setTaskPrcsSttsCd(taskPrcsSttsCd);
existingData.setTaskPrcsYmd(LocalDate.now().format(DATE_FORMATTER));
existingData.setCarBscMttrInqFlnm(step4OwnerName);
existingData.setCarRegFrmbkChgTaskSeCd(targetRecord.getChgTaskSeCd());
@ -219,15 +244,15 @@ public class ProductCloseWithin31OmChecker extends AbstractComparisonOmChecker {
int updateCount = carFfnlgTrgtIncmpMapper.update(existingData);
if (updateCount == 0) {
throw new MessageException(String.format("[내사종결-명의이전 상품용-미필] 업데이트 실패: %s", vhclno));
throw new MessageException(String.format("[명의이전-미필] 업데이트 실패: %s", vhclno));
}
log.info("[내사종결-명의이전 상품용-미필] 처리 완료! 차량번호: {}", vhclno);
return TaskPrcsSttsConstants.TASK_PRCS_STTS_CD_04_INVESTIGATION_CLOSED;
log.info("[명의이전-미필] 처리 완료! 차량번호: {}, 처리상태: {}", vhclno, taskPrcsSttsCd);
return taskPrcsSttsCd;
} catch (Exception e) {
log.error("[내사종결-명의이전 상품용-미필] 검증 중 오류 발생 - 차량번호: {}", vhclno, e);
throw new MessageException(String.format("[내사종결-명의이전 상품용-미필] 검증 중 오류 발생 - 차량번호: %s", vhclno), e);
log.error("[명의이전-미필] 검증 중 오류 발생 - 차량번호: {}", vhclno, e);
throw new MessageException(String.format("[명의이전-미필] 검증 중 오류 발생 - 차량번호: %s", vhclno), e);
}
}
}

@ -1,235 +0,0 @@
package go.kr.project.carInspectionPenalty.registrationOm.service.impl.om_checker;
import egovframework.constant.TaskPrcsSttsConstants;
import egovframework.exception.MessageException;
import egovframework.util.DateUtil;
import go.kr.project.api.model.request.NewBasicRequest;
import go.kr.project.api.model.request.NewLedgerRequest;
import go.kr.project.api.model.response.NewBasicResponse;
import go.kr.project.api.model.response.NewLedgerResponse;
import go.kr.project.api.service.ExternalVehicleApiService;
import go.kr.project.api.service.VmisCarBassMatterInqireLogService;
import go.kr.project.api.service.VmisCarLedgerFrmbkLogService;
import go.kr.project.carInspectionPenalty.registrationOm.mapper.CarFfnlgTrgtIncmpMapper;
import go.kr.project.carInspectionPenalty.registrationOm.model.CarFfnlgTrgtIncmpVO;
import go.kr.project.carInspectionPenalty.registrationOm.service.impl.ComparisonOmRemarkBuilder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.time.LocalDate;
import java.util.List;
/**
* 5. - , 31 ()
*
* <p> , 31 </p>
* <p> = + 146</p>
*/
@Slf4j
@Component
public class ProductLevyOver31OmChecker extends AbstractComparisonOmChecker {
public ProductLevyOver31OmChecker(CarFfnlgTrgtIncmpMapper carFfnlgTrgtIncmpMapper,
ExternalVehicleApiService apiService,
VmisCarBassMatterInqireLogService bassMatterLogService,
VmisCarLedgerFrmbkLogService ledgerLogService) {
super(carFfnlgTrgtIncmpMapper, apiService, bassMatterLogService, ledgerLogService);
}
@Override
public String check(CarFfnlgTrgtIncmpVO existingData) {
String vhclno = existingData.getVhclno();
String levyCrtrYmd = existingData.getLevyCrtrYmd(); // 미필: 검사유효기간 종료일 + 146일
String inspVldPrd = existingData.getInspVldPrd(); // 검사유효기간
// 검사유효기간에서 시작일과 종료일 추출
String inspVldPrdStart = null;
String inspVldPrdEnd = null;
if (inspVldPrd != null && inspVldPrd.contains("~")) {
String[] dates = inspVldPrd.split("~");
inspVldPrdStart = dates[0].trim().replace("-", "");
inspVldPrdEnd = dates.length > 1 ? dates[1].trim().replace("-", "") : null;
}
try {
// ========== Step 1: 자동차기본정보 조회 (차량번호, 부과일자=검사유효기간 종료일+146일) ==========
log.info("[날짜수정후부과-명의이전 상품용-미필] Step 1: 자동차기본정보 조회 - 차량번호: {}, 부과일자: {}", vhclno, levyCrtrYmd);
NewBasicRequest step1Request = createBasicRequest(vhclno, null, levyCrtrYmd);
NewBasicResponse step1Response = apiService.getBasicInfo(step1Request);
bassMatterLogService.updateCarFfnlgTrgtIdByTxIdNewTx(step1Response, existingData.getCarFfnlgTrgtIncmpId());
if (step1Response == null || step1Response.getRecord() == null || step1Response.getRecord().isEmpty()) {
log.warn("[날짜수정후부과-명의이전 상품용-미필] Step 1 응답 없음 - 차량번호: {}", vhclno);
return null;
}
NewBasicResponse.Record step1Record = step1Response.getRecord().get(0);
String vin = step1Record.getVin(); // 차대번호
String step1OwnerName = step1Record.getRprsOwnrNm(); // 부과일자 기준 소유자명
log.info("[날짜수정후부과-명의이전 상품용-미필] Step 1 결과 - 차대번호: {}, 소유자명: {}", vin, step1OwnerName);
// 조건 1: 소유자명에 "상품용" 포함 여부 확인
if (step1OwnerName == null || step1OwnerName.contains("상품용")) {
log.debug("[날짜수정후부과-명의이전 상품용-미필] 소유자명에 '상품용' 미포함 - 차량번호: {}, 소유자명: {}", vhclno, step1OwnerName);
return null;
}
log.info("[날짜수정후부과-명의이전 상품용-미필] 소유자명에 '상품용' 포함 확인! - 차량번호: {}, 소유자명: {}", vhclno, step1OwnerName);
// ========== Step 2: 자동차기본정보 조회 (차대번호, 부과일자=오늘일자) ==========
String today = LocalDate.now().format(DATE_FORMATTER);
log.info("[날짜수정후부과-명의이전 상품용-미필] Step 2: 자동차기본정보 조회 - 차대번호: {}, 오늘일자: {}", vin, today);
NewBasicRequest step2Request = createBasicRequest(null, vin, today);
NewBasicResponse step2Response = apiService.getBasicInfo(step2Request);
bassMatterLogService.updateCarFfnlgTrgtIdByTxIdNewTx(step2Response, existingData.getCarFfnlgTrgtIncmpId());
if (step2Response == null || step2Response.getRecord() == null || step2Response.getRecord().isEmpty()) {
log.warn("[날짜수정후부과-명의이전 상품용-미필] Step 2 응답 없음 - 차대번호: {}", vin);
return null;
}
NewBasicResponse.Record step2Record = step2Response.getRecord().get(0);
String currentVhclno = step2Record.getVhrno();
String currentOwnerName = step2Record.getRprsOwnrNm();
String currentIdecno = step2Record.getRprsvOwnrIdecno();
String currentLegalDongCode = step2Record.getUsgsrhldStdgCd();
log.info("[날짜수정후부과-명의이전 상품용-미필] Step 2 결과 - 차량번호: {}, 성명: {}, 주민번호: {}, 법정동코드: {}",
currentVhclno, currentOwnerName, currentIdecno, currentLegalDongCode);
// ========== Step 3: 자동차등록원부(갑) 조회 ==========
log.info("[날짜수정후부과-명의이전 상품용-미필] Step 3: 자동차등록원부(갑) 조회 - 차량번호: {}, 성명: {}, 주민번호: {}, 법정동코드: {}",
currentVhclno, currentOwnerName, currentIdecno, currentLegalDongCode);
NewLedgerRequest step3Request = createLedgerRequest(currentVhclno, currentOwnerName, currentIdecno, currentLegalDongCode);
NewLedgerResponse step3Response = apiService.getLedgerInfo(step3Request);
ledgerLogService.updateCarFfnlgTrgtIdByTxIdNewTx(step3Response, existingData.getCarFfnlgTrgtIncmpId());
if (step3Response == null) {
log.warn("[날짜수정후부과-명의이전 상품용-미필] Step 3 응답 없음 - 차량번호: {}", currentVhclno);
return null;
}
List<NewLedgerResponse.Record> ledgerRecords = step3Response.getRecord();
if (ledgerRecords == null || ledgerRecords.isEmpty()) {
log.debug("[날짜수정후부과-명의이전 상품용-미필] 갑부 상세 내역 없음 - 차량번호: {}", vhclno);
return null;
}
// ========== 갑부 상세에서 조건에 맞는 레코드 찾기 ==========
log.info("[날짜수정후부과-명의이전 상품용-미필] 갑부 상세 레코드 검색 시작 - 부과일자: {}, 검사유효기간 종료일: {}", levyCrtrYmd, inspVldPrdEnd);
NewLedgerResponse.Record targetRecord = null;
LocalDate latestChgDate = null;
LocalDate levyDate = DateUtil.parseDate(levyCrtrYmd);
for (NewLedgerResponse.Record record : ledgerRecords) {
String chgYmd = record.getChgYmd();
String chgTaskSeCd = record.getChgTaskSeCd();
// 조건: CHG_TASK_SE_CD == "11" (명의이전)
if (!"11".equals(chgTaskSeCd) || chgYmd == null) {
continue;
}
LocalDate chgDate = DateUtil.parseDate(chgYmd);
if (chgDate == null) {
continue;
}
// 조건: CHG_YMD <= 부과일자
if (chgDate.isAfter(levyDate)) {
log.debug("[날짜수정후부과-명의이전 상품용-미필] CHG_YMD > 부과일자 - 변경일자: {}, 부과일자: {}", chgYmd, levyCrtrYmd);
continue;
}
// 가장 마지막 일자 찾기
if (latestChgDate == null || chgDate.isAfter(latestChgDate)) {
latestChgDate = chgDate;
targetRecord = record;
log.debug("[날짜수정후부과-명의이전 상품용-미필] 조건 충족 레코드 발견 - 변경일자: {}, 변경업무: {}", chgYmd, chgTaskSeCd);
}
}
if (targetRecord == null) {
log.debug("[날짜수정후부과-명의이전 상품용-미필] 조건에 맞는 명의이전 레코드 없음 - 차량번호: {}", vhclno);
return null;
}
// 조건: 가장 마지막 명의이전일자가 부과일자의 기준일수 초과인지 확인
long daysBetween = java.time.temporal.ChronoUnit.DAYS.between(latestChgDate, levyDate);
if (daysBetween <= DAYS_THRESHOLD) {
log.debug("[날짜수정후부과-명의이전 상품용-미필] 명의이전일자가 부과일자의 {}일 이내임 - 변경일자: {}, 부과일자: {}, 일수차이: {}일",
DAYS_THRESHOLD, targetRecord.getChgYmd(), levyCrtrYmd, daysBetween);
return null;
}
log.info("[날짜수정후부과-명의이전 상품용-미필] 명의이전일자가 부과일자의 {}일 초과 확인 - 변경일자: {}, 부과일자: {}, 일수차이: {}일",
DAYS_THRESHOLD, targetRecord.getChgYmd(), levyCrtrYmd, daysBetween);
String targetChgYmd = targetRecord.getChgYmd();
log.info("[날짜수정후부과-미필] 조건 충족 레코드 선택! 변경일자: {}, 변경업무: {}", targetChgYmd, targetRecord.getChgTaskSeNm());
// ========== Step 4: 자동차기본정보 조회 (차대번호, 부과일자=CHG_YMD -1일) ==========
LocalDate targetDate = DateUtil.parseDate(targetChgYmd);
String targetChgYmdMinus1 = targetDate.minusDays(1).format(DATE_FORMATTER);
log.info("[날짜수정후부과-명의이전 상품용-미필] Step 4: 자동차기본정보 조회 - 차대번호: {}, 부과일자: {} (원본: {})", vin, targetChgYmdMinus1, targetChgYmd);
NewBasicRequest step4Request = createBasicRequest(null, vin, targetChgYmdMinus1);
NewBasicResponse step4Response = apiService.getBasicInfo(step4Request);
bassMatterLogService.updateCarFfnlgTrgtIdByTxIdNewTx(step4Response, existingData.getCarFfnlgTrgtIncmpId());
if (step4Response == null || step4Response.getRecord() == null || step4Response.getRecord().isEmpty()) {
log.warn("[날짜수정후부과-명의이전 상품용-미필] Step 4 응답 없음 - 차대번호: {}, 부과일자: {}", vin, targetChgYmdMinus1);
return null;
}
NewBasicResponse.Record step4Record = step4Response.getRecord().get(0);
String step4OwnerName = step4Record.getRprsOwnrNm(); // CHG_YMD 시점의 소유자명
log.info("[날짜수정후부과-명의이전 상품용-미필] Step 4 결과 - 소유자명: {}", step4OwnerName);
// ========== 소유자명 비교 - 상품용 포함 여부 확인 ==========
if (step4OwnerName == null || !step4OwnerName.contains("상품용")) {
log.debug("[날짜수정후부과-명의이전 상품용-미필] 소유자명에 '상품용' 미포함 - Step4 소유자명: {}", step4OwnerName);
return null;
}
log.info("[날짜수정후부과-명의이전 상품용-미필] 명의이전 시점 소유자명에 '상품용' 확인! - 소유자명: {}", step4OwnerName);
log.info("[날짜수정후부과-명의이전 상품용-미필] 모든 조건 충족! 차량번호: {}, 변경일자: {}", vhclno, targetChgYmd);
// ========== 비고 생성 ==========
String rmrk = ComparisonOmRemarkBuilder.buildProductCloseLevyRemark(
step1Record, step4Record, targetRecord,
vhclno, levyCrtrYmd, inspVldPrdStart, inspVldPrdEnd, daysBetween
);
// ========== DB 업데이트 ==========
existingData.setCarBassMatterInqireId(step1Response.getGeneratedId());
existingData.setCarLedgerFrmbkId(step3Response.getGeneratedId());
existingData.setTaskPrcsSttsCd(TaskPrcsSttsConstants.TASK_PRCS_STTS_CD_05_DATE_MODIFIED_LEVY);
existingData.setTaskPrcsYmd(LocalDate.now().format(DATE_FORMATTER));
existingData.setCarBscMttrInqFlnm(step4OwnerName);
existingData.setCarRegFrmbkChgTaskSeCd(targetRecord.getChgTaskSeCd());
existingData.setCarRegFrmbkChgTaskSeNm(targetRecord.getChgTaskSeNm());
existingData.setCarRegFrmbkChgYmd(targetRecord.getChgYmd().replace("-", ""));
existingData.setCarRegFrmbkDtl(ComparisonOmRemarkBuilder.buildLedgerRecordDetail(targetRecord));
existingData.setRmrk(rmrk);
int updateCount = carFfnlgTrgtIncmpMapper.update(existingData);
if (updateCount == 0) {
throw new MessageException(String.format("[날짜수정후부과-명의이전 상품용-미필] 업데이트 실패: %s", vhclno));
}
log.info("[날짜수정후부과-명의이전 상품용-미필] 처리 완료! 차량번호: {}", vhclno);
return TaskPrcsSttsConstants.TASK_PRCS_STTS_CD_05_DATE_MODIFIED_LEVY;
} catch (Exception e) {
log.error("[날짜수정후부과-명의이전 상품용-미필] 검증 중 오류 발생 - 차량번호: {}", vhclno, e);
throw new MessageException(String.format("[날짜수정후부과-명의이전 상품용-미필] 검증 중 오류 발생 - 차량번호: %s", vhclno), e);
}
}
}

@ -1,229 +0,0 @@
package go.kr.project.carInspectionPenalty.registrationOm.service.impl.om_checker;
import egovframework.constant.TaskPrcsSttsConstants;
import egovframework.exception.MessageException;
import egovframework.util.DateUtil;
import go.kr.project.api.model.request.NewBasicRequest;
import go.kr.project.api.model.request.NewLedgerRequest;
import go.kr.project.api.model.response.NewBasicResponse;
import go.kr.project.api.model.response.NewLedgerResponse;
import go.kr.project.api.service.ExternalVehicleApiService;
import go.kr.project.api.service.VmisCarBassMatterInqireLogService;
import go.kr.project.api.service.VmisCarLedgerFrmbkLogService;
import go.kr.project.carInspectionPenalty.registrationOm.mapper.CarFfnlgTrgtIncmpMapper;
import go.kr.project.carInspectionPenalty.registrationOm.model.CarFfnlgTrgtIncmpVO;
import go.kr.project.carInspectionPenalty.registrationOm.service.impl.ComparisonOmRemarkBuilder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.time.LocalDate;
import java.util.List;
/**
* 2. - ()
*
* <p>api-1..contains("상품용")</p>
* <p> = + 146</p>
*/
@Slf4j
@Component
public class ProductUseOmChangeChecker extends AbstractComparisonOmChecker {
public ProductUseOmChangeChecker(CarFfnlgTrgtIncmpMapper carFfnlgTrgtIncmpMapper,
ExternalVehicleApiService apiService,
VmisCarBassMatterInqireLogService bassMatterLogService,
VmisCarLedgerFrmbkLogService ledgerLogService) {
super(carFfnlgTrgtIncmpMapper, apiService, bassMatterLogService, ledgerLogService);
}
@Override
public String check(CarFfnlgTrgtIncmpVO existingData) {
String vhclno = existingData.getVhclno();
String levyCrtrYmd = existingData.getLevyCrtrYmd(); // 미필: 검사유효기간 종료일 + 146일
String inspVldPrd = existingData.getInspVldPrd(); // 검사유효기간
// 검사유효기간에서 시작일과 종료일 추출
String inspVldPrdStart = null;
String inspVldPrdEnd = null;
if (inspVldPrd != null && inspVldPrd.contains("~")) {
String[] dates = inspVldPrd.split("~");
inspVldPrdStart = dates[0].trim().replace("-", "");
inspVldPrdEnd = dates.length > 1 ? dates[1].trim().replace("-", "") : null;
}
try {
// ========== Step 1: 자동차기본정보 조회 (차량번호, 부과일자=검사유효기간 종료일+146일) ==========
log.info("[상품용-변경등록-미필] Step 1: 자동차기본정보 조회 - 차량번호: {}, 부과일자: {}", vhclno, levyCrtrYmd);
NewBasicRequest step1Request = createBasicRequest(vhclno, null, levyCrtrYmd);
NewBasicResponse step1Response = apiService.getBasicInfo(step1Request);
bassMatterLogService.updateCarFfnlgTrgtIdByTxIdNewTx(step1Response, existingData.getCarFfnlgTrgtIncmpId());
if (step1Response == null || step1Response.getRecord() == null || step1Response.getRecord().isEmpty()) {
log.warn("[상품용-변경등록-미필] Step 1 응답 없음 - 차량번호: {}", vhclno);
return null;
}
NewBasicResponse.Record step1Record = step1Response.getRecord().get(0);
String vin = step1Record.getVin(); // 차대번호
String step1OwnerName = step1Record.getRprsOwnrNm(); // 부과일자 기준 소유자명
String step1RprsvOwnrIdecno = step1Record.getRprsvOwnrIdecno(); // 부과일자 기준 대표소유자 회원번호
log.info("[상품용-변경등록-미필] Step 1 결과 - 차대번호: {}, 소유자명: {}", vin, step1OwnerName);
// 조건 1: 소유자명에 "상품용" 포함 여부 확인
if (step1OwnerName == null || !step1OwnerName.contains("상품용")) {
log.debug("[상품용-변경등록-미필] 소유자명에 '상품용' 미포함 - 차량번호: {}, 소유자명: {}", vhclno, step1OwnerName);
return null;
}
log.info("[상품용-변경등록-미필] 소유자명에 '상품용' 포함 확인! - 차량번호: {}, 소유자명: {}", vhclno, step1OwnerName);
// ========== Step 2: 자동차기본정보 조회 (차대번호, 부과일자=오늘일자) ==========
String today = LocalDate.now().format(DATE_FORMATTER);
log.info("[상품용-변경등록-미필] Step 2: 자동차기본정보 조회 - 차대번호: {}, 오늘일자: {}", vin, today);
NewBasicRequest step2Request = createBasicRequest(null, vin, today);
NewBasicResponse step2Response = apiService.getBasicInfo(step2Request);
bassMatterLogService.updateCarFfnlgTrgtIdByTxIdNewTx(step2Response, existingData.getCarFfnlgTrgtIncmpId());
if (step2Response == null || step2Response.getRecord() == null || step2Response.getRecord().isEmpty()) {
log.warn("[상품용-변경등록-미필] Step 2 응답 없음 - 차대번호: {}", vin);
return null;
}
NewBasicResponse.Record step2Record = step2Response.getRecord().get(0);
String currentVhclno = step2Record.getVhrno();
String currentOwnerName = step2Record.getRprsOwnrNm();
String currentIdecno = step2Record.getRprsvOwnrIdecno();
String currentLegalDongCode = step2Record.getUsgsrhldStdgCd();
log.info("[상품용-변경등록-미필] Step 2 결과 - 차량번호: {}, 성명: {}, 주민번호: {}, 법정동코드: {}",
currentVhclno, currentOwnerName, currentIdecno, currentLegalDongCode);
// ========== Step 3: 자동차등록원부(갑) 조회 ==========
log.info("[상품용-변경등록-미필] Step 3: 자동차등록원부(갑) 조회 - 차량번호: {}, 성명: {}, 주민번호: {}, 법정동코드: {}",
currentVhclno, currentOwnerName, currentIdecno, currentLegalDongCode);
NewLedgerRequest step3Request = createLedgerRequest(currentVhclno, currentOwnerName, currentIdecno, currentLegalDongCode);
NewLedgerResponse step3Response = apiService.getLedgerInfo(step3Request);
ledgerLogService.updateCarFfnlgTrgtIdByTxIdNewTx(step3Response, existingData.getCarFfnlgTrgtIncmpId());
if (step3Response == null) {
log.warn("[상품용-변경등록-미필] Step 3 응답 없음 - 차량번호: {}", currentVhclno);
return null;
}
List<NewLedgerResponse.Record> ledgerRecords = step3Response.getRecord();
if (ledgerRecords == null || ledgerRecords.isEmpty()) {
log.debug("[상품용-변경등록-미필] 갑부 상세 내역 없음 - 차량번호: {}", vhclno);
return null;
}
// ========== 갑부 상세에서 조건에 맞는 레코드 찾기 ==========
log.info("[상품용-변경등록-미필] 갑부 상세 레코드 검색 시작 - 부과일자: {}, 검사유효기간 종료일: {}", levyCrtrYmd, inspVldPrdEnd);
NewLedgerResponse.Record targetRecord = null;
LocalDate latestChgDate = null;
for (NewLedgerResponse.Record record : ledgerRecords) {
String chgYmd = record.getChgYmd();
String chgTaskSeCd = record.getChgTaskSeCd();
// 조건: CHG_TASK_SE_CD == "21" (변경등록)
if (!"21".equals(chgTaskSeCd) || chgYmd == null) {
continue;
}
LocalDate chgDate = DateUtil.parseDate(chgYmd);
if (chgDate == null) {
continue;
}
// 조건: CHG_YMD <= 검사유효기간 종료일
LocalDate inspVldPrdEndDate = DateUtil.parseDate(inspVldPrdEnd);
if (chgDate.isAfter(inspVldPrdEndDate)) {
log.debug("[상품용-변경등록-미필] CHG_YMD > 검사유효기간 종료일 - 변경일자: {}, 검사유효기간 종료일: {}", chgYmd, inspVldPrdEnd);
continue;
}
String spcablMttr = record.getSpcablMttr();
if (!spcablMttr.contains("성명")) {
continue;
}
// 가장 마지막 일자 찾기
if (latestChgDate == null || chgDate.isAfter(latestChgDate)) {
latestChgDate = chgDate;
targetRecord = record;
log.debug("[상품용-변경등록-미필] 조건 충족 레코드 발견 - 변경일자: {}, 변경업무: {}", chgYmd, chgTaskSeCd);
}
}
if (targetRecord == null) {
log.debug("[상품용-변경등록-미필] 조건에 맞는 변경등록 레코드 없음 - 차량번호: {}", vhclno);
return null;
}
String targetChgYmd = targetRecord.getChgYmd();
log.info("[상품용-변경등록-미필] 조건 충족 레코드 선택! 변경일자: {}, 변경업무: {}", targetChgYmd, targetRecord.getChgTaskSeNm());
// ========== Step 4: 자동차기본정보 조회 (차대번호, 부과일자=CHG_YMD) ==========
log.info("[상품용-변경등록-미필] Step 4: 자동차기본정보 조회 - 차대번호: {}, 부과일자: {}", vin, targetChgYmd);
NewBasicRequest step4Request = createBasicRequest(null, vin, targetChgYmd.replace("-", ""));
NewBasicResponse step4Response = apiService.getBasicInfo(step4Request);
bassMatterLogService.updateCarFfnlgTrgtIdByTxIdNewTx(step4Response, existingData.getCarFfnlgTrgtIncmpId());
if (step4Response == null || step4Response.getRecord() == null || step4Response.getRecord().isEmpty()) {
log.warn("[상품용-변경등록-미필] Step 4 응답 없음 - 차대번호: {}, 부과일자: {}", vin, targetChgYmd);
return null;
}
NewBasicResponse.Record step4Record = step4Response.getRecord().get(0);
String step4OwnerName = step4Record.getRprsOwnrNm(); // CHG_YMD 시점의 소유자명
String step4RprsvOwnrIdecno = step4Record.getRprsvOwnrIdecno(); // 대표소유자 회원번호
log.info("[상품용-변경등록-미필] Step 4 결과 - 소유자명: {}", step4OwnerName);
// ========== 소유자 회원번호 비교 ==========
if (step4OwnerName == null || !step4RprsvOwnrIdecno.equals(step1RprsvOwnrIdecno)) {
log.debug("[상품용-변경등록-미필] 소유자 불일치 - Step1 소유자: {}, Step4 소유자: {}", step1RprsvOwnrIdecno, step4RprsvOwnrIdecno);
return null;
}
log.info("[상품용-변경등록-미필] 소유자 일치 확인! - 소유자명: {}", step1OwnerName);
log.info("[상품용-변경등록-미필] 모든 조건 충족! 차량번호: {}, 변경일자: {}", vhclno, targetChgYmd);
// ========== 비고 생성 ==========
String rmrk = ComparisonOmRemarkBuilder.buildProductUseChangeRemark(
step1Record, step4Record, targetRecord,
inspVldPrdEnd, levyCrtrYmd
);
// ========== DB 업데이트 ==========
existingData.setCarBassMatterInqireId(step1Response.getGeneratedId());
existingData.setCarLedgerFrmbkId(step3Response.getGeneratedId());
existingData.setTaskPrcsSttsCd(TaskPrcsSttsConstants.TASK_PRCS_STTS_CD_02_PRODUCT_USE);
existingData.setTaskPrcsYmd(LocalDate.now().format(DATE_FORMATTER));
existingData.setCarBscMttrInqFlnm(step4OwnerName);
existingData.setCarRegFrmbkChgTaskSeCd(targetRecord.getChgTaskSeCd());
existingData.setCarRegFrmbkChgTaskSeNm(targetRecord.getChgTaskSeNm());
existingData.setCarRegFrmbkChgYmd(targetRecord.getChgYmd().replace("-", ""));
existingData.setCarRegFrmbkDtl(ComparisonOmRemarkBuilder.buildLedgerRecordDetail(targetRecord));
existingData.setRmrk(rmrk);
int updateCount = carFfnlgTrgtIncmpMapper.update(existingData);
if (updateCount == 0) {
throw new MessageException(String.format("[상품용-변경등록-미필] 업데이트 실패: %s", vhclno));
}
log.info("[상품용-변경등록-미필] 처리 완료! 차량번호: {}", vhclno);
return TaskPrcsSttsConstants.TASK_PRCS_STTS_CD_02_PRODUCT_USE;
} catch (Exception e) {
log.error("[상품용-변경등록-미필] 검증 중 오류 발생 - 차량번호: {}", vhclno, e);
throw new MessageException(String.format("[상품용-변경등록-미필] 검증 중 오류 발생 - 차량번호: %s", vhclno), e);
}
}
}
Loading…
Cancel
Save