|
|
|
|
@ -899,6 +899,7 @@ public class CarFfnlgTrgtServiceImpl extends EgovAbstractServiceImpl implements
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 선택된 목록에 대해 API 호출 및 기본정보/등록원부 비교
|
|
|
|
|
* 중요: 1건이라도 실패 시 전체 롤백 처리됨
|
|
|
|
|
*
|
|
|
|
|
* @param targetList 선택된 과태료 대상 목록
|
|
|
|
|
* @return 비교 결과
|
|
|
|
|
@ -915,7 +916,6 @@ public class CarFfnlgTrgtServiceImpl extends EgovAbstractServiceImpl implements
|
|
|
|
|
|
|
|
|
|
List<Map<String, Object>> compareResults = new ArrayList<>();
|
|
|
|
|
int successCount = 0;
|
|
|
|
|
int failCount = 0;
|
|
|
|
|
int productUseCount = 0; // 상품용 건수
|
|
|
|
|
int transferCount = 0; // 이첩 건수
|
|
|
|
|
int normalCount = 0; // 정상 처리 건수
|
|
|
|
|
@ -939,13 +939,18 @@ public class CarFfnlgTrgtServiceImpl extends EgovAbstractServiceImpl implements
|
|
|
|
|
existingData = mapper.selectOne(existingData);
|
|
|
|
|
|
|
|
|
|
if (existingData == null) {
|
|
|
|
|
compareResult.put("success", false);
|
|
|
|
|
compareResult.put("message", "기존 데이터를 찾을 수 없습니다.");
|
|
|
|
|
failCount++;
|
|
|
|
|
compareResults.add(compareResult);
|
|
|
|
|
continue;
|
|
|
|
|
String errorMsg = String.format("기존 데이터를 찾을 수 없습니다. 차량번호: %s", vhclno);
|
|
|
|
|
log.error(errorMsg);
|
|
|
|
|
throw new MessageException(errorMsg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 2. 처리상태 검증 - 접수상태(01)가 아닌 경우 API 호출 불가 (전체 롤백)
|
|
|
|
|
if (!TaskPrcsSttsConstants.TASK_PRCS_STTS_CD_01_RCPT.equals(existingData.getTaskPrcsSttsCd())) {
|
|
|
|
|
String errorMsg = String.format("접수 상태(01)인 데이터만 API 호출이 가능합니다. 차량번호: %s, 현재 상태: %s",
|
|
|
|
|
vhclno, existingData.getTaskPrcsSttsCd());
|
|
|
|
|
log.error(errorMsg);
|
|
|
|
|
throw new MessageException(errorMsg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 3. 비교 로직 실행
|
|
|
|
|
String statusCode = comparisonService.executeComparison(existingData);
|
|
|
|
|
@ -982,13 +987,9 @@ public class CarFfnlgTrgtServiceImpl extends EgovAbstractServiceImpl implements
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("데이터 비교 중 오류 발생 - 차량번호: {}", vhclno, e);
|
|
|
|
|
throw new MessageException(String.format("데이터 비교 중 오류 발생 - 차량번호: {}", vhclno), e);
|
|
|
|
|
/*
|
|
|
|
|
compareResult.put("success", false);
|
|
|
|
|
compareResult.put("message", "비교 중 오류: " + e.getMessage());
|
|
|
|
|
failCount++;
|
|
|
|
|
*/
|
|
|
|
|
log.error("데이터 비교 중 오류 발생 - 차량번호: {}, 전체 롤백 처리", vhclno, e);
|
|
|
|
|
// 예외 재발생하여 전체 롤백 처리
|
|
|
|
|
throw new MessageException(String.format("데이터 비교 중 오류 발생 - 차량번호: %s, 전체 롤백 처리되었습니다.", vhclno), e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
compareResults.add(compareResult);
|
|
|
|
|
@ -998,14 +999,14 @@ public class CarFfnlgTrgtServiceImpl extends EgovAbstractServiceImpl implements
|
|
|
|
|
resultData.put("compareResults", compareResults);
|
|
|
|
|
resultData.put("totalCount", targetList.size());
|
|
|
|
|
resultData.put("successCount", successCount);
|
|
|
|
|
resultData.put("failCount", failCount);
|
|
|
|
|
resultData.put("failCount", 0); // 1건이라도 실패하면 전체 롤백되므로 실패건수는 항상 0
|
|
|
|
|
resultData.put("productUseCount", productUseCount);
|
|
|
|
|
resultData.put("transferCount", transferCount);
|
|
|
|
|
resultData.put("normalCount", normalCount);
|
|
|
|
|
|
|
|
|
|
log.info("========== API 호출 및 비교 완료 ==========");
|
|
|
|
|
log.info("성공: {}건, 실패: {}건, 상품용: {}건, 이첩: {}건, 정상: {}건",
|
|
|
|
|
successCount, failCount, productUseCount, transferCount, normalCount);
|
|
|
|
|
log.info("성공: {}건, 상품용: {}건, 이첩: {}건, 정상: {}건",
|
|
|
|
|
successCount, productUseCount, transferCount, normalCount);
|
|
|
|
|
|
|
|
|
|
return resultData;
|
|
|
|
|
}
|
|
|
|
|
|