🔇 Ships API Log Control
This commit is contained in:
부모
c3dabd370c
커밋
5305f61a41
@ -61,6 +61,11 @@ public class MaritimeApiWebClientConfig {
|
||||
|
||||
return WebClient.builder()
|
||||
.baseUrl(maritimeApiUrl)
|
||||
.filter((request, next) -> {
|
||||
// [핵심] 여기서 최종 완성된 URI를 로그로 출력합니다.
|
||||
log.info(">>>> API Request: [{} {}]", request.method(), request.url());
|
||||
return next.exchange(request);
|
||||
})
|
||||
.defaultHeaders(headers -> headers.setBasicAuth(maritimeApiUsername, maritimeApiPassword))
|
||||
.codecs(configurer -> configurer
|
||||
.defaultCodecs()
|
||||
@ -93,6 +98,11 @@ public class MaritimeApiWebClientConfig {
|
||||
|
||||
return WebClient.builder()
|
||||
.baseUrl(maritimeServiceApiUrl)
|
||||
.filter((request, next) -> {
|
||||
// [핵심] 여기서 최종 완성된 URI를 로그로 출력합니다.
|
||||
log.info(">>>> API Request: [{} {}]", request.method(), request.url());
|
||||
return next.exchange(request);
|
||||
})
|
||||
.defaultHeaders(headers -> headers.setBasicAuth(maritimeApiUsername, maritimeApiPassword))
|
||||
.codecs(configurer -> configurer
|
||||
.defaultCodecs()
|
||||
|
||||
@ -61,7 +61,6 @@ public class EventDataReader extends BaseApiReader<EventDetailDto> {
|
||||
@Override
|
||||
protected void beforeFetch() {
|
||||
// 1. 기간내 기록된 Event List 조회 (API 요청)
|
||||
log.info("Event API 호출");
|
||||
EventResponse response = callEventApiWithBatch();
|
||||
// 2-1. Event List 에서 EventID List 추출
|
||||
// 2-2. Event List 에서 Map<EventId,Map<StartDate,EndDate>> 추출
|
||||
@ -99,9 +98,6 @@ public class EventDataReader extends BaseApiReader<EventDetailDto> {
|
||||
int currentBatchNumber = (currentBatchIndex / batchSize) + 1;
|
||||
int totalBatches = (int) Math.ceil((double) eventIds.size() / batchSize);
|
||||
|
||||
log.info("[{}] 배치 {}/{} 처리 중 (Event ID : {} 개)...",
|
||||
getReaderName(), currentBatchNumber, totalBatches, currentBatch.size());
|
||||
|
||||
try {
|
||||
// API 호출
|
||||
EventDetailResponse response = callEventDetailApiWithBatch(currentBatch.get(0));
|
||||
@ -192,15 +188,8 @@ public class EventDataReader extends BaseApiReader<EventDetailDto> {
|
||||
|
||||
private EventResponse callEventApiWithBatch() {
|
||||
Map<String, String> params = batchDateService.getDateRangeWithoutTimeParams(getApiKey());
|
||||
|
||||
String url = getApiPath();
|
||||
|
||||
log.info("[{}] Events API Date Range: {} → {}",
|
||||
getReaderName(),
|
||||
String.format("%s-%s-%s",params.get("fromYear"),params.get("fromMonth"),params.get("fromDay")),
|
||||
String.format("%s-%s-%s",params.get("toYear"),params.get("toMonth"),params.get("toDay"))
|
||||
);
|
||||
|
||||
return webClient.get()
|
||||
.uri(url, uriBuilder -> uriBuilder
|
||||
// 맵에서 파라미터 값을 동적으로 가져와 세팅
|
||||
|
||||
@ -96,15 +96,8 @@ public class PscApiReader extends BaseApiReader<PscInspectionDto> {
|
||||
private List<PscInspectionDto> callApiWithBatch() {
|
||||
|
||||
Map<String, String> params = batchDateService.getDateRangeWithoutTimeParams(getApiKey());
|
||||
|
||||
String url = getApiPath();
|
||||
|
||||
log.info("[{}] PSC API Date Range: {} → {}",
|
||||
getReaderName(),
|
||||
String.format("%s-%s-%s",params.get("fromYear"),params.get("fromMonth"),params.get("fromDay")),
|
||||
String.format("%s-%s-%s",params.get("toYear"),params.get("toMonth"),params.get("toDay"))
|
||||
);
|
||||
|
||||
String json = webClient.get()
|
||||
.uri(url, uriBuilder -> uriBuilder
|
||||
.queryParam("shipsCategory", params.get("shipsCategory"))
|
||||
|
||||
@ -139,7 +139,7 @@ public class PscAllCertificateRepositoryImpl extends BaseJdbcRepository<PscAllCe
|
||||
@Override
|
||||
public void saveAllCertificates(List<PscAllCertificateEntity> entities) {
|
||||
if (entities == null || entities.isEmpty()) return;
|
||||
log.info("PSC AllCertificates 저장 시작 = {}건", entities.size());
|
||||
// log.info("PSC AllCertificates 저장 시작 = {}건", entities.size());
|
||||
batchInsert(entities);
|
||||
}
|
||||
|
||||
|
||||
@ -132,7 +132,7 @@ public class PscCertificateRepositoryImpl extends BaseJdbcRepository<PscCertific
|
||||
@Override
|
||||
public void saveCertificates(List<PscCertificateEntity> entities) {
|
||||
if (entities == null || entities.isEmpty()) return;
|
||||
log.info("PSC Certificate 저장 시작 = {}건", entities.size());
|
||||
// log.info("PSC Certificate 저장 시작 = {}건", entities.size());
|
||||
batchInsert(entities);
|
||||
}
|
||||
|
||||
|
||||
@ -156,7 +156,7 @@ public class PscDefectRepositoryImpl extends BaseJdbcRepository<PscDefectEntity,
|
||||
@Override
|
||||
public void saveDefects(List<PscDefectEntity> entities) {
|
||||
if (entities == null || entities.isEmpty()) return;
|
||||
log.info("PSC Defect 저장 시작 = {}건", entities.size());
|
||||
// log.info("PSC Defect 저장 시작 = {}건", entities.size());
|
||||
batchInsert(entities);
|
||||
}
|
||||
|
||||
|
||||
@ -165,7 +165,7 @@ public class PscInspectionRepositoryImpl extends BaseJdbcRepository<PscInspectio
|
||||
@Override
|
||||
public void saveAll(List<PscInspectionEntity> entities) {
|
||||
if (entities == null || entities.isEmpty()) return;
|
||||
log.info("PSC Inspection 저장 시작 = {}건", entities.size());
|
||||
// log.info("PSC Inspection 저장 시작 = {}건", entities.size());
|
||||
batchInsert(entities);
|
||||
}
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ public class ShipDetailDataProcessor extends BaseProcessor<ShipDetailComparisonD
|
||||
|
||||
// 1. 해시 비교 (변경 감지)
|
||||
if (isChanged(previousHash, currentHash)) {
|
||||
log.info("선박 데이터 변경 감지: imoNumber={}", imo);
|
||||
//log.info("선박 데이터 변경 감지: imoNumber={}", imo);
|
||||
|
||||
// 2. 증분 데이터 추출 (Map 기반으로 업데이트 데이터 구성)
|
||||
// Core20
|
||||
|
||||
@ -222,8 +222,6 @@ public class ShipDetailUpdateDataReader extends BaseApiReader<ShipDetailComparis
|
||||
private ShipDetailApiResponse callApiWithBatch(String imoNumbers) {
|
||||
String url = getApiPath() + "?IMONumbers=" + imoNumbers;
|
||||
|
||||
log.info("[{}] API 호출: {}", getReaderName(), url);
|
||||
|
||||
return webClient.get()
|
||||
.uri(url)
|
||||
.retrieve()
|
||||
@ -253,12 +251,6 @@ public class ShipDetailUpdateDataReader extends BaseApiReader<ShipDetailComparis
|
||||
|
||||
String url = getShipUpdateApiPath();
|
||||
|
||||
log.info("[{}] Ship Detail Update Date Range: {} → {}",
|
||||
getReaderName(),
|
||||
String.format("%s-%s-%s",params.get("fromYear"),params.get("fromMonth"),params.get("fromDay")),
|
||||
String.format("%s-%s-%s",params.get("toYear"),params.get("toMonth"),params.get("toDay"))
|
||||
);
|
||||
|
||||
return webClient.get()
|
||||
.uri(url, uriBuilder -> uriBuilder
|
||||
// 맵에서 파라미터 값을 동적으로 가져와 세팅
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
package com.snp.batch.service;
|
||||
|
||||
import com.snp.batch.global.model.BatchLastExecution;
|
||||
import com.snp.batch.global.repository.BatchLastExecutionRepository;
|
||||
import jakarta.transaction.Transactional;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
불러오는 중...
Reference in New Issue
Block a user