명의이전 상품용 적용

main
박성영 2 weeks ago
parent c4e5f0419a
commit 8e13313d57

@ -64,7 +64,7 @@ Windows에서 Linux로 SCP를 이용하여 소스를 업로드합니다.
**Windows CMD에서 실행:**
```cmd
scp C:\VIPS\VIPS-BOOT.war xit@105.19.10.124:/app/VIPS
scp -P1922 c:\VIPS\VIPS-BOOT.war xit@105.19.10.124:/app/VIPS/
password: xit5811807
```

@ -52,25 +52,25 @@ public class ComparisonServiceImpl extends EgovAbstractServiceImpl implements Co
String vhclno = existingData.getVhclno();
log.info("========== 비교 로직 시작: {} ==========", vhclno);
// ========== 1. 이첩 체크 ==========
String transferResult = checkTransferCase115Day(existingData);
if (transferResult != null) {
log.info("========== 비교 로직 종료 (이첩): {} ==========", vhclno);
return transferResult;
}
// ========== 2. 상품용 체크 Case1 - api-1번호출.소유자명.contains("상품용") ==========
// ========== 1. 상품용 체크 Case1 - api-1번호출.소유자명.contains("상품용") ==========
String productUseResult1 = checkProductUseCase1(existingData);
if (productUseResult1 != null) {
log.info("========== 비교 로직 종료 (상품용-Case1): {} ==========", vhclno);
return productUseResult1;
}
// ========== 3. 상품용 체크 Case2 - 명의이전 후 상품용인 경우 ==========
String productUseResult2 = checkProductUseCase2(existingData);
if (productUseResult2 != null) {
log.info("========== 비교 로직 종료 (상품용-Case2): {} ==========", vhclno);
return productUseResult2;
// ========== 2. 내사종결 상품용 체크명의이전 후 상품용인 경우 ==========
String closeUseResult = checkCloseProductUse(existingData);
if (closeUseResult != null) {
log.info("========== 비교 로직 종료 (내사종결 : 상품용-Case2): {} ==========", vhclno);
return closeUseResult;
}
// ========== 3. 이첩 체크 ==========
String transferResult = checkTransferCase115Day(existingData);
if (transferResult != null) {
log.info("========== 비교 로직 종료 (이첩): {} ==========", vhclno);
return transferResult;
}
// ========== 4. 향후 추가될 비교 로직들 ==========
@ -88,7 +88,7 @@ public class ComparisonServiceImpl extends EgovAbstractServiceImpl implements Co
// 비교 로직 메서드들
// ========================================
/**
/** 4
* 1. api-1..contains("상품용")
*
* API 4:
@ -239,7 +239,7 @@ public class ComparisonServiceImpl extends EgovAbstractServiceImpl implements Co
// ========== Step 4: 자동차기본정보 조회 (차대번호, 부과일자=CHG_YMD) ==========
log.info("[상품용] Step 4: 자동차기본정보 조회 - 차대번호: {}, 부과일자: {}", vin, targetChgYmd);
NewBasicRequest step4Request = createBasicRequest(null, vin, targetChgYmd);
NewBasicRequest step4Request = createBasicRequest(null, vin, targetChgYmd.replace("-", ""));
NewBasicResponse step4Response = apiService.getBasicInfo(step4Request);
bassMatterLogService.updateCarFfnlgTrgtIdByTxIdNewTx(step4Response, existingData.getCarFfnlgTrgtId());
@ -287,7 +287,7 @@ public class ComparisonServiceImpl extends EgovAbstractServiceImpl implements Co
existingData.setTaskPrcsYmd(LocalDate.now().format(DATE_FORMATTER));
existingData.setCarRegFrmbkChgTaskSeCd(targetRecord.getChgTaskSeCd());
existingData.setCarRegFrmbkChgTaskSeNm(targetRecord.getChgTaskSeNm());
existingData.setCarRegFrmbkChgYmd(targetRecord.getChgYmd());
existingData.setCarRegFrmbkChgYmd(targetRecord.getChgYmd().replace("-", ""));
existingData.setCarRegFrmbkDtl(buildLedgerRecordDetail(targetRecord));
existingData.setRmrk(rmrk);
@ -306,27 +306,27 @@ public class ComparisonServiceImpl extends EgovAbstractServiceImpl implements Co
}
/**
* 2. not( api-1..contains("상품용") )
* 2. not( api-1..contains("상품용") )
*
* API 4:
* 1) (, =) ,
* 2) (, =) , , ,
* 3) ()(, , , ) List
* 4) (, = CHG_YMD)
* 4) (, = CHG_YMD - 1 day)
*
* :
* - 1: "상품용"
* - 2: ( 11)
* CHG_YMD <=
* CHG_YMD <=
* CHG_YMD
* CHG_TASK_SE_CD == "11" ()
* 30
* - 3: 4 API .contains("상품용")
*
* @param existingData
* @return 02 () null ()
* @return 04 () null ()
*/
private String checkProductUseCase2(CarFfnlgTrgtVO existingData) {
private String checkCloseProductUse(CarFfnlgTrgtVO existingData) {
String vhclno = existingData.getVhclno();
String inspYmd = existingData.getInspYmd();
String vldPrdExpryYmd = existingData.getVldPrdExpryYmd();
@ -334,14 +334,14 @@ public class ComparisonServiceImpl extends EgovAbstractServiceImpl implements Co
try {
// ========== Step 1: 자동차기본정보 조회 (차량번호, 부과일자=검사일) ==========
log.info("[상품용] Step 1: 자동차기본정보 조회 - 차량번호: {}, 검사일: {}", vhclno, inspYmd);
log.info("[내사종결] Step 1: 자동차기본정보 조회 - 차량번호: {}, 검사일: {}", vhclno, inspYmd);
NewBasicRequest step1Request = createBasicRequest(vhclno, null, inspYmd);
NewBasicResponse step1Response = apiService.getBasicInfo(step1Request);
bassMatterLogService.updateCarFfnlgTrgtIdByTxIdNewTx(step1Response, existingData.getCarFfnlgTrgtId());
if (step1Response == null || step1Response.getRecord() == null || step1Response.getRecord().isEmpty()) {
log.warn("[상품용] Step 1 응답 없음 - 차량번호: {}", vhclno);
log.warn("[내사종결] Step 1 응답 없음 - 차량번호: {}", vhclno);
return null;
}
@ -349,26 +349,26 @@ public class ComparisonServiceImpl extends EgovAbstractServiceImpl implements Co
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);
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.getCarFfnlgTrgtId());
if (step2Response == null || step2Response.getRecord() == null || step2Response.getRecord().isEmpty()) {
log.warn("[상품용] Step 2 응답 없음 - 차대번호: {}", vin);
log.warn("[내사종결] Step 2 응답 없음 - 차대번호: {}", vin);
return null;
}
@ -378,11 +378,11 @@ public class ComparisonServiceImpl extends EgovAbstractServiceImpl implements Co
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);
@ -390,18 +390,18 @@ public class ComparisonServiceImpl extends EgovAbstractServiceImpl implements Co
ledgerLogService.updateCarFfnlgTrgtIdByTxIdNewTx(step3Response, existingData.getCarFfnlgTrgtId());
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("[상품용] 갑부 상세 레코드 검색 시작 - 검사일: {}, 검사종료일자: {}", inspYmd, inspEndYmd);
log.info("[내사종결] 갑부 상세 레코드 검색 시작 - 검사일: {}, 검사종료일자: {}", inspYmd, inspEndYmd);
NewLedgerResponse.Record targetRecord = null;
LocalDate latestChgDate = null;
@ -421,10 +421,10 @@ public class ComparisonServiceImpl extends EgovAbstractServiceImpl implements Co
continue;
}
// 조건: CHG_YMD <= 검사종료일자
LocalDate inspEndDate = DateUtil.parseDate(inspEndYmd);
// 조건: CHG_YMD <= 검사일자
LocalDate inspEndDate = DateUtil.parseDate(inspYmd);
if (chgDate.isAfter(inspEndDate)) {
log.debug("[상품용] CHG_YMD > 검사종료일자 - 변경일자: {}, 검사종료일자: {}", chgYmd, inspEndYmd);
log.debug("[내사종결] CHG_YMD > 검사종료일자 - 변경일자: {}, 검사종료일자: {}", chgYmd, inspEndYmd);
continue;
}
@ -432,57 +432,59 @@ public class ComparisonServiceImpl extends EgovAbstractServiceImpl implements Co
if (latestChgDate == null || chgDate.isAfter(latestChgDate)) {
latestChgDate = chgDate;
targetRecord = record;
log.debug("[상품용] 조건 충족 레코드 발견 - 변경일자: {}, 변경업무: {}", chgYmd, chgTaskSeCd);
log.debug("[내사종결] 조건 충족 레코드 발견 - 변경일자: {}, 변경업무: {}", chgYmd, chgTaskSeCd);
}
}
if (targetRecord == null) {
log.debug("[상품용] 조건에 맞는 명의이전 레코드 없음 - 차량번호: {}", vhclno);
log.debug("[내사종결] 조건에 맞는 명의이전 레코드 없음 - 차량번호: {}", vhclno);
return null;
}
// 조건: 가장 마지막 명의이전일자가 검사일의 30일 이내인지 확인
long daysBetween = java.time.temporal.ChronoUnit.DAYS.between(latestChgDate, inspDate);
if (daysBetween < 0 || daysBetween > 30) {
log.debug("[상품용] 명의이전일자가 검사일의 30일 이내가 아님 - 변경일자: {}, 검사일: {}, 일수차이: {}일",
log.debug("[내사종결] 명의이전일자가 검사일의 30일 이내가 아님 - 변경일자: {}, 검사일: {}, 일수차이: {}일",
targetRecord.getChgYmd(), inspYmd, daysBetween);
return null;
}
log.info("[상품용] 명의이전일자가 검사일의 30일 이내 확인 - 변경일자: {}, 검사일: {}, 일수차이: {}일",
log.info("[내사종결] 명의이전일자가 검사일의 30일 이내 확인 - 변경일자: {}, 검사일: {}, 일수차이: {}일",
targetRecord.getChgYmd(), inspYmd, daysBetween);
String targetChgYmd = targetRecord.getChgYmd();
log.info("[상품용] 조건 충족 레코드 선택! 변경일자: {}, 변경업무: {}", targetChgYmd, targetRecord.getChgTaskSeNm());
log.info("[내사종결] 조건 충족 레코드 선택! 변경일자: {}, 변경업무: {}", targetChgYmd, targetRecord.getChgTaskSeNm());
// ========== Step 4: 자동차기본정보 조회 (차대번호, 부과일자=CHG_YMD) ==========
log.info("[상품용] Step 4: 자동차기본정보 조회 - 차대번호: {}, 부과일자: {}", vin, targetChgYmd);
// ========== 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, targetChgYmd);
NewBasicRequest step4Request = createBasicRequest(null, vin, targetChgYmdMinus1);
NewBasicResponse step4Response = apiService.getBasicInfo(step4Request);
bassMatterLogService.updateCarFfnlgTrgtIdByTxIdNewTx(step4Response, existingData.getCarFfnlgTrgtId());
if (step4Response == null || step4Response.getRecord() == null || step4Response.getRecord().isEmpty()) {
log.warn("[상품용] Step 4 응답 없음 - 차대번호: {}, 부과일자: {}", vin, targetChgYmd);
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);
log.info("[내사종결] Step 4 결과 - 소유자명: {}", step4OwnerName);
// ========== 소유자명 비교 - 상품용 포함 여부 확인 ==========
if (step4OwnerName == null || !step4OwnerName.contains("상품용")) {
log.debug("[상품용] 소유자명에 '상품용' 미포함 - Step4 소유자명: {}", step4OwnerName);
log.debug("[내사종결] 소유자명에 '상품용' 미포함 - Step4 소유자명: {}", step4OwnerName);
return null;
}
log.info("[상품용] 명의이전 시점 소유자명에 '상품용' 확인! - 소유자명: {}", step4OwnerName);
log.info("[내사종결] 명의이전 시점 소유자명에 '상품용' 확인! - 소유자명: {}", step4OwnerName);
log.info("[상품용] 모든 조건 충족! 차량번호: {}, 변경일자: {}", vhclno, targetChgYmd);
log.info("[내사종결] 모든 조건 충족! 차량번호: {}, 변경일자: {}", vhclno, targetChgYmd);
// ========== 비고 생성 ==========
String rmrk = buildProductUseRemarkCase2(
String rmrk = buildCloseProductUseRemark(
step1Record, step4Record, targetRecord,
vhclno, inspYmd, vldPrdExpryYmd, inspEndYmd
);
@ -490,25 +492,25 @@ public class ComparisonServiceImpl extends EgovAbstractServiceImpl implements Co
// ========== DB 업데이트 ==========
existingData.setCarBassMatterInqireId(step1Response.getGeneratedId());
existingData.setCarLedgerFrmbkId(step3Response.getGeneratedId());
existingData.setTaskPrcsSttsCd(TaskPrcsSttsConstants.TASK_PRCS_STTS_CD_02_PRODUCT_USE);
existingData.setTaskPrcsSttsCd(TaskPrcsSttsConstants.TASK_PRCS_STTS_CD_04_INVESTIGATION_CLOSED);
existingData.setTaskPrcsYmd(LocalDate.now().format(DATE_FORMATTER));
existingData.setCarRegFrmbkChgTaskSeCd(targetRecord.getChgTaskSeCd());
existingData.setCarRegFrmbkChgTaskSeNm(targetRecord.getChgTaskSeNm());
existingData.setCarRegFrmbkChgYmd(targetRecord.getChgYmd());
existingData.setCarRegFrmbkChgYmd(targetRecord.getChgYmd().replace("-", ""));
existingData.setCarRegFrmbkDtl(buildLedgerRecordDetail(targetRecord));
existingData.setRmrk(rmrk);
int updateCount = carFfnlgTrgtMapper.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_02_PRODUCT_USE;
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);
log.error("[내사종결] 검증 중 오류 발생 - 차량번호: {}", vhclno, e);
throw new MessageException(String.format("[내사종결] 검증 중 오류 발생 - 차량번호: %s", vhclno), e);
}
}
@ -615,10 +617,10 @@ public class ComparisonServiceImpl extends EgovAbstractServiceImpl implements Co
// 비고 생성
String rmrk;
if ("이첩-1".equals(transferType)) {
if ("이첩-1".equals(transferType)) { // 5번
rmrk = String.format("%s, 검사일사용본거지, [검사대상, 사용자 조직코드 앞 4자리: %s, 법정동명: %s]",
sggNm, userOrg4, sggNm);
} else {
} else { // 7번
rmrk = String.format("%s, 115일 도래지, [법정동코드: %s, 법정동명: %s]",
sggNm, legalDong4, sggNm);
}
@ -728,8 +730,9 @@ public class ComparisonServiceImpl extends EgovAbstractServiceImpl implements Co
String inspEndYmd) {
StringBuilder sb = new StringBuilder();
sb.append("상품용 [검사종료일 이전 명의이전]\n");
sb.append("상품용 - 상품용검사\n");
/*
// 1. 검사일 기준 소유자 정보
sb.append("\n■ 검사일 기준 소유자정보\n");
sb.append(" - 소유자명: ").append(nvl(step1Record.getRprsOwnrNm())).append("\n");
@ -747,7 +750,7 @@ public class ComparisonServiceImpl extends EgovAbstractServiceImpl implements Co
//sb.append(" - 변경업무명: ").append(nvl(ledgerRecord.getChgTaskSeNm())).append("\n");
//sb.append(" - 접수번호: ").append(nvl(ledgerRecord.getAplyRcptNo())).append("\n");
/*
// 4. 비교 기간
sb.append("\n■ 비교 기간\n");
sb.append(" - 유효기간만료일: ").append(DateUtil.formatDateString(vldPrdExpryYmd)).append("\n");
@ -778,7 +781,7 @@ public class ComparisonServiceImpl extends EgovAbstractServiceImpl implements Co
* @param inspEndYmd
* @return
*/
private String buildProductUseRemarkCase2(
private String buildCloseProductUseRemark(
NewBasicResponse.Record step1Record,
NewBasicResponse.Record step4Record,
NewLedgerResponse.Record ledgerRecord,

Loading…
Cancel
Save