|
|
|
|
@ -8,6 +8,8 @@ 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.registration.mapper.CarFfnlgTrgtMapper;
|
|
|
|
|
import go.kr.project.carInspectionPenalty.registration.model.CarFfnlgTrgtVO;
|
|
|
|
|
import go.kr.project.carInspectionPenalty.registration.service.ComparisonService;
|
|
|
|
|
@ -16,6 +18,8 @@ import lombok.RequiredArgsConstructor;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Propagation;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import java.time.LocalDate;
|
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
|
@ -34,6 +38,8 @@ public class ComparisonServiceImpl extends EgovAbstractServiceImpl implements Co
|
|
|
|
|
|
|
|
|
|
private final CarFfnlgTrgtMapper carFfnlgTrgtMapper;
|
|
|
|
|
private final ExternalVehicleApiService apiService;
|
|
|
|
|
private final VmisCarBassMatterInqireLogService bassMatterLogService;
|
|
|
|
|
private final VmisCarLedgerFrmbkLogService ledgerLogService;
|
|
|
|
|
|
|
|
|
|
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMdd");
|
|
|
|
|
|
|
|
|
|
@ -102,6 +108,9 @@ public class ComparisonServiceImpl extends EgovAbstractServiceImpl implements Co
|
|
|
|
|
NewBasicRequest step1Request = createBasicRequest(vhclno, null, inspYmd);
|
|
|
|
|
NewBasicResponse step1Response = apiService.getBasicInfo(step1Request);
|
|
|
|
|
|
|
|
|
|
// API 응답에 CAR_FFNLG_TRGT_ID 업데이트
|
|
|
|
|
bassMatterLogService.updateCarFfnlgTrgtIdByTxIdNewTx(step1Response, existingData.getCarFfnlgTrgtId());
|
|
|
|
|
|
|
|
|
|
if (step1Response == null || step1Response.getRecord() == null || step1Response.getRecord().isEmpty()) {
|
|
|
|
|
log.warn("[상품용] Step 1 응답 없음 - 차량번호: {}", vhclno);
|
|
|
|
|
return null;
|
|
|
|
|
@ -129,6 +138,9 @@ public class ComparisonServiceImpl extends EgovAbstractServiceImpl implements Co
|
|
|
|
|
NewBasicRequest step2Request = createBasicRequest(null, vin, today);
|
|
|
|
|
NewBasicResponse step2Response = apiService.getBasicInfo(step2Request);
|
|
|
|
|
|
|
|
|
|
// API 응답에 CAR_FFNLG_TRGT_ID 업데이트
|
|
|
|
|
bassMatterLogService.updateCarFfnlgTrgtIdByTxIdNewTx(step2Response, existingData.getCarFfnlgTrgtId());
|
|
|
|
|
|
|
|
|
|
if (step2Response == null || step2Response.getRecord() == null || step2Response.getRecord().isEmpty()) {
|
|
|
|
|
log.warn("[상품용] Step 2 응답 없음 - 차대번호: {}", vin);
|
|
|
|
|
return null;
|
|
|
|
|
@ -150,6 +162,9 @@ public class ComparisonServiceImpl extends EgovAbstractServiceImpl implements Co
|
|
|
|
|
NewLedgerRequest step3Request = createLedgerRequest(currentVhclno, currentOwnerName, currentIdecno, currentLegalDongCode);
|
|
|
|
|
NewLedgerResponse step3Response = apiService.getLedgerInfo(step3Request);
|
|
|
|
|
|
|
|
|
|
// API 응답에 CAR_FFNLG_TRGT_ID 업데이트
|
|
|
|
|
ledgerLogService.updateCarFfnlgTrgtIdByTxIdNewTx(step3Response, existingData.getCarFfnlgTrgtId());
|
|
|
|
|
|
|
|
|
|
if (step3Response == null) {
|
|
|
|
|
log.warn("[상품용] Step 3 응답 없음 - 차량번호: {}", currentVhclno);
|
|
|
|
|
return null;
|
|
|
|
|
@ -188,6 +203,10 @@ public class ComparisonServiceImpl extends EgovAbstractServiceImpl implements Co
|
|
|
|
|
// DB 업데이트
|
|
|
|
|
existingData.setTaskPrcsSttsCd(TaskPrcsSttsConstants.TASK_PRCS_STTS_CD_02_PRODUCT_USE);
|
|
|
|
|
existingData.setTaskPrcsYmd(LocalDate.now().format(DATE_FORMATTER));
|
|
|
|
|
existingData.setCarRegFrmbkChgTaskSeCd(record.getChgTaskSeCd());
|
|
|
|
|
existingData.setCarRegFrmbkChgTaskSeNm(record.getChgTaskSeNm());
|
|
|
|
|
existingData.setCarRegFrmbkChgYmd(record.getChgYmd());
|
|
|
|
|
existingData.setCarRegFrmbkDtl(buildLedgerRecordDetail(record));
|
|
|
|
|
existingData.setRmrk(rmrk);
|
|
|
|
|
|
|
|
|
|
int updateCount = carFfnlgTrgtMapper.update(existingData);
|
|
|
|
|
@ -262,6 +281,9 @@ public class ComparisonServiceImpl extends EgovAbstractServiceImpl implements Co
|
|
|
|
|
NewBasicRequest request = createBasicRequest(vhclno, null, levyCrtrYmd);
|
|
|
|
|
NewBasicResponse response = apiService.getBasicInfo(request);
|
|
|
|
|
|
|
|
|
|
// API 응답에 CAR_FFNLG_TRGT_ID 업데이트
|
|
|
|
|
bassMatterLogService.updateCarFfnlgTrgtIdByTxIdNewTx(response, existingData.getCarFfnlgTrgtId());
|
|
|
|
|
|
|
|
|
|
if (response == null || response.getRecord() == null || response.getRecord().isEmpty()) {
|
|
|
|
|
log.warn("[{}] 응답 없음 - 차량번호: {}", transferType, vhclno);
|
|
|
|
|
return null;
|
|
|
|
|
@ -513,4 +535,50 @@ public class ComparisonServiceImpl extends EgovAbstractServiceImpl implements Co
|
|
|
|
|
}
|
|
|
|
|
return date.substring(0, 4) + "-" + date.substring(4, 6) + "-" + date.substring(6, 8);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 등록원부 갑부 레코드 상세 정보 생성
|
|
|
|
|
*/
|
|
|
|
|
private String buildLedgerRecordDetail(NewLedgerResponse.Record record) {
|
|
|
|
|
if (record == null) {
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StringBuilder detail = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
// 변경 정보
|
|
|
|
|
appendIfNotEmpty(detail, "변경업무구분코드", record.getChgTaskSeCd());
|
|
|
|
|
appendIfNotEmpty(detail, "변경업무구분명", record.getChgTaskSeNm());
|
|
|
|
|
appendIfNotEmpty(detail, "변경일자", formatDateWithHyphen(record.getChgYmd()));
|
|
|
|
|
|
|
|
|
|
// 주요 정보
|
|
|
|
|
appendIfNotEmpty(detail, "주요번호", record.getMainNo());
|
|
|
|
|
appendIfNotEmpty(detail, "일련번호", record.getSno());
|
|
|
|
|
appendIfNotEmpty(detail, "특별사항", record.getSpcablMttr());
|
|
|
|
|
|
|
|
|
|
// 명의자 정보
|
|
|
|
|
appendIfNotEmpty(detail, "명의자명", record.getHshldrNm());
|
|
|
|
|
appendIfNotEmpty(detail, "명의자식별번호", maskIdecno(record.getHshldrIdecno()));
|
|
|
|
|
|
|
|
|
|
// 기타
|
|
|
|
|
appendIfNotEmpty(detail, "신청접수번호", record.getAplyRcptNo());
|
|
|
|
|
appendIfNotEmpty(detail, "차량관리번호", record.getVhmno());
|
|
|
|
|
appendIfNotEmpty(detail, "원부그룹번호", record.getLedgerGroupNo());
|
|
|
|
|
appendIfNotEmpty(detail, "원부개별번호", record.getLedgerIndivNo());
|
|
|
|
|
appendIfNotEmpty(detail, "상세일련번호", record.getDtlSn());
|
|
|
|
|
|
|
|
|
|
return detail.toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 문자열 추가 헬퍼 (값이 있을 때만)
|
|
|
|
|
*/
|
|
|
|
|
private void appendIfNotEmpty(StringBuilder sb, String label, String value) {
|
|
|
|
|
if (value != null && !value.isEmpty()) {
|
|
|
|
|
if (sb.length() > 0) {
|
|
|
|
|
sb.append(", ");
|
|
|
|
|
}
|
|
|
|
|
sb.append(label).append(": ").append(value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|