diff --git a/gukyuin/label-send/.gradle/8.14/executionHistory/executionHistory.bin b/gukyuin/label-send/.gradle/8.14/executionHistory/executionHistory.bin index 24d649c..28d4c16 100644 Binary files a/gukyuin/label-send/.gradle/8.14/executionHistory/executionHistory.bin and b/gukyuin/label-send/.gradle/8.14/executionHistory/executionHistory.bin differ diff --git a/gukyuin/label-send/.gradle/8.14/executionHistory/executionHistory.lock b/gukyuin/label-send/.gradle/8.14/executionHistory/executionHistory.lock index 2124b74..aed6d30 100644 Binary files a/gukyuin/label-send/.gradle/8.14/executionHistory/executionHistory.lock and b/gukyuin/label-send/.gradle/8.14/executionHistory/executionHistory.lock differ diff --git a/gukyuin/label-send/.gradle/8.14/fileHashes/fileHashes.bin b/gukyuin/label-send/.gradle/8.14/fileHashes/fileHashes.bin index c2fb07f..257fba7 100644 Binary files a/gukyuin/label-send/.gradle/8.14/fileHashes/fileHashes.bin and b/gukyuin/label-send/.gradle/8.14/fileHashes/fileHashes.bin differ diff --git a/gukyuin/label-send/.gradle/8.14/fileHashes/fileHashes.lock b/gukyuin/label-send/.gradle/8.14/fileHashes/fileHashes.lock index 9724918..5e4864f 100644 Binary files a/gukyuin/label-send/.gradle/8.14/fileHashes/fileHashes.lock and b/gukyuin/label-send/.gradle/8.14/fileHashes/fileHashes.lock differ diff --git a/gukyuin/label-send/.gradle/8.14/fileHashes/resourceHashesCache.bin b/gukyuin/label-send/.gradle/8.14/fileHashes/resourceHashesCache.bin index 9e8f124..3fc1529 100644 Binary files a/gukyuin/label-send/.gradle/8.14/fileHashes/resourceHashesCache.bin and b/gukyuin/label-send/.gradle/8.14/fileHashes/resourceHashesCache.bin differ diff --git a/gukyuin/label-send/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/gukyuin/label-send/.gradle/buildOutputCleanup/buildOutputCleanup.lock index 9df9b5f..2642ad1 100644 Binary files a/gukyuin/label-send/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/gukyuin/label-send/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/gukyuin/label-send/.gradle/file-system.probe b/gukyuin/label-send/.gradle/file-system.probe index 1c8070f..660e380 100644 Binary files a/gukyuin/label-send/.gradle/file-system.probe and b/gukyuin/label-send/.gradle/file-system.probe differ diff --git a/gukyuin/label-send/build/classes/java/main/com/kamco/cd/kamcoback/config/resttemplate/ExternalHttpClient$ExternalCallResult.class b/gukyuin/label-send/build/classes/java/main/com/kamco/cd/kamcoback/config/resttemplate/ExternalHttpClient$ExternalCallResult.class index cb23291..c510012 100644 Binary files a/gukyuin/label-send/build/classes/java/main/com/kamco/cd/kamcoback/config/resttemplate/ExternalHttpClient$ExternalCallResult.class and b/gukyuin/label-send/build/classes/java/main/com/kamco/cd/kamcoback/config/resttemplate/ExternalHttpClient$ExternalCallResult.class differ diff --git a/gukyuin/label-send/build/classes/java/main/com/kamco/cd/kamcoback/config/resttemplate/ExternalHttpClient.class b/gukyuin/label-send/build/classes/java/main/com/kamco/cd/kamcoback/config/resttemplate/ExternalHttpClient.class index 7214690..59718ff 100644 Binary files a/gukyuin/label-send/build/classes/java/main/com/kamco/cd/kamcoback/config/resttemplate/ExternalHttpClient.class and b/gukyuin/label-send/build/classes/java/main/com/kamco/cd/kamcoback/config/resttemplate/ExternalHttpClient.class differ diff --git a/gukyuin/label-send/build/classes/java/main/com/kamco/cd/kamcoback/service/GukYuinApiLabelJobService.class b/gukyuin/label-send/build/classes/java/main/com/kamco/cd/kamcoback/service/GukYuinApiLabelJobService.class index d54ff01..4e28521 100644 Binary files a/gukyuin/label-send/build/classes/java/main/com/kamco/cd/kamcoback/service/GukYuinApiLabelJobService.class and b/gukyuin/label-send/build/classes/java/main/com/kamco/cd/kamcoback/service/GukYuinApiLabelJobService.class differ diff --git a/gukyuin/label-send/build/libs/label-send.jar b/gukyuin/label-send/build/libs/label-send.jar index 3fa1479..9e6e939 100644 Binary files a/gukyuin/label-send/build/libs/label-send.jar and b/gukyuin/label-send/build/libs/label-send.jar differ diff --git a/gukyuin/label-send/build/reports/problems/problems-report.html b/gukyuin/label-send/build/reports/problems/problems-report.html index ac8c868..c67bd41 100644 --- a/gukyuin/label-send/build/reports/problems/problems-report.html +++ b/gukyuin/label-send/build/reports/problems/problems-report.html @@ -650,7 +650,7 @@ code + .copy-button { diff --git a/gukyuin/label-send/build/tmp/compileJava/previous-compilation-data.bin b/gukyuin/label-send/build/tmp/compileJava/previous-compilation-data.bin index afea38f..e93cb0e 100644 Binary files a/gukyuin/label-send/build/tmp/compileJava/previous-compilation-data.bin and b/gukyuin/label-send/build/tmp/compileJava/previous-compilation-data.bin differ diff --git a/gukyuin/label-send/src/main/java/com/kamco/cd/kamcoback/config/resttemplate/ExternalHttpClient.java b/gukyuin/label-send/src/main/java/com/kamco/cd/kamcoback/config/resttemplate/ExternalHttpClient.java index e4e656d..d5b5c22 100644 --- a/gukyuin/label-send/src/main/java/com/kamco/cd/kamcoback/config/resttemplate/ExternalHttpClient.java +++ b/gukyuin/label-send/src/main/java/com/kamco/cd/kamcoback/config/resttemplate/ExternalHttpClient.java @@ -25,46 +25,105 @@ public class ExternalHttpClient { public ExternalCallResult call( String url, HttpMethod method, Object body, HttpHeaders headers, Class responseType) { + long start = System.currentTimeMillis(); + + log.info("[API-REQ] method={}, url={}", method, url); + // responseType 기반으로 Accept 동적 세팅 HttpHeaders resolvedHeaders = resolveHeaders(headers, responseType); + + log.debug("[API-REQ] headers={}", resolvedHeaders); logRequestBody(body); HttpEntity entity = new HttpEntity<>(body, resolvedHeaders); try { + // String: raw bytes -> UTF-8 string if (responseType == String.class) { + ResponseEntity res = restTemplate.exchange(url, method, entity, byte[].class); + String raw = (res.getBody() == null) ? null : new String(res.getBody(), StandardCharsets.UTF_8); + long elapsed = System.currentTimeMillis() - start; + + log.info( + "[API-RES] method={}, url={}, status={}, elapsed={}ms", + method, + url, + res.getStatusCodeValue(), + elapsed); + + log.debug("[API-RES] body={}", raw); + @SuppressWarnings("unchecked") T casted = (T) raw; + return new ExternalCallResult<>(res.getStatusCodeValue(), true, casted, null); } // byte[]: raw bytes로 받고, JSON이면 에러로 처리 if (responseType == byte[].class) { + ResponseEntity res = restTemplate.exchange(url, method, entity, byte[].class); + long elapsed = System.currentTimeMillis() - start; + + log.info( + "[API-RES] method={}, url={}, status={}, elapsed={}ms", + method, + url, + res.getStatusCodeValue(), + elapsed); + MediaType ct = res.getHeaders().getContentType(); byte[] bytes = res.getBody(); if (isJsonLike(ct)) { + String err = (bytes == null) ? null : new String(bytes, StandardCharsets.UTF_8); + + log.warn("[API-RES] JSON error body={}", err); + return new ExternalCallResult<>(res.getStatusCodeValue(), false, null, err); } @SuppressWarnings("unchecked") T casted = (T) bytes; + return new ExternalCallResult<>(res.getStatusCodeValue(), true, casted, null); } // DTO 등: 일반 역직렬화 ResponseEntity res = restTemplate.exchange(url, method, entity, responseType); + + long elapsed = System.currentTimeMillis() - start; + + log.info( + "[API-RES] method={}, url={}, status={}, elapsed={}ms", + method, + url, + res.getStatusCodeValue(), + elapsed); + + log.debug("[API-RES] body={}", res.getBody()); + return new ExternalCallResult<>(res.getStatusCodeValue(), true, res.getBody(), null); } catch (HttpStatusCodeException e) { + + long elapsed = System.currentTimeMillis() - start; + + log.error( + "[API-ERROR] method={}, url={}, status={}, elapsed={}ms, body={}", + method, + url, + e.getStatusCode().value(), + elapsed, + e.getResponseBodyAsString()); + return new ExternalCallResult<>( e.getStatusCode().value(), false, null, e.getResponseBodyAsString()); } diff --git a/gukyuin/label-send/src/main/java/com/kamco/cd/kamcoback/service/GukYuinApiLabelJobService.java b/gukyuin/label-send/src/main/java/com/kamco/cd/kamcoback/service/GukYuinApiLabelJobService.java index db75a3f..ab7f23d 100644 --- a/gukyuin/label-send/src/main/java/com/kamco/cd/kamcoback/service/GukYuinApiLabelJobService.java +++ b/gukyuin/label-send/src/main/java/com/kamco/cd/kamcoback/service/GukYuinApiLabelJobService.java @@ -28,29 +28,110 @@ public class GukYuinApiLabelJobService { /** 어제 라벨링 검수 완료된 것 -> 국유인에 전송 */ public void findLabelingCompleteSend(LocalDate baseDate) { - log.info("[Step 1-1] 어제 검수완료된 라벨링을 검색한다."); - log.info("=== baseDate : {}", baseDate); - log.info("=== baseDate 있으면 해당 일자, 없으면 어제일자로 조회"); + long jobStart = System.currentTimeMillis(); + + log.info("[JOB-START] Labeling Send Job start profile={}, baseDate={}", profile, baseDate); + log.info("[Step 1-1] 어제 검수완료된 라벨링 조회 시작"); + + log.info("baseDate: {}", baseDate); + log.info("baseDate가 없으면 오늘 00시 이전까지 검수완료된 건들을 조회한다."); + log.info("baseDate가 있으면 baseDate 까지 검수완료된 건들을 조회한다."); List list = gukYuinLabelJobCoreService.findYesterdayLabelingCompleteList(baseDate); - log.info("[Step 1-2] 검수완료된 폴리곤 객체 수 : {}", list == null ? 0 : list.size()); - if (list.isEmpty()) { - log.info("[Step 1-3] 객체 없어서 return : 스케줄링 종료"); + + int total = list == null ? 0 : list.size(); + + log.info("[Step 1-2] 검수완료된 폴리곤 객체 수={}", total); + + if (list == null || list.isEmpty()) { + log.info("[Step 1-3] 처리 대상 없음 → 스케줄 종료"); + log.info("[JOB-END] total=0 elapsed={}ms", System.currentTimeMillis() - jobStart); return; } + int success = 0; + int fail = 0; + int skip = 0; + log.info("[Step 2-1] 객체 목록으로 라벨링 전송 API 호출 시작"); + + int index = 0; + for (GeomUidDto gto : list) { - log.info("[Step 2-2] 객체ID 확인 gto.getResultUid(): {}", gto.getResultUid()); - ChngDetectContDto.ResultLabelDto dto = - gukYuinApiService.updateChnDtctObjtLabelingYn(gto.getResultUid(), "Y", "Y"); - log.info("[Step 2-3] 결과 dto.getSuccess(): {}", dto.getSuccess()); - if (dto.getSuccess()) { - log.info("[Step 2-4] 결과가 성공일 때 inference_geom에 label_send_dttm 업데이트 하기"); - log.info("==== 업데이트 하는 객체 gto.getGeoUid(): {}", gto.getGeoUid()); - // inference_geom 에 label_send_dttm 업데이트 하기 - gukYuinLabelJobCoreService.updateAnalDataInferenceGeomSendDttm(gto.getGeoUid()); + + index++; + long itemStart = System.currentTimeMillis(); + + try { + + log.info( + "[Step 2-2] 처리 시작 {}/{} resultUid={}, geoUid={}", + index, + total, + gto.getResultUid(), + gto.getGeoUid()); + + long apiStart = System.currentTimeMillis(); + + ChngDetectContDto.ResultLabelDto dto = + gukYuinApiService.updateChnDtctObjtLabelingYn(gto.getResultUid(), "Y", "Y"); + + long apiElapsed = System.currentTimeMillis() - apiStart; + + if (dto == null) { + log.warn("[Step 2-3] API 결과 NULL resultUid={}", gto.getResultUid()); + skip++; + continue; + } + + log.info( + "[Step 2-3] API 결과 success={}, elapsed={}ms resultUid={}", + dto.getSuccess(), + apiElapsed, + gto.getResultUid()); + + log.debug("[Step 2-3] API result DTO={}", dto); + + if (dto.getSuccess()) { + + log.info( + "[Step 2-4] 성공 → inference_geom label_send_dttm 업데이트 geoUid={}", gto.getGeoUid()); + + gukYuinLabelJobCoreService.updateAnalDataInferenceGeomSendDttm(gto.getGeoUid()); + + success++; + + } else { + + log.warn("[Step 2-4] API 성공 false → DB 업데이트 skip resultUid={}", gto.getResultUid()); + + skip++; + } + + log.info( + "[ITEM-END] resultUid={} elapsed={}ms", + gto.getResultUid(), + System.currentTimeMillis() - itemStart); + + } catch (Exception e) { + + fail++; + + log.error( + "[ITEM-ERROR] resultUid={} geoUid={} elapsed={}ms", + gto.getResultUid(), + gto.getGeoUid(), + System.currentTimeMillis() - itemStart, + e); } } + + log.info( + "[JOB-END] total={}, success={}, skip={}, fail={}, elapsed={}ms", + total, + success, + skip, + fail, + System.currentTimeMillis() - jobStart); } }