From f83f0b071375815c88b0fbc59172244af45a230f Mon Sep 17 00:00:00 2001 From: sanghyeonhd Date: Fri, 28 Nov 2025 17:00:58 +0900 Subject: [PATCH 1/7] Explain Line change - Daniel C No.9 --- .../kamcoback/geojson/service/GeometryConversionService.java | 1 - .../postgres/repository/MapSheetLearnDataGeomRepository.java | 4 ++-- src/main/resources/application.yml | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/kamco/cd/kamcoback/geojson/service/GeometryConversionService.java b/src/main/java/com/kamco/cd/kamcoback/geojson/service/GeometryConversionService.java index 2450e99f..18d7da00 100644 --- a/src/main/java/com/kamco/cd/kamcoback/geojson/service/GeometryConversionService.java +++ b/src/main/java/com/kamco/cd/kamcoback/geojson/service/GeometryConversionService.java @@ -433,5 +433,4 @@ public class GeometryConversionService { return processedIds; } - } diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/MapSheetLearnDataGeomRepository.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/MapSheetLearnDataGeomRepository.java index dc1bb7bb..582b74c0 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/MapSheetLearnDataGeomRepository.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/MapSheetLearnDataGeomRepository.java @@ -26,8 +26,8 @@ public interface MapSheetLearnDataGeomRepository /** 지오메트리 타입별 조회 */ List findByGeoType(String geoType); - /** 데이터 UID로 기존 지오메트리 데이터 삭제 (재생성 전에 사용) */ - void deleteByDataUid(Long dataUid); + /** 데이터 UID로 기존 지오메트리 데이터 삭제 (재생성 전에 사용) */ + void deleteByDataUid(Long dataUid); /** PostGIS 함수를 사용하여 geometry 데이터를 직접 삽입 ST_SetSRID(ST_GeomFromGeoJSON(...), 5186) 형식으로 저장 */ @Modifying diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 2cbc49dc..84e951a0 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -22,7 +22,7 @@ spring: leak-detection-threshold: 60000 jpa: hibernate: - ddl-auto: update # 스키마 검증만 수행, 자동 변경하지 않음 (안전) + ddl-auto: update # 테이블이 없으면 생성, 있으면 업데이트 properties: hibernate: jdbc: @@ -65,7 +65,7 @@ geojson: error-directory: ~/geojson/error temp-directory: /tmp/geojson_extract cron-expression: "0/30 * * * * *" # 매 30초마다 실행 - supported-extensions: + supported-extensions: - zip - tar - tar.gz From c90dedbe68cbd55e8eb801c26863a97042285bbe Mon Sep 17 00:00:00 2001 From: teddy Date: Fri, 28 Nov 2025 17:04:50 +0900 Subject: [PATCH 2/7] =?UTF-8?q?=EB=B6=84=EC=84=9D=EA=B2=B0=EA=B3=BC=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=20=ED=8C=8C=EB=9D=BC=EB=AF=B8=ED=84=B0=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InferenceResultApiController.java | 342 +++++++++--------- 1 file changed, 171 insertions(+), 171 deletions(-) diff --git a/src/main/java/com/kamco/cd/kamcoback/inference/InferenceResultApiController.java b/src/main/java/com/kamco/cd/kamcoback/inference/InferenceResultApiController.java index 760ac5e5..01858f56 100644 --- a/src/main/java/com/kamco/cd/kamcoback/inference/InferenceResultApiController.java +++ b/src/main/java/com/kamco/cd/kamcoback/inference/InferenceResultApiController.java @@ -41,128 +41,128 @@ public class InferenceResultApiController { @Operation(summary = "추론관리 분석결과 목록 조회", description = "분석상태, 제목으로 분석결과를 조회 합니다.") @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "검색 성공", - content = - @Content( - mediaType = "application/json", - schema = @Schema(implementation = Page.class))), - @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), - @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) - }) + value = { + @ApiResponse( + responseCode = "200", + description = "검색 성공", + content = + @Content( + mediaType = "application/json", + schema = @Schema(implementation = Page.class))), + @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), + @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) + }) @GetMapping("/list") public ApiResponseDto> getInferenceResultList( - @Parameter(description = "분석상태", example = "0002") @RequestParam(required = false) - String statCode, - @Parameter(description = "제목", example = "변화탐지") @RequestParam(required = false) String title, - @Parameter(description = "페이지 번호 (0부터 시작)", example = "0") @RequestParam(defaultValue = "0") - int page, - @Parameter(description = "페이지 크기", example = "20") @RequestParam(defaultValue = "20") - int size, - @Parameter(description = "정렬 조건 (형식: 필드명,방향)", example = "name,asc") - @RequestParam(required = false) - String sort) { + @Parameter(description = "분석상태", example = "0002") @RequestParam(required = false) + String statCode, + @Parameter(description = "제목", example = "변화탐지") @RequestParam(required = false) String title, + @Parameter(description = "페이지 번호 (0부터 시작)", example = "0") @RequestParam(defaultValue = "0") + int page, + @Parameter(description = "페이지 크기", example = "20") @RequestParam(defaultValue = "20") + int size, + @Parameter(description = "정렬 조건 (형식: 필드명,방향)", example = "name,asc") + @RequestParam(required = false) + String sort) { InferenceResultDto.SearchReq searchReq = - new InferenceResultDto.SearchReq(statCode, title, page, size, sort); + new InferenceResultDto.SearchReq(statCode, title, page, size, sort); Page analResList = - inferenceResultService.getInferenceResultList(searchReq); + inferenceResultService.getInferenceResultList(searchReq); return ApiResponseDto.ok(analResList); } @Operation(summary = "추론관리 분석결과 요약정보", description = "분석결과 요약정보를 조회합니다.") @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "검색 성공", - content = - @Content( - mediaType = "application/json", - schema = @Schema(implementation = InferenceResultDto.AnalResSummary.class))), - @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), - @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) - }) + value = { + @ApiResponse( + responseCode = "200", + description = "검색 성공", + content = + @Content( + mediaType = "application/json", + schema = @Schema(implementation = InferenceResultDto.AnalResSummary.class))), + @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), + @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) + }) @GetMapping("/summary/{id}") public ApiResponseDto getInferenceResultSummary( - @Parameter(description = "목록 id", example = "1") @PathVariable Long id) { + @Parameter(description = "목록 id", example = "1") @PathVariable Long id) { return ApiResponseDto.ok(inferenceResultService.getInferenceResultSummary(id)); } @Operation(summary = "추론관리 분석결과 상세", description = "분석결과 상제 정보 Summary, DashBoard") @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "검색 성공", - content = - @Content( - mediaType = "application/json", - schema = @Schema(implementation = InferenceResultDto.Detail.class))), - @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), - @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) - }) - @GetMapping("/detail") + value = { + @ApiResponse( + responseCode = "200", + description = "검색 성공", + content = + @Content( + mediaType = "application/json", + schema = @Schema(implementation = InferenceResultDto.Detail.class))), + @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), + @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) + }) + @GetMapping("/detail/{id}") public ApiResponseDto getInferenceDetail( - @Parameter(description = "목록 id", example = "1") @RequestParam Long id) { + @Parameter(description = "목록 id", example = "1") @PathVariable Long id) { return ApiResponseDto.ok(inferenceResultService.getDetail(id)); } @Operation(summary = "추론관리 분석결과 상세 목록", description = "추론관리 분석결과 상세 목록 geojson 데이터 조회") @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "검색 성공", - content = - @Content( - mediaType = "application/json", - schema = @Schema(implementation = Page.class))), - @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), - @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) - }) + value = { + @ApiResponse( + responseCode = "200", + description = "검색 성공", + content = + @Content( + mediaType = "application/json", + schema = @Schema(implementation = Page.class))), + @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), + @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) + }) @GetMapping("/geom/{id}") public ApiResponseDto> getInferenceResultGeomList( - @Parameter(description = "분석결과 id", example = "1") @PathVariable Long id, - @Parameter(description = "기준년도 분류", example = "land") @RequestParam(required = false) - String targetClass, - @Parameter(description = "비교년도 분류", example = "waste") @RequestParam(required = false) - String compareClass, - @Parameter(description = "5000:1 도협번호 37801011,37801012") @RequestParam(required = false) - List mapSheetNum, - @Parameter(description = "페이지 번호 (0부터 시작)", example = "0") @RequestParam(defaultValue = "0") - int page, - @Parameter(description = "페이지 크기", example = "20") @RequestParam(defaultValue = "20") - int size, - @Parameter(description = "정렬 조건 (형식: 필드명,방향)", example = "name,asc") - @RequestParam(required = false) - String sort) { + @Parameter(description = "분석결과 id", example = "1") @PathVariable Long id, + @Parameter(description = "기준년도 분류", example = "land") @RequestParam(required = false) + String targetClass, + @Parameter(description = "비교년도 분류", example = "waste") @RequestParam(required = false) + String compareClass, + @Parameter(description = "5000:1 도협번호 37801011,37801012") @RequestParam(required = false) + List mapSheetNum, + @Parameter(description = "페이지 번호 (0부터 시작)", example = "0") @RequestParam(defaultValue = "0") + int page, + @Parameter(description = "페이지 크기", example = "20") @RequestParam(defaultValue = "20") + int size, + @Parameter(description = "정렬 조건 (형식: 필드명,방향)", example = "name,asc") + @RequestParam(required = false) + String sort) { InferenceResultDto.SearchGeoReq searchGeoReq = - new InferenceResultDto.SearchGeoReq( - targetClass, compareClass, mapSheetNum, page, size, sort); + new InferenceResultDto.SearchGeoReq( + targetClass, compareClass, mapSheetNum, page, size, sort); Page geomList = - inferenceResultService.getInferenceResultGeomList(id, searchGeoReq); + inferenceResultService.getInferenceResultGeomList(id, searchGeoReq); return ApiResponseDto.ok(geomList); } @Operation(summary = "학습모델 결과 처리", description = "실제 학습모델 GeoJSON 파일을 처리하여 데이터베이스에 저장합니다.") @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "처리 성공", - content = - @Content( - mediaType = "application/json", - schema = - @Schema(implementation = LearningModelResultDto.ProcessResponse.class))), - @ApiResponse(responseCode = "400", description = "잘못된 요청", content = @Content), - @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) - }) + value = { + @ApiResponse( + responseCode = "200", + description = "처리 성공", + content = + @Content( + mediaType = "application/json", + schema = + @Schema(implementation = LearningModelResultDto.ProcessResponse.class))), + @ApiResponse(responseCode = "400", description = "잘못된 요청", content = @Content), + @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) + }) @PostMapping("/learning-model/process") public ApiResponseDto processLearningModelResult( - @RequestBody LearningModelResultDto.ProcessRequest request) { + @RequestBody LearningModelResultDto.ProcessRequest request) { try { logger.info("Processing learning model result file: {}", request.getFilePath()); @@ -170,29 +170,29 @@ public class InferenceResultApiController { int processedFeatures = learningModelResultProcessor.processLearningModelResult(filePath); LearningModelResultDto.ProcessResponse response = - LearningModelResultDto.ProcessResponse.builder() - .success(true) - .message("학습모델 결과 처리가 완료되었습니다.") - .processedFeatures(processedFeatures) - .filePath(request.getFilePath()) - .build(); + LearningModelResultDto.ProcessResponse.builder() + .success(true) + .message("학습모델 결과 처리가 완료되었습니다.") + .processedFeatures(processedFeatures) + .filePath(request.getFilePath()) + .build(); logger.info( - "Successfully processed {} features from file: {}", - processedFeatures, - request.getFilePath()); + "Successfully processed {} features from file: {}", + processedFeatures, + request.getFilePath()); return ApiResponseDto.ok(response); } catch (Exception e) { logger.error("Failed to process learning model result: {}", request.getFilePath(), e); LearningModelResultDto.ProcessResponse response = - LearningModelResultDto.ProcessResponse.builder() - .success(false) - .message("학습모델 결과 처리 중 오류가 발생했습니다: " + e.getMessage()) - .processedFeatures(0) - .filePath(request.getFilePath()) - .build(); + LearningModelResultDto.ProcessResponse.builder() + .success(false) + .message("학습모델 결과 처리 중 오류가 발생했습니다: " + e.getMessage()) + .processedFeatures(0) + .filePath(request.getFilePath()) + .build(); return ApiResponseDto.ok(response); } @@ -200,23 +200,23 @@ public class InferenceResultApiController { @Operation(summary = "학습모델 결과 일괄 처리", description = "여러 학습모델 GeoJSON 파일을 일괄 처리하여 데이터베이스에 저장합니다.") @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "처리 성공", - content = - @Content( - mediaType = "application/json", - schema = - @Schema( - implementation = LearningModelResultDto.BatchProcessResponse.class))), - @ApiResponse(responseCode = "400", description = "잘못된 요청", content = @Content), - @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) - }) + value = { + @ApiResponse( + responseCode = "200", + description = "처리 성공", + content = + @Content( + mediaType = "application/json", + schema = + @Schema( + implementation = LearningModelResultDto.BatchProcessResponse.class))), + @ApiResponse(responseCode = "400", description = "잘못된 요청", content = @Content), + @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) + }) @PostMapping("/learning-model/process-batch") public ApiResponseDto - processBatchLearningModelResults( - @RequestBody LearningModelResultDto.BatchProcessRequest request) { + processBatchLearningModelResults( + @RequestBody LearningModelResultDto.BatchProcessRequest request) { try { logger.info("Processing {} learning model result files", request.getFilePaths().size()); @@ -226,34 +226,34 @@ public class InferenceResultApiController { } int totalProcessedFeatures = - learningModelResultProcessor.processMultipleLearningModelResults(filePaths); + learningModelResultProcessor.processMultipleLearningModelResults(filePaths); LearningModelResultDto.BatchProcessResponse response = - LearningModelResultDto.BatchProcessResponse.builder() - .success(true) - .message("일괄 학습모델 결과 처리가 완료되었습니다.") - .totalProcessedFeatures(totalProcessedFeatures) - .processedFileCount(request.getFilePaths().size()) - .filePaths(request.getFilePaths()) - .build(); + LearningModelResultDto.BatchProcessResponse.builder() + .success(true) + .message("일괄 학습모델 결과 처리가 완료되었습니다.") + .totalProcessedFeatures(totalProcessedFeatures) + .processedFileCount(request.getFilePaths().size()) + .filePaths(request.getFilePaths()) + .build(); logger.info( - "Successfully processed {} features from {} files", - totalProcessedFeatures, - request.getFilePaths().size()); + "Successfully processed {} features from {} files", + totalProcessedFeatures, + request.getFilePaths().size()); return ApiResponseDto.ok(response); } catch (Exception e) { logger.error("Failed to process batch learning model results", e); LearningModelResultDto.BatchProcessResponse response = - LearningModelResultDto.BatchProcessResponse.builder() - .success(false) - .message("일괄 학습모델 결과 처리 중 오류가 발생했습니다: " + e.getMessage()) - .totalProcessedFeatures(0) - .processedFileCount(0) - .filePaths(request.getFilePaths()) - .build(); + LearningModelResultDto.BatchProcessResponse.builder() + .success(false) + .message("일괄 학습모델 결과 처리 중 오류가 발생했습니다: " + e.getMessage()) + .totalProcessedFeatures(0) + .processedFileCount(0) + .filePaths(request.getFilePaths()) + .build(); return ApiResponseDto.ok(response); } @@ -261,29 +261,29 @@ public class InferenceResultApiController { @Operation(summary = "기본 학습모델 파일 처리", description = "미리 준비된 학습모델 파일을 처리합니다.") @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "처리 성공", - content = - @Content( - mediaType = "application/json", - schema = - @Schema( - implementation = LearningModelResultDto.BatchProcessResponse.class))), - @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) - }) + value = { + @ApiResponse( + responseCode = "200", + description = "처리 성공", + content = + @Content( + mediaType = "application/json", + schema = + @Schema( + implementation = LearningModelResultDto.BatchProcessResponse.class))), + @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) + }) @PostMapping("/learning-model/process-default") public ApiResponseDto - processDefaultLearningModelResults() { + processDefaultLearningModelResults() { try { logger.info("Processing default learning model result files"); // Process the two default learning model files from upload directory List defaultFilePaths = - List.of( - "/Users/deniallee/geojson/upload/캠코_2021_2022_35813023.geojson", - "/Users/deniallee/geojson/upload/캠코_2023_2024_35810049.geojson"); + List.of( + "/Users/deniallee/geojson/upload/캠코_2021_2022_35813023.geojson", + "/Users/deniallee/geojson/upload/캠코_2023_2024_35810049.geojson"); List filePaths = new ArrayList<>(); for (String filePath : defaultFilePaths) { @@ -291,34 +291,34 @@ public class InferenceResultApiController { } int totalProcessedFeatures = - learningModelResultProcessor.processMultipleLearningModelResults(filePaths); + learningModelResultProcessor.processMultipleLearningModelResults(filePaths); LearningModelResultDto.BatchProcessResponse response = - LearningModelResultDto.BatchProcessResponse.builder() - .success(true) - .message("기본 학습모델 결과 파일 처리가 완료되었습니다.") - .totalProcessedFeatures(totalProcessedFeatures) - .processedFileCount(defaultFilePaths.size()) - .filePaths(defaultFilePaths) - .build(); + LearningModelResultDto.BatchProcessResponse.builder() + .success(true) + .message("기본 학습모델 결과 파일 처리가 완료되었습니다.") + .totalProcessedFeatures(totalProcessedFeatures) + .processedFileCount(defaultFilePaths.size()) + .filePaths(defaultFilePaths) + .build(); logger.info( - "Successfully processed {} features from {} default files", - totalProcessedFeatures, - defaultFilePaths.size()); + "Successfully processed {} features from {} default files", + totalProcessedFeatures, + defaultFilePaths.size()); return ApiResponseDto.ok(response); } catch (Exception e) { logger.error("Failed to process default learning model results", e); LearningModelResultDto.BatchProcessResponse response = - LearningModelResultDto.BatchProcessResponse.builder() - .success(false) - .message("기본 학습모델 결과 처리 중 오류가 발생했습니다: " + e.getMessage()) - .totalProcessedFeatures(0) - .processedFileCount(0) - .filePaths(List.of()) - .build(); + LearningModelResultDto.BatchProcessResponse.builder() + .success(false) + .message("기본 학습모델 결과 처리 중 오류가 발생했습니다: " + e.getMessage()) + .totalProcessedFeatures(0) + .processedFileCount(0) + .filePaths(List.of()) + .build(); return ApiResponseDto.ok(response); } From 134450e8594c7e70f77f5bbf926640eb8dd281b4 Mon Sep 17 00:00:00 2001 From: teddy Date: Fri, 28 Nov 2025 17:05:00 +0900 Subject: [PATCH 3/7] =?UTF-8?q?=EB=B6=84=EC=84=9D=EA=B2=B0=EA=B3=BC=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=20=ED=8C=8C=EB=9D=BC=EB=AF=B8=ED=84=B0=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InferenceResultApiController.java | 340 +++++++++--------- 1 file changed, 170 insertions(+), 170 deletions(-) diff --git a/src/main/java/com/kamco/cd/kamcoback/inference/InferenceResultApiController.java b/src/main/java/com/kamco/cd/kamcoback/inference/InferenceResultApiController.java index 01858f56..b61086d9 100644 --- a/src/main/java/com/kamco/cd/kamcoback/inference/InferenceResultApiController.java +++ b/src/main/java/com/kamco/cd/kamcoback/inference/InferenceResultApiController.java @@ -41,128 +41,128 @@ public class InferenceResultApiController { @Operation(summary = "추론관리 분석결과 목록 조회", description = "분석상태, 제목으로 분석결과를 조회 합니다.") @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "검색 성공", - content = - @Content( - mediaType = "application/json", - schema = @Schema(implementation = Page.class))), - @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), - @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) - }) + value = { + @ApiResponse( + responseCode = "200", + description = "검색 성공", + content = + @Content( + mediaType = "application/json", + schema = @Schema(implementation = Page.class))), + @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), + @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) + }) @GetMapping("/list") public ApiResponseDto> getInferenceResultList( - @Parameter(description = "분석상태", example = "0002") @RequestParam(required = false) - String statCode, - @Parameter(description = "제목", example = "변화탐지") @RequestParam(required = false) String title, - @Parameter(description = "페이지 번호 (0부터 시작)", example = "0") @RequestParam(defaultValue = "0") - int page, - @Parameter(description = "페이지 크기", example = "20") @RequestParam(defaultValue = "20") - int size, - @Parameter(description = "정렬 조건 (형식: 필드명,방향)", example = "name,asc") - @RequestParam(required = false) - String sort) { + @Parameter(description = "분석상태", example = "0002") @RequestParam(required = false) + String statCode, + @Parameter(description = "제목", example = "변화탐지") @RequestParam(required = false) String title, + @Parameter(description = "페이지 번호 (0부터 시작)", example = "0") @RequestParam(defaultValue = "0") + int page, + @Parameter(description = "페이지 크기", example = "20") @RequestParam(defaultValue = "20") + int size, + @Parameter(description = "정렬 조건 (형식: 필드명,방향)", example = "name,asc") + @RequestParam(required = false) + String sort) { InferenceResultDto.SearchReq searchReq = - new InferenceResultDto.SearchReq(statCode, title, page, size, sort); + new InferenceResultDto.SearchReq(statCode, title, page, size, sort); Page analResList = - inferenceResultService.getInferenceResultList(searchReq); + inferenceResultService.getInferenceResultList(searchReq); return ApiResponseDto.ok(analResList); } @Operation(summary = "추론관리 분석결과 요약정보", description = "분석결과 요약정보를 조회합니다.") @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "검색 성공", - content = - @Content( - mediaType = "application/json", - schema = @Schema(implementation = InferenceResultDto.AnalResSummary.class))), - @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), - @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) - }) + value = { + @ApiResponse( + responseCode = "200", + description = "검색 성공", + content = + @Content( + mediaType = "application/json", + schema = @Schema(implementation = InferenceResultDto.AnalResSummary.class))), + @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), + @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) + }) @GetMapping("/summary/{id}") public ApiResponseDto getInferenceResultSummary( - @Parameter(description = "목록 id", example = "1") @PathVariable Long id) { + @Parameter(description = "목록 id", example = "1") @PathVariable Long id) { return ApiResponseDto.ok(inferenceResultService.getInferenceResultSummary(id)); } @Operation(summary = "추론관리 분석결과 상세", description = "분석결과 상제 정보 Summary, DashBoard") @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "검색 성공", - content = - @Content( - mediaType = "application/json", - schema = @Schema(implementation = InferenceResultDto.Detail.class))), - @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), - @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) - }) + value = { + @ApiResponse( + responseCode = "200", + description = "검색 성공", + content = + @Content( + mediaType = "application/json", + schema = @Schema(implementation = InferenceResultDto.Detail.class))), + @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), + @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) + }) @GetMapping("/detail/{id}") public ApiResponseDto getInferenceDetail( - @Parameter(description = "목록 id", example = "1") @PathVariable Long id) { + @Parameter(description = "목록 id", example = "1") @PathVariable Long id) { return ApiResponseDto.ok(inferenceResultService.getDetail(id)); } @Operation(summary = "추론관리 분석결과 상세 목록", description = "추론관리 분석결과 상세 목록 geojson 데이터 조회") @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "검색 성공", - content = - @Content( - mediaType = "application/json", - schema = @Schema(implementation = Page.class))), - @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), - @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) - }) + value = { + @ApiResponse( + responseCode = "200", + description = "검색 성공", + content = + @Content( + mediaType = "application/json", + schema = @Schema(implementation = Page.class))), + @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), + @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) + }) @GetMapping("/geom/{id}") public ApiResponseDto> getInferenceResultGeomList( - @Parameter(description = "분석결과 id", example = "1") @PathVariable Long id, - @Parameter(description = "기준년도 분류", example = "land") @RequestParam(required = false) - String targetClass, - @Parameter(description = "비교년도 분류", example = "waste") @RequestParam(required = false) - String compareClass, - @Parameter(description = "5000:1 도협번호 37801011,37801012") @RequestParam(required = false) - List mapSheetNum, - @Parameter(description = "페이지 번호 (0부터 시작)", example = "0") @RequestParam(defaultValue = "0") - int page, - @Parameter(description = "페이지 크기", example = "20") @RequestParam(defaultValue = "20") - int size, - @Parameter(description = "정렬 조건 (형식: 필드명,방향)", example = "name,asc") - @RequestParam(required = false) - String sort) { + @Parameter(description = "분석결과 id", example = "1") @PathVariable Long id, + @Parameter(description = "기준년도 분류", example = "land") @RequestParam(required = false) + String targetClass, + @Parameter(description = "비교년도 분류", example = "waste") @RequestParam(required = false) + String compareClass, + @Parameter(description = "5000:1 도협번호 37801011,37801012") @RequestParam(required = false) + List mapSheetNum, + @Parameter(description = "페이지 번호 (0부터 시작)", example = "0") @RequestParam(defaultValue = "0") + int page, + @Parameter(description = "페이지 크기", example = "20") @RequestParam(defaultValue = "20") + int size, + @Parameter(description = "정렬 조건 (형식: 필드명,방향)", example = "name,asc") + @RequestParam(required = false) + String sort) { InferenceResultDto.SearchGeoReq searchGeoReq = - new InferenceResultDto.SearchGeoReq( - targetClass, compareClass, mapSheetNum, page, size, sort); + new InferenceResultDto.SearchGeoReq( + targetClass, compareClass, mapSheetNum, page, size, sort); Page geomList = - inferenceResultService.getInferenceResultGeomList(id, searchGeoReq); + inferenceResultService.getInferenceResultGeomList(id, searchGeoReq); return ApiResponseDto.ok(geomList); } @Operation(summary = "학습모델 결과 처리", description = "실제 학습모델 GeoJSON 파일을 처리하여 데이터베이스에 저장합니다.") @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "처리 성공", - content = - @Content( - mediaType = "application/json", - schema = - @Schema(implementation = LearningModelResultDto.ProcessResponse.class))), - @ApiResponse(responseCode = "400", description = "잘못된 요청", content = @Content), - @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) - }) + value = { + @ApiResponse( + responseCode = "200", + description = "처리 성공", + content = + @Content( + mediaType = "application/json", + schema = + @Schema(implementation = LearningModelResultDto.ProcessResponse.class))), + @ApiResponse(responseCode = "400", description = "잘못된 요청", content = @Content), + @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) + }) @PostMapping("/learning-model/process") public ApiResponseDto processLearningModelResult( - @RequestBody LearningModelResultDto.ProcessRequest request) { + @RequestBody LearningModelResultDto.ProcessRequest request) { try { logger.info("Processing learning model result file: {}", request.getFilePath()); @@ -170,29 +170,29 @@ public class InferenceResultApiController { int processedFeatures = learningModelResultProcessor.processLearningModelResult(filePath); LearningModelResultDto.ProcessResponse response = - LearningModelResultDto.ProcessResponse.builder() - .success(true) - .message("학습모델 결과 처리가 완료되었습니다.") - .processedFeatures(processedFeatures) - .filePath(request.getFilePath()) - .build(); + LearningModelResultDto.ProcessResponse.builder() + .success(true) + .message("학습모델 결과 처리가 완료되었습니다.") + .processedFeatures(processedFeatures) + .filePath(request.getFilePath()) + .build(); logger.info( - "Successfully processed {} features from file: {}", - processedFeatures, - request.getFilePath()); + "Successfully processed {} features from file: {}", + processedFeatures, + request.getFilePath()); return ApiResponseDto.ok(response); } catch (Exception e) { logger.error("Failed to process learning model result: {}", request.getFilePath(), e); LearningModelResultDto.ProcessResponse response = - LearningModelResultDto.ProcessResponse.builder() - .success(false) - .message("학습모델 결과 처리 중 오류가 발생했습니다: " + e.getMessage()) - .processedFeatures(0) - .filePath(request.getFilePath()) - .build(); + LearningModelResultDto.ProcessResponse.builder() + .success(false) + .message("학습모델 결과 처리 중 오류가 발생했습니다: " + e.getMessage()) + .processedFeatures(0) + .filePath(request.getFilePath()) + .build(); return ApiResponseDto.ok(response); } @@ -200,23 +200,23 @@ public class InferenceResultApiController { @Operation(summary = "학습모델 결과 일괄 처리", description = "여러 학습모델 GeoJSON 파일을 일괄 처리하여 데이터베이스에 저장합니다.") @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "처리 성공", - content = - @Content( - mediaType = "application/json", - schema = - @Schema( - implementation = LearningModelResultDto.BatchProcessResponse.class))), - @ApiResponse(responseCode = "400", description = "잘못된 요청", content = @Content), - @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) - }) + value = { + @ApiResponse( + responseCode = "200", + description = "처리 성공", + content = + @Content( + mediaType = "application/json", + schema = + @Schema( + implementation = LearningModelResultDto.BatchProcessResponse.class))), + @ApiResponse(responseCode = "400", description = "잘못된 요청", content = @Content), + @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) + }) @PostMapping("/learning-model/process-batch") public ApiResponseDto - processBatchLearningModelResults( - @RequestBody LearningModelResultDto.BatchProcessRequest request) { + processBatchLearningModelResults( + @RequestBody LearningModelResultDto.BatchProcessRequest request) { try { logger.info("Processing {} learning model result files", request.getFilePaths().size()); @@ -226,34 +226,34 @@ public class InferenceResultApiController { } int totalProcessedFeatures = - learningModelResultProcessor.processMultipleLearningModelResults(filePaths); + learningModelResultProcessor.processMultipleLearningModelResults(filePaths); LearningModelResultDto.BatchProcessResponse response = - LearningModelResultDto.BatchProcessResponse.builder() - .success(true) - .message("일괄 학습모델 결과 처리가 완료되었습니다.") - .totalProcessedFeatures(totalProcessedFeatures) - .processedFileCount(request.getFilePaths().size()) - .filePaths(request.getFilePaths()) - .build(); + LearningModelResultDto.BatchProcessResponse.builder() + .success(true) + .message("일괄 학습모델 결과 처리가 완료되었습니다.") + .totalProcessedFeatures(totalProcessedFeatures) + .processedFileCount(request.getFilePaths().size()) + .filePaths(request.getFilePaths()) + .build(); logger.info( - "Successfully processed {} features from {} files", - totalProcessedFeatures, - request.getFilePaths().size()); + "Successfully processed {} features from {} files", + totalProcessedFeatures, + request.getFilePaths().size()); return ApiResponseDto.ok(response); } catch (Exception e) { logger.error("Failed to process batch learning model results", e); LearningModelResultDto.BatchProcessResponse response = - LearningModelResultDto.BatchProcessResponse.builder() - .success(false) - .message("일괄 학습모델 결과 처리 중 오류가 발생했습니다: " + e.getMessage()) - .totalProcessedFeatures(0) - .processedFileCount(0) - .filePaths(request.getFilePaths()) - .build(); + LearningModelResultDto.BatchProcessResponse.builder() + .success(false) + .message("일괄 학습모델 결과 처리 중 오류가 발생했습니다: " + e.getMessage()) + .totalProcessedFeatures(0) + .processedFileCount(0) + .filePaths(request.getFilePaths()) + .build(); return ApiResponseDto.ok(response); } @@ -261,29 +261,29 @@ public class InferenceResultApiController { @Operation(summary = "기본 학습모델 파일 처리", description = "미리 준비된 학습모델 파일을 처리합니다.") @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "처리 성공", - content = - @Content( - mediaType = "application/json", - schema = - @Schema( - implementation = LearningModelResultDto.BatchProcessResponse.class))), - @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) - }) + value = { + @ApiResponse( + responseCode = "200", + description = "처리 성공", + content = + @Content( + mediaType = "application/json", + schema = + @Schema( + implementation = LearningModelResultDto.BatchProcessResponse.class))), + @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) + }) @PostMapping("/learning-model/process-default") public ApiResponseDto - processDefaultLearningModelResults() { + processDefaultLearningModelResults() { try { logger.info("Processing default learning model result files"); // Process the two default learning model files from upload directory List defaultFilePaths = - List.of( - "/Users/deniallee/geojson/upload/캠코_2021_2022_35813023.geojson", - "/Users/deniallee/geojson/upload/캠코_2023_2024_35810049.geojson"); + List.of( + "/Users/deniallee/geojson/upload/캠코_2021_2022_35813023.geojson", + "/Users/deniallee/geojson/upload/캠코_2023_2024_35810049.geojson"); List filePaths = new ArrayList<>(); for (String filePath : defaultFilePaths) { @@ -291,34 +291,34 @@ public class InferenceResultApiController { } int totalProcessedFeatures = - learningModelResultProcessor.processMultipleLearningModelResults(filePaths); + learningModelResultProcessor.processMultipleLearningModelResults(filePaths); LearningModelResultDto.BatchProcessResponse response = - LearningModelResultDto.BatchProcessResponse.builder() - .success(true) - .message("기본 학습모델 결과 파일 처리가 완료되었습니다.") - .totalProcessedFeatures(totalProcessedFeatures) - .processedFileCount(defaultFilePaths.size()) - .filePaths(defaultFilePaths) - .build(); + LearningModelResultDto.BatchProcessResponse.builder() + .success(true) + .message("기본 학습모델 결과 파일 처리가 완료되었습니다.") + .totalProcessedFeatures(totalProcessedFeatures) + .processedFileCount(defaultFilePaths.size()) + .filePaths(defaultFilePaths) + .build(); logger.info( - "Successfully processed {} features from {} default files", - totalProcessedFeatures, - defaultFilePaths.size()); + "Successfully processed {} features from {} default files", + totalProcessedFeatures, + defaultFilePaths.size()); return ApiResponseDto.ok(response); } catch (Exception e) { logger.error("Failed to process default learning model results", e); LearningModelResultDto.BatchProcessResponse response = - LearningModelResultDto.BatchProcessResponse.builder() - .success(false) - .message("기본 학습모델 결과 처리 중 오류가 발생했습니다: " + e.getMessage()) - .totalProcessedFeatures(0) - .processedFileCount(0) - .filePaths(List.of()) - .build(); + LearningModelResultDto.BatchProcessResponse.builder() + .success(false) + .message("기본 학습모델 결과 처리 중 오류가 발생했습니다: " + e.getMessage()) + .totalProcessedFeatures(0) + .processedFileCount(0) + .filePaths(List.of()) + .build(); return ApiResponseDto.ok(response); } From 9a06955e32b190097cc493d29f6a91c9a0034a0d Mon Sep 17 00:00:00 2001 From: teddy Date: Fri, 28 Nov 2025 17:29:09 +0900 Subject: [PATCH 4/7] =?UTF-8?q?=EB=B6=84=EC=84=9D=EA=B2=B0=EA=B3=BC=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inference/dto/InferenceResultDto.java | 43 +++---------------- .../service/InferenceResultService.java | 20 ++++++++- .../core/InferenceResultCoreService.java | 11 +++++ .../InferenceResultRepositoryCustom.java | 3 ++ .../InferenceResultRepositoryImpl.java | 12 ++++++ 5 files changed, 51 insertions(+), 38 deletions(-) diff --git a/src/main/java/com/kamco/cd/kamcoback/inference/dto/InferenceResultDto.java b/src/main/java/com/kamco/cd/kamcoback/inference/dto/InferenceResultDto.java index ee1506e3..98c80c31 100644 --- a/src/main/java/com/kamco/cd/kamcoback/inference/dto/InferenceResultDto.java +++ b/src/main/java/com/kamco/cd/kamcoback/inference/dto/InferenceResultDto.java @@ -148,47 +148,12 @@ public class InferenceResultDto { @Getter public static class Dashboard { - Integer compareYyyy; - Integer targetYyyy; - Long mapSheetNum; - String classBeforeName; String classAfterName; - Long classBeforeCnt; Long classAfterCnt; - @JsonFormatDttm ZonedDateTime createdDttm; - Long createdUid; - @JsonFormatDttm ZonedDateTime updatedDttm; - Long updatedUid; - Long refMapSheetNum; - Long dataUid; - public Dashboard( - Integer compareYyyy, - Integer targetYyyy, - Long mapSheetNum, - String classBeforeName, - String classAfterName, - Long classBeforeCnt, - Long classAfterCnt, - ZonedDateTime createdDttm, - Long createdUid, - ZonedDateTime updatedDttm, - Long updatedUid, - Long refMapSheetNum, - Long dataUid) { - this.compareYyyy = compareYyyy; - this.targetYyyy = targetYyyy; - this.mapSheetNum = mapSheetNum; - this.classBeforeName = classBeforeName; + public Dashboard(String classAfterName, Long classAfterCnt) { this.classAfterName = classAfterName; - this.classBeforeCnt = classBeforeCnt; this.classAfterCnt = classAfterCnt; - this.createdDttm = createdDttm; - this.createdUid = createdUid; - this.updatedDttm = updatedDttm; - this.updatedUid = updatedUid; - this.refMapSheetNum = refMapSheetNum; - this.dataUid = dataUid; } } @@ -196,9 +161,13 @@ public class InferenceResultDto { public static class Detail { AnalResSummary summary; + List dashboard; + Long totalCnt; - public Detail(AnalResSummary summary) { + public Detail(AnalResSummary summary, List dashboard, Long totalCnt) { this.summary = summary; + this.dashboard = dashboard; + this.totalCnt = totalCnt; } } diff --git a/src/main/java/com/kamco/cd/kamcoback/inference/service/InferenceResultService.java b/src/main/java/com/kamco/cd/kamcoback/inference/service/InferenceResultService.java index 2494a080..76490500 100644 --- a/src/main/java/com/kamco/cd/kamcoback/inference/service/InferenceResultService.java +++ b/src/main/java/com/kamco/cd/kamcoback/inference/service/InferenceResultService.java @@ -1,6 +1,7 @@ package com.kamco.cd.kamcoback.inference.service; import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto; +import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Dashboard; import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Detail; import com.kamco.cd.kamcoback.postgres.core.InferenceResultCoreService; import java.util.List; @@ -37,6 +38,16 @@ public class InferenceResultService { return inferenceResultCoreService.getInferenceResultSummary(id); } + /** + * 분석결과 상세 class name별 탐지 개수 + * + * @param id + * @return + */ + public List getDashboard(Long id) { + return inferenceResultCoreService.getDashboard(id); + } + /** * 분석결과 상세 목록 * @@ -57,7 +68,14 @@ public class InferenceResultService { public Detail getDetail(Long id) { // summary InferenceResultDto.AnalResSummary summary = this.getInferenceResultSummary(id); - return new Detail(summary); + + // Dashboard + List dashboards = this.getDashboard(id); + + // 전체 탐지건수 + Long totalCnt = dashboards.stream().mapToLong(Dashboard::getClassAfterCnt).sum(); + + return new Detail(summary, dashboards, totalCnt); } /** diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/core/InferenceResultCoreService.java b/src/main/java/com/kamco/cd/kamcoback/postgres/core/InferenceResultCoreService.java index 18ed6596..bbf1ea90 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/core/InferenceResultCoreService.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/core/InferenceResultCoreService.java @@ -1,6 +1,7 @@ package com.kamco.cd.kamcoback.postgres.core; import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto; +import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Dashboard; import com.kamco.cd.kamcoback.postgres.repository.Inference.InferenceResultRepository; import jakarta.persistence.EntityNotFoundException; import java.util.List; @@ -39,6 +40,16 @@ public class InferenceResultCoreService { return summary; } + /** + * 분석결과 상세 class name별 탐지 개수 + * + * @param id + * @return + */ + public List getDashboard(Long id) { + return inferenceResultRepository.getDashboard(id); + } + /** * 분석결과 상세 목록 * diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryCustom.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryCustom.java index 11abfda5..629d4ef9 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryCustom.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryCustom.java @@ -1,6 +1,7 @@ package com.kamco.cd.kamcoback.postgres.repository.Inference; import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto; +import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Dashboard; import java.util.List; import java.util.Optional; import org.springframework.data.domain.Page; @@ -16,4 +17,6 @@ public interface InferenceResultRepositoryCustom { Long id, InferenceResultDto.SearchGeoReq searchGeoReq); List getSheets(Long id); + + List getDashboard(Long id); } diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryImpl.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryImpl.java index 9c142efa..d0dcc62f 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryImpl.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryImpl.java @@ -1,6 +1,7 @@ package com.kamco.cd.kamcoback.postgres.repository.Inference; import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto; +import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Dashboard; import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.SearchGeoReq; import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataEntity; import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataGeomEntity; @@ -134,6 +135,17 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC return content; } + /** + * 분석결과 상세 class name별 탐지 개수 + * + * @param id + * @return + */ + @Override + public List getDashboard(Long id) { + return null; + } + /** * 분석결과 상세 목록 * From 23aff2a04e944347d764d2e640efdfee953c94a3 Mon Sep 17 00:00:00 2001 From: teddy Date: Fri, 28 Nov 2025 17:57:06 +0900 Subject: [PATCH 5/7] =?UTF-8?q?=EB=B6=84=EC=84=9D=EA=B2=B0=EA=B3=BC=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inference/dto/InferenceResultDto.java | 6 ++-- .../entity/MapSheetAnalSttcEntity.java | 22 ++++---------- .../entity/MapSheetAnalSttcEntityId.java | 30 +++++++++++++++++-- .../InferenceResultRepositoryImpl.java | 14 ++++++++- .../ChangeDetectionRepositoryImpl.java | 6 ++-- 5 files changed, 53 insertions(+), 25 deletions(-) diff --git a/src/main/java/com/kamco/cd/kamcoback/inference/dto/InferenceResultDto.java b/src/main/java/com/kamco/cd/kamcoback/inference/dto/InferenceResultDto.java index 98c80c31..e093b8c3 100644 --- a/src/main/java/com/kamco/cd/kamcoback/inference/dto/InferenceResultDto.java +++ b/src/main/java/com/kamco/cd/kamcoback/inference/dto/InferenceResultDto.java @@ -148,11 +148,13 @@ public class InferenceResultDto { @Getter public static class Dashboard { + String classAfterCd; String classAfterName; Long classAfterCnt; - public Dashboard(String classAfterName, Long classAfterCnt) { - this.classAfterName = classAfterName; + public Dashboard(String classAfterCd, Long classAfterCnt) { + this.classAfterCd = classAfterCd; + this.classAfterName = DetectionClassification.fromString(classAfterCd).getDesc(); this.classAfterCnt = classAfterCnt; } } diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/entity/MapSheetAnalSttcEntity.java b/src/main/java/com/kamco/cd/kamcoback/postgres/entity/MapSheetAnalSttcEntity.java index b25a386c..ca43c9c8 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/entity/MapSheetAnalSttcEntity.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/entity/MapSheetAnalSttcEntity.java @@ -5,8 +5,7 @@ import jakarta.persistence.EmbeddedId; import jakarta.persistence.Entity; import jakarta.persistence.Table; import jakarta.validation.constraints.NotNull; -import jakarta.validation.constraints.Size; -import java.time.ZonedDateTime; +import java.time.OffsetDateTime; import lombok.Getter; import lombok.Setter; import org.hibernate.annotations.ColumnDefault; @@ -19,24 +18,22 @@ public class MapSheetAnalSttcEntity { @EmbeddedId private MapSheetAnalSttcEntityId id; - @ColumnDefault("0") @Column(name = "class_before_cnt") private Long classBeforeCnt; - @ColumnDefault("0") @Column(name = "class_after_cnt") private Long classAfterCnt; @ColumnDefault("now()") @Column(name = "created_dttm") - private ZonedDateTime createdDttm; + private OffsetDateTime createdDttm; @Column(name = "created_uid") private Long createdUid; @ColumnDefault("now()") @Column(name = "updated_dttm") - private ZonedDateTime updatedDttm; + private OffsetDateTime updatedDttm; @Column(name = "updated_uid") private Long updatedUid; @@ -45,15 +42,6 @@ public class MapSheetAnalSttcEntity { @Column(name = "ref_map_sheet_num", nullable = false) private Long refMapSheetNum; - @NotNull - @Column(name = "data_uid", nullable = false) - private Long dataUid; - - @Size(max = 30) - @Column(name = "class_before_cd", length = 30) - private String classBeforeCd; - - @Size(max = 30) - @Column(name = "class_after_cd", length = 30) - private String classAfterCd; + @Column(name = "class_after_prob_avg") + private Double classAfterProbAvg; } diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/entity/MapSheetAnalSttcEntityId.java b/src/main/java/com/kamco/cd/kamcoback/postgres/entity/MapSheetAnalSttcEntityId.java index b117dcb4..3e0fd801 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/entity/MapSheetAnalSttcEntityId.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/entity/MapSheetAnalSttcEntityId.java @@ -3,18 +3,20 @@ package com.kamco.cd.kamcoback.postgres.entity; import jakarta.persistence.Column; import jakarta.persistence.Embeddable; import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import java.io.Serializable; import java.util.Objects; import lombok.Getter; import lombok.Setter; import org.hibernate.Hibernate; +import org.hibernate.annotations.ColumnDefault; @Getter @Setter @Embeddable public class MapSheetAnalSttcEntityId implements Serializable { - private static final long serialVersionUID = 2285491656408229553L; + private static final long serialVersionUID = 3649782418773406961L; @NotNull @Column(name = "compare_yyyy", nullable = false) @@ -28,6 +30,25 @@ public class MapSheetAnalSttcEntityId implements Serializable { @Column(name = "map_sheet_num", nullable = false) private Long mapSheetNum; + @NotNull + @Column(name = "data_uid", nullable = false) + private Long dataUid; + + @Size(max = 30) + @NotNull + @ColumnDefault("NULL") + @Column(name = "class_before_cd", nullable = false, length = 30) + private String classBeforeCd; + + @Size(max = 30) + @NotNull + @ColumnDefault("NULL") + @Column(name = "class_after_cd", nullable = false, length = 30) + private String classAfterCd; + + @Column(name = "anal_uid") + private Long analUid; + @Override public boolean equals(Object o) { if (this == o) { @@ -38,12 +59,17 @@ public class MapSheetAnalSttcEntityId implements Serializable { } MapSheetAnalSttcEntityId entity = (MapSheetAnalSttcEntityId) o; return Objects.equals(this.targetYyyy, entity.targetYyyy) + && Objects.equals(this.analUid, entity.analUid) + && Objects.equals(this.dataUid, entity.dataUid) + && Objects.equals(this.classAfterCd, entity.classAfterCd) && Objects.equals(this.compareYyyy, entity.compareYyyy) + && Objects.equals(this.classBeforeCd, entity.classBeforeCd) && Objects.equals(this.mapSheetNum, entity.mapSheetNum); } @Override public int hashCode() { - return Objects.hash(targetYyyy, compareYyyy, mapSheetNum); + return Objects.hash( + targetYyyy, analUid, dataUid, classAfterCd, compareYyyy, classBeforeCd, mapSheetNum); } } diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryImpl.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryImpl.java index d0dcc62f..20805b51 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryImpl.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryImpl.java @@ -6,6 +6,7 @@ import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.SearchGeoReq; import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataEntity; import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataGeomEntity; import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalEntity; +import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalSttcEntity; import com.kamco.cd.kamcoback.postgres.entity.QModelMngEntity; import com.kamco.cd.kamcoback.postgres.entity.QModelVerEntity; import com.querydsl.core.BooleanBuilder; @@ -34,6 +35,8 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC QMapSheetAnalDataEntity.mapSheetAnalDataEntity; private final QMapSheetAnalDataGeomEntity mapSheetAnalDataGeomEntity = QMapSheetAnalDataGeomEntity.mapSheetAnalDataGeomEntity; + private final QMapSheetAnalSttcEntity mapSheetAnalSttcEntity = + QMapSheetAnalSttcEntity.mapSheetAnalSttcEntity; /** * 분석결과 목록 조회 @@ -143,7 +146,16 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC */ @Override public List getDashboard(Long id) { - return null; + return queryFactory + .select( + Projections.constructor( + Dashboard.class, + mapSheetAnalSttcEntity.id.classAfterCd, + mapSheetAnalSttcEntity.classAfterCnt.sum())) + .from(mapSheetAnalSttcEntity) + .where(mapSheetAnalSttcEntity.id.analUid.eq(id)) + .groupBy(mapSheetAnalSttcEntity.id.classAfterCd) + .fetch(); } /** diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/changedetection/ChangeDetectionRepositoryImpl.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/changedetection/ChangeDetectionRepositoryImpl.java index a2e32780..23fe7055 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/changedetection/ChangeDetectionRepositoryImpl.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/changedetection/ChangeDetectionRepositoryImpl.java @@ -48,16 +48,16 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport .select( Projections.constructor( ChangeDetectionDto.CountDto.class, - mapSheetAnalSttcEntity.classAfterCd.toUpperCase(), + mapSheetAnalSttcEntity.id.classAfterCd.toUpperCase(), null, // TOOD classAfterName 삭제해서 수정 필요 mapSheetAnalSttcEntity.classAfterCnt.sum())) .from(mapSheetAnalEntity) .innerJoin(mapSheetAnalDataEntity) .on(mapSheetAnalDataEntity.analUid.eq(mapSheetAnalEntity.id)) .innerJoin(mapSheetAnalSttcEntity) - .on(mapSheetAnalSttcEntity.dataUid.eq(mapSheetAnalDataEntity.id)) + .on(mapSheetAnalSttcEntity.id.dataUid.eq(mapSheetAnalDataEntity.id)) .where(mapSheetAnalEntity.id.eq(id)) - .groupBy(mapSheetAnalSttcEntity.classAfterCd) + .groupBy(mapSheetAnalSttcEntity.id.classAfterCd) .fetch(); } From 5b9a1c494361ec3e9d0b8b2fe0765d4d44837b95 Mon Sep 17 00:00:00 2001 From: teddy Date: Fri, 28 Nov 2025 17:58:57 +0900 Subject: [PATCH 6/7] =?UTF-8?q?=EB=B6=84=EC=84=9D=EA=B2=B0=EA=B3=BC=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/Inference/InferenceResultRepositoryImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryImpl.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryImpl.java index 20805b51..603766cc 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryImpl.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryImpl.java @@ -155,6 +155,7 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC .from(mapSheetAnalSttcEntity) .where(mapSheetAnalSttcEntity.id.analUid.eq(id)) .groupBy(mapSheetAnalSttcEntity.id.classAfterCd) + .orderBy(mapSheetAnalSttcEntity.id.classAfterCd.asc()) .fetch(); } From 55564cfce662604fe5be19108b4d8d08a365a3a7 Mon Sep 17 00:00:00 2001 From: "gayoun.park" Date: Fri, 28 Nov 2025 18:05:36 +0900 Subject: [PATCH 7/7] =?UTF-8?q?=EB=B3=80=ED=99=94=ED=83=90=EC=A7=80=20API?= =?UTF-8?q?=20=EC=BB=A4=EB=B0=8B,=20=EC=97=90=EB=9F=AC=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=20=EC=A7=84=ED=96=89=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChangeDetectionApiController.java | 36 +++++++-- .../dto/ChangeDetectionDto.java | 39 ++++----- .../service/ChangeDetectionService.java | 19 ++++- .../common/enums/DetectionClassification.java | 10 +++ .../kamcoback/log/ErrorLogApiController.java | 17 ++-- .../cd/kamcoback/log/dto/ErrorLogDto.java | 43 +++------- .../core/ChangeDetectionCoreService.java | 40 +++++++++- .../DemoLearningAnalysisSceneItemEntity.java | 34 ++++++++ .../ChangeDetectionRepositoryCustom.java | 10 ++- .../ChangeDetectionRepositoryImpl.java | 79 ++++++++++++++++++- .../log/ErrorLogRepositoryImpl.java | 5 +- 11 files changed, 259 insertions(+), 73 deletions(-) create mode 100644 src/main/java/com/kamco/cd/kamcoback/postgres/entity/DemoLearningAnalysisSceneItemEntity.java diff --git a/src/main/java/com/kamco/cd/kamcoback/changedetection/ChangeDetectionApiController.java b/src/main/java/com/kamco/cd/kamcoback/changedetection/ChangeDetectionApiController.java index 01e6ab03..b1bf71a0 100644 --- a/src/main/java/com/kamco/cd/kamcoback/changedetection/ChangeDetectionApiController.java +++ b/src/main/java/com/kamco/cd/kamcoback/changedetection/ChangeDetectionApiController.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.*; @Tag(name = "변화탐지", description = "변화탐지 API") @RequiredArgsConstructor @RestController -@RequestMapping("/api/change-detection") +@RequestMapping({"/api/change-detection", "/demo/api/change-detection"}) @Transactional public class ChangeDetectionApiController { @@ -41,11 +41,12 @@ public class ChangeDetectionApiController { } @Operation(summary = "변화탐지 분류별 건수", description = "변화탐지 분류별 건수") - @GetMapping("/class-count/{id}") + @GetMapping("/class-count") public ApiResponseDto> getChangeDetectionClassCount( - @Parameter(description = "변화탐지 년도(차수) /year-list 의 analUid", example = "1") @PathVariable - Long id) { - return ApiResponseDto.ok(changeDetectionService.getChangeDetectionClassCount(id)); + @Parameter(description = "변화탐지 년도(차수) /year-list 의 analUid", example = "1") @RequestParam + Long id, + @Parameter(description = "탐지된 도엽번호", example = "34602060") @RequestParam String mapSheetNum) { + return ApiResponseDto.ok(changeDetectionService.getChangeDetectionClassCount(id, mapSheetNum)); } @Operation(summary = "변화탐지 COG Url", description = "변화탐지 COG Url") @@ -64,4 +65,29 @@ public class ChangeDetectionApiController { public ApiResponseDto> getChangeDetectionYearList() { return ApiResponseDto.ok(changeDetectionService.getChangeDetectionYearList()); } + + @Operation(summary = "변화탐지 탐지된 도엽 목록", description = "변화탐지 탐지된 도엽 목록") + @GetMapping("/map-list") + public ApiResponseDto> getChangeDetectionMapSheetList( + @Parameter(description = "년도목록 id", example = "1") @RequestParam Long analUid) { + return ApiResponseDto.ok(changeDetectionService.getChangeDetectionMapSheetList(analUid)); + } + + @Operation(summary = "변화탐지 결과 Polygon", description = "변화탐지 결과 Polygon") + @GetMapping("/polygon") + public ApiResponseDto> getChangeDetectionPolygonList( + @Parameter(description = "년도목록 id", example = "1") @RequestParam Long analUid, + @Parameter(description = "도엽번호", example = "34602060") @RequestParam String mapSheetNum) { + return ApiResponseDto.ok( + changeDetectionService.getChangeDetectionPolygonList(analUid, mapSheetNum)); + } + + @Operation(summary = "변화탐지 결과 Point", description = "변화탐지 결과 Point") + @GetMapping("/point") + public ApiResponseDto> getChangeDetectionPointList( + @Parameter(description = "년도목록 id", example = "1") @RequestParam Long analUid, + @Parameter(description = "도엽번호", example = "34602060") @RequestParam String mapSheetNum) { + return ApiResponseDto.ok( + changeDetectionService.getChangeDetectionPointList(analUid, mapSheetNum)); + } } diff --git a/src/main/java/com/kamco/cd/kamcoback/changedetection/dto/ChangeDetectionDto.java b/src/main/java/com/kamco/cd/kamcoback/changedetection/dto/ChangeDetectionDto.java index fa71e98b..6fd40b2b 100644 --- a/src/main/java/com/kamco/cd/kamcoback/changedetection/dto/ChangeDetectionDto.java +++ b/src/main/java/com/kamco/cd/kamcoback/changedetection/dto/ChangeDetectionDto.java @@ -18,7 +18,6 @@ public class ChangeDetectionDto { private Long id; private Geometry polygon; private Double centroidX; - ; private Double centroidY; } @@ -68,6 +67,17 @@ public class ChangeDetectionDto { private String baseMapSheetNum; } + @Schema(name = "MapSheetList", description = "년도에 해당하는 도엽 목록") + @Getter + @Setter + @NoArgsConstructor + @AllArgsConstructor + public static class MapSheetList { + private String mapSheetNum; + private String mapSheetName; + private String alias; + } + @Schema(name = "PolygonGeometry", description = "폴리곤 리턴 객체") @Getter @Setter @@ -75,37 +85,30 @@ public class ChangeDetectionDto { @AllArgsConstructor public static class PointGeometry { private Long geoUid; - private String type; // "Point" - private Geometry coordinates; // Point 값 - private String before_class; // 기준 분류 - private String after_class; // 비교 분류 + private Geometry geometry; // Point 값 + private String classCd; // after 분류 } @Schema(name = "PolygonGeometry", description = "폴리곤 리턴 객체") @Getter - @Setter @NoArgsConstructor @AllArgsConstructor public static class PolygonGeometry { private Long geoUid; - private String type; // "MultiPolygon" - private Geometry coordinates; // Polygon 값 - private Double center_latitude; // 폴리곤 중심 위도 - private Double center_longitude; // 폴리곤 중심 경도 + private Geometry geometry; // Polygon 값 + private PolygonProperties properties; } @Schema(name = "PolygonProperties", description = "폴리곤 정보") @Getter - @Setter - @NoArgsConstructor @AllArgsConstructor public static class PolygonProperties { private Double area; // 면적 - private String before_year; // 기준년도 - private Double before_confidence; // 기준 신뢰도(확률) - private String before_class; // 기준 분류 - private String after_year; // 비교년도 - private Double after_confidence; // 비교 신뢰도(확률) - private String after_class; // 비교 분류 + private Integer beforeYear; // 기준년도 + private Double beforeConfidence; // 기준 신뢰도(확률) + private String beforeClass; // 기준 분류 + private Integer afterYear; // 비교년도 + private Double afterConfidence; // 비교 신뢰도(확률) + private String afterClass; // 비교 분류 } } diff --git a/src/main/java/com/kamco/cd/kamcoback/changedetection/service/ChangeDetectionService.java b/src/main/java/com/kamco/cd/kamcoback/changedetection/service/ChangeDetectionService.java index 929b93e0..0fb8f5f7 100644 --- a/src/main/java/com/kamco/cd/kamcoback/changedetection/service/ChangeDetectionService.java +++ b/src/main/java/com/kamco/cd/kamcoback/changedetection/service/ChangeDetectionService.java @@ -21,8 +21,9 @@ public class ChangeDetectionService { return changeDetectionCoreService.getPolygonToJson(); } - public List getChangeDetectionClassCount(Long id) { - return changeDetectionCoreService.getChangeDetectionClassCount(id); + public List getChangeDetectionClassCount( + Long id, String mapSheetNum) { + return changeDetectionCoreService.getChangeDetectionClassCount(id, mapSheetNum); } public ChangeDetectionDto.CogUrlDto getChangeDetectionCogUrl(ChangeDetectionDto.CogUrlReq req) { @@ -32,4 +33,18 @@ public class ChangeDetectionService { public List getChangeDetectionYearList() { return changeDetectionCoreService.getChangeDetectionYearList(); } + + public List getChangeDetectionPolygonList( + Long analUid, String mapSheetNum) { + return changeDetectionCoreService.getChangeDetectionPolygonList(analUid, mapSheetNum); + } + + public List getChangeDetectionPointList( + Long analUid, String mapSheetNum) { + return changeDetectionCoreService.getChangeDetectionPointList(analUid, mapSheetNum); + } + + public List getChangeDetectionMapSheetList(Long analUid) { + return changeDetectionCoreService.getChangeDetectionMapSheetList(analUid); + } } diff --git a/src/main/java/com/kamco/cd/kamcoback/common/enums/DetectionClassification.java b/src/main/java/com/kamco/cd/kamcoback/common/enums/DetectionClassification.java index dbc578cc..a3a2bd7c 100644 --- a/src/main/java/com/kamco/cd/kamcoback/common/enums/DetectionClassification.java +++ b/src/main/java/com/kamco/cd/kamcoback/common/enums/DetectionClassification.java @@ -41,4 +41,14 @@ public enum DetectionClassification { return ETC; } } + + /** + * Desc 한글명 get 하기 + * + * @return + */ + public static String fromStrDesc(String text) { + DetectionClassification dtf = fromString(text); + return dtf.getDesc(); + } } diff --git a/src/main/java/com/kamco/cd/kamcoback/log/ErrorLogApiController.java b/src/main/java/com/kamco/cd/kamcoback/log/ErrorLogApiController.java index 6c56e10f..dcc9670a 100644 --- a/src/main/java/com/kamco/cd/kamcoback/log/ErrorLogApiController.java +++ b/src/main/java/com/kamco/cd/kamcoback/log/ErrorLogApiController.java @@ -31,11 +31,18 @@ public class ErrorLogApiController { @RequestParam(required = false) LocalDate endDate, @RequestParam int page, @RequestParam(defaultValue = "20") int size) { - ErrorLogDto.ErrorSearchReq searchReq = - new ErrorLogDto.ErrorSearchReq( - logErrorLevel, eventType, startDate, endDate, page, size, "created_dttm,desc"); - Page result = errorLogService.findLogByError(searchReq); + try { - return ApiResponseDto.ok(result); + ErrorLogDto.ErrorSearchReq searchReq = + new ErrorLogDto.ErrorSearchReq( + logErrorLevel, eventType, startDate, endDate, page, size, "created_dttm,desc"); + Page result = errorLogService.findLogByError(searchReq); + return ApiResponseDto.ok(result); + + } catch (Exception e) { + e.printStackTrace(); + } + + return null; } } diff --git a/src/main/java/com/kamco/cd/kamcoback/log/dto/ErrorLogDto.java b/src/main/java/com/kamco/cd/kamcoback/log/dto/ErrorLogDto.java index f4e85c17..4b0f73ad 100644 --- a/src/main/java/com/kamco/cd/kamcoback/log/dto/ErrorLogDto.java +++ b/src/main/java/com/kamco/cd/kamcoback/log/dto/ErrorLogDto.java @@ -1,11 +1,8 @@ package com.kamco.cd.kamcoback.log.dto; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm; import com.kamco.cd.kamcoback.config.enums.EnumType; import io.swagger.v3.oas.annotations.media.Schema; import java.time.LocalDate; -import java.time.ZonedDateTime; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @@ -18,43 +15,21 @@ public class ErrorLogDto { @Schema(name = "ErrorLogBasic", description = "에러로그 기본 정보") @Getter + @Setter + @AllArgsConstructor public static class Basic { - @JsonIgnore private final Long id; - private final String requestId; + private final Long id; + private final String serviceName; + private final String menuNm; + private final String loginId; + private final String userName; private final EventType errorType; + private final String errorName; private final LogErrorLevel errorLevel; private final String errorCode; private final String errorMessage; - private final String stackTrace; - private final Long handlerUid; - - @JsonFormatDttm private final ZonedDateTime handledDttm; - - @JsonFormatDttm private final ZonedDateTime createdDttm; - - public Basic( - Long id, - String requestId, - EventType errorType, - LogErrorLevel errorLevel, - String errorCode, - String errorMessage, - String stackTrace, - Long handlerUid, - ZonedDateTime handledDttm, - ZonedDateTime createdDttm) { - this.id = id; - this.requestId = requestId; - this.errorType = errorType; - this.errorLevel = errorLevel; - this.errorCode = errorCode; - this.errorMessage = errorMessage; - this.stackTrace = stackTrace; - this.handlerUid = handlerUid; - this.handledDttm = handledDttm; - this.createdDttm = createdDttm; - } + private final String createDate; // to_char해서 가져옴 } @Schema(name = "ErrorSearchReq", description = "에러로그 검색 요청") diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/core/ChangeDetectionCoreService.java b/src/main/java/com/kamco/cd/kamcoback/postgres/core/ChangeDetectionCoreService.java index 56290b7a..90701b72 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/core/ChangeDetectionCoreService.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/core/ChangeDetectionCoreService.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto; +import com.kamco.cd.kamcoback.common.enums.DetectionClassification; import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataGeomEntity; import com.kamco.cd.kamcoback.postgres.repository.changedetection.ChangeDetectionRepository; import java.util.List; @@ -51,8 +52,20 @@ public class ChangeDetectionCoreService { .collect(Collectors.toList()); } - public List getChangeDetectionClassCount(Long id) { - return changeDetectionRepository.getChangeDetectionClassCount(id); + public List getChangeDetectionClassCount( + Long id, String mapSheetNum) { + List list = + changeDetectionRepository.getChangeDetectionClassCount(id, mapSheetNum); + + return list.stream() + .map( + s -> { + String classCd = String.valueOf(s.getClassCd()); + s.setClassCd(DetectionClassification.fromString(classCd).name()); + s.setClassName(DetectionClassification.fromStrDesc(classCd)); + return s; + }) + .collect(Collectors.toList()); } public ChangeDetectionDto.CogUrlDto getChangeDetectionCogUrl(ChangeDetectionDto.CogUrlReq req) { @@ -62,4 +75,27 @@ public class ChangeDetectionCoreService { public List getChangeDetectionYearList() { return changeDetectionRepository.getChangeDetectionYearList(); } + + public List getChangeDetectionPolygonList( + Long analUid, String mapSheetNum) { + return changeDetectionRepository.getChangeDetectionPolygonList(analUid, mapSheetNum); + } + + public List getChangeDetectionPointList( + Long analUid, String mapSheetNum) { + return changeDetectionRepository.getChangeDetectionPointList(analUid, mapSheetNum); + } + + public List getChangeDetectionMapSheetList(Long analUid) { + List list = + changeDetectionRepository.getChangeDetectionMapSheetList(analUid); + return list.stream() + .map( + s -> { + String name = s.getMapSheetName(); + s.setAlias(name + s.getMapSheetNum().substring(5, 8)); + return s; + }) + .collect(Collectors.toList()); + } } diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/entity/DemoLearningAnalysisSceneItemEntity.java b/src/main/java/com/kamco/cd/kamcoback/postgres/entity/DemoLearningAnalysisSceneItemEntity.java new file mode 100644 index 00000000..9fb661b9 --- /dev/null +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/entity/DemoLearningAnalysisSceneItemEntity.java @@ -0,0 +1,34 @@ +package com.kamco.cd.kamcoback.postgres.entity; + +import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm; +import jakarta.persistence.*; +import java.time.ZonedDateTime; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@Table(name = "demo_learning_analysis_scene_item") +@Entity +public class DemoLearningAnalysisSceneItemEntity { + @Id + @GeneratedValue( + strategy = GenerationType.SEQUENCE, + generator = "demo_learning_analysis_scene_item_group_item_id_gen") + @SequenceGenerator( + name = "demo_learning_analysis_scene_item_group_item_id_gen", + sequenceName = "demo_learning_analysis_scene_item_group_item_id_seq", + allocationSize = 1) + @Column(name = "group_item_id", nullable = false) + private Long id; + + @Column(name = "group_id") + private Long groupId; + + @Column(name = "fid") + private Long fid; + + @JsonFormatDttm + @Column(name = "created_dttm") + private ZonedDateTime createdDttm; +} diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/changedetection/ChangeDetectionRepositoryCustom.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/changedetection/ChangeDetectionRepositoryCustom.java index 228fa7fc..43d79c77 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/changedetection/ChangeDetectionRepositoryCustom.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/changedetection/ChangeDetectionRepositoryCustom.java @@ -9,9 +9,17 @@ public interface ChangeDetectionRepositoryCustom { List findPolygonJson(); - List getChangeDetectionClassCount(Long id); + List getChangeDetectionClassCount(Long id, String mapSheetNum); ChangeDetectionDto.CogUrlDto getChangeDetectionCogUrl(ChangeDetectionDto.CogUrlReq req); List getChangeDetectionYearList(); + + List getChangeDetectionPolygonList( + Long analUid, String mapSheetNum); + + List getChangeDetectionPointList( + Long analUid, String mapSheetNum); + + List getChangeDetectionMapSheetList(Long analUid); } diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/changedetection/ChangeDetectionRepositoryImpl.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/changedetection/ChangeDetectionRepositoryImpl.java index a2e32780..43eb2647 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/changedetection/ChangeDetectionRepositoryImpl.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/changedetection/ChangeDetectionRepositoryImpl.java @@ -1,5 +1,6 @@ package com.kamco.cd.kamcoback.postgres.repository.changedetection; +import static com.kamco.cd.kamcoback.postgres.entity.QDemoLearningAnalysisSceneItemEntity.demoLearningAnalysisSceneItemEntity; import static com.kamco.cd.kamcoback.postgres.entity.QImageryEntity.imageryEntity; import static com.kamco.cd.kamcoback.postgres.entity.QMapInkx5kEntity.mapInkx5kEntity; import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataEntity.mapSheetAnalDataEntity; @@ -13,6 +14,7 @@ import com.querydsl.core.types.Projections; import com.querydsl.core.types.dsl.CaseBuilder; import com.querydsl.core.types.dsl.Expressions; import com.querydsl.core.types.dsl.StringExpression; +import com.querydsl.jpa.JPAExpressions; import com.querydsl.jpa.impl.JPAQueryFactory; import java.util.List; import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport; @@ -43,20 +45,23 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport } @Override - public List getChangeDetectionClassCount(Long id) { + public List getChangeDetectionClassCount( + Long id, String mapSheetNum) { return queryFactory .select( Projections.constructor( ChangeDetectionDto.CountDto.class, - mapSheetAnalSttcEntity.classAfterCd.toUpperCase(), - null, // TOOD classAfterName 삭제해서 수정 필요 + mapSheetAnalSttcEntity.classAfterCd.as("classCd"), + mapSheetAnalSttcEntity.classAfterCd.as("classNm"), // 앞단 CoreService 에서 한글명으로 변환 mapSheetAnalSttcEntity.classAfterCnt.sum())) .from(mapSheetAnalEntity) .innerJoin(mapSheetAnalDataEntity) .on(mapSheetAnalDataEntity.analUid.eq(mapSheetAnalEntity.id)) .innerJoin(mapSheetAnalSttcEntity) .on(mapSheetAnalSttcEntity.dataUid.eq(mapSheetAnalDataEntity.id)) - .where(mapSheetAnalEntity.id.eq(id)) + .where( + mapSheetAnalEntity.id.eq(id), + mapSheetAnalSttcEntity.id.mapSheetNum.eq(Long.valueOf(mapSheetNum))) .groupBy(mapSheetAnalSttcEntity.classAfterCd) .fetch(); } @@ -99,6 +104,72 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport .fetch(); } + @Override + public List getChangeDetectionPolygonList( + Long analUid, String mapSheetNum) { + return queryFactory + .select( + Projections.constructor( + ChangeDetectionDto.PolygonGeometry.class, + mapSheetAnalDataGeomEntity.id, + mapSheetAnalDataGeomEntity.geom, // polygon + Projections.constructor( + ChangeDetectionDto.PolygonProperties.class, + mapSheetAnalDataGeomEntity.area, + mapSheetAnalDataGeomEntity.compareYyyy, + mapSheetAnalDataGeomEntity.classBeforeProb, + mapSheetAnalDataGeomEntity.classBeforeCd.toUpperCase(), + mapSheetAnalDataGeomEntity.targetYyyy, + mapSheetAnalDataGeomEntity.classAfterProb, + mapSheetAnalDataGeomEntity.classAfterCd.toUpperCase()))) + .from(mapSheetAnalDataGeomEntity) + .where( + mapSheetAnalDataGeomEntity.dataUid.in( + JPAExpressions.select(mapSheetAnalDataEntity.id) + .from(mapSheetAnalDataEntity) + .where(mapSheetAnalDataEntity.analUid.eq(analUid))), + mapSheetAnalDataGeomEntity.mapSheetNum.eq(Long.valueOf(mapSheetNum))) + .fetch(); + } + + @Override + public List getChangeDetectionPointList( + Long analUid, String mapSheetNum) { + return queryFactory + .select( + Projections.constructor( + ChangeDetectionDto.PointGeometry.class, + mapSheetAnalDataGeomEntity.id, + mapSheetAnalDataGeomEntity.geomCenter, // point + mapSheetAnalDataGeomEntity.classAfterCd.toUpperCase())) + .from(mapSheetAnalDataGeomEntity) + .where( + mapSheetAnalDataGeomEntity.dataUid.in( + JPAExpressions.select(mapSheetAnalDataEntity.id) + .from(mapSheetAnalDataEntity) + .where(mapSheetAnalDataEntity.analUid.eq(analUid))), + mapSheetAnalDataGeomEntity.mapSheetNum.eq(Long.valueOf(mapSheetNum))) + .fetch(); + } + + @Override + public List getChangeDetectionMapSheetList(Long analUid) { + return queryFactory + .select( + Projections.constructor( + ChangeDetectionDto.MapSheetList.class, + mapInkx5kEntity.mapidcdNo, + mapInkx5kEntity.mapidNm, + mapInkx5kEntity.mapidNm // alias 앞단 core에서 + )) + .from(demoLearningAnalysisSceneItemEntity) + .innerJoin(mapInkx5kEntity) + .on(demoLearningAnalysisSceneItemEntity.fid.eq(mapInkx5kEntity.fid.longValue())) + .where(demoLearningAnalysisSceneItemEntity.groupId.eq(analUid)) + .orderBy(mapInkx5kEntity.mapidNm.asc(), mapInkx5kEntity.mapidcdNo.asc()) + .fetch(); + } + private StringExpression makeCogUrl(Integer year) { return new CaseBuilder() .when(imageryEntity.year.eq(year)) diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/log/ErrorLogRepositoryImpl.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/log/ErrorLogRepositoryImpl.java index 854590c4..0efa6bc6 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/log/ErrorLogRepositoryImpl.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/log/ErrorLogRepositoryImpl.java @@ -43,7 +43,7 @@ public class ErrorLogRepositoryImpl extends QuerydslRepositorySupport Projections.constructor( ErrorLogDto.Basic.class, errorLogEntity.id.as("logId"), - Expressions.constant("한국자산관리공사"), // serviceName + Expressions.stringTemplate("{0}", "한국자산관리공사"), // serviceName menuEntity.menuNm.as("menuName"), userEntity.userId.as("loginId"), userEntity.userNm.as("userName"), @@ -54,7 +54,8 @@ public class ErrorLogRepositoryImpl extends QuerydslRepositorySupport errorLogEntity.errorCode.as("errorCode"), errorLogEntity.errorMessage.as("errorMessage"), errorLogEntity.stackTrace.as("errorDetail"), - errorLogEntity.createdDate)) + Expressions.stringTemplate( + "to_char({0}, 'YYYY-MM-DD')", errorLogEntity.createdDate))) .from(errorLogEntity) .leftJoin(auditLogEntity) .on(errorLogEntity.id.eq(auditLogEntity.errorLogUid))