From 5b2e25da1361bb1baaa494b7eb3272328ba5e85a Mon Sep 17 00:00:00 2001 From: teddy Date: Mon, 19 Jan 2026 21:43:04 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=EC=B6=94=EB=A1=A0=EA=B2=B0=EA=B3=BC=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20=EB=8B=A4=EC=9A=B4=EB=A1=9C=EB=93=9C=20?= =?UTF-8?q?=EC=9D=B4=EB=A0=A5=20=EC=A1=B0=ED=9A=8C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../postgres/repository/log/AuditLogRepositoryImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/log/AuditLogRepositoryImpl.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/log/AuditLogRepositoryImpl.java index 30b391ca..ff72fb73 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/log/AuditLogRepositoryImpl.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/log/AuditLogRepositoryImpl.java @@ -200,7 +200,7 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport .where(whereBuilder, createdDateBetween(req.getStartDate(), req.getEndDate())) .offset(pageable.getOffset()) .limit(pageable.getPageSize()) - // .orderBy(auditLogEntity.eventEndedAt.max().desc()) + .orderBy(auditLogEntity.createdDate.desc()) .fetch(); Long countQuery = From aa6d0fe7b2be66e6543f1a7c0b8000af6e5328e7 Mon Sep 17 00:00:00 2001 From: "gayoun.park" Date: Mon, 19 Jan 2026 21:46:31 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=EB=B3=80=ED=99=94=ED=83=90=EC=A7=80=20?= =?UTF-8?q?=EA=B8=B0=ED=9A=8D=EC=95=88=EC=97=90=20=EB=A7=9E=EA=B2=8C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95,=20=ED=95=99=EC=8A=B5=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=ED=98=84=ED=99=A9=20=EC=BF=BC=EB=A6=AC=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChangeDetectionApiController.java | 74 ++++++++++++--- .../dto/ChangeDetectionDto.java | 46 +++++++++ .../service/ChangeDetectionService.java | 58 +++++++++-- .../core/ChangeDetectionCoreService.java | 32 +++---- .../ChangeDetectionRepositoryCustom.java | 15 ++- .../ChangeDetectionRepositoryImpl.java | 95 +++++++++++++++---- .../label/LabelAllocateRepositoryImpl.java | 13 ++- 7 files changed, 269 insertions(+), 64 deletions(-) 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 4b816ea4..be9cdeb0 100644 --- a/src/main/java/com/kamco/cd/kamcoback/changedetection/ChangeDetectionApiController.java +++ b/src/main/java/com/kamco/cd/kamcoback/changedetection/ChangeDetectionApiController.java @@ -2,6 +2,8 @@ package com.kamco.cd.kamcoback.changedetection; import com.fasterxml.jackson.databind.JsonNode; import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto; +import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.DetectSearchType; +import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapScaleType; import com.kamco.cd.kamcoback.changedetection.service.ChangeDetectionService; import com.kamco.cd.kamcoback.config.api.ApiResponseDto; import io.swagger.v3.oas.annotations.Hidden; @@ -10,6 +12,7 @@ import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.transaction.Transactional; import java.util.List; +import java.util.UUID; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -46,20 +49,36 @@ public class ChangeDetectionApiController { @Operation(summary = "변화탐지 분류별 건수", description = "변화탐지 분류별 건수") @GetMapping("/class-count") public ApiResponseDto> getChangeDetectionClassCount( - @Parameter(description = "변화탐지 년도(차수) /year-list 의 analUid", example = "53") @RequestParam - Long id, - @Parameter(description = "탐지된 도엽번호", example = "34602060") @RequestParam String mapSheetNum) { - return ApiResponseDto.ok(changeDetectionService.getChangeDetectionClassCount(id, mapSheetNum)); + @Parameter( + description = "변화탐지 년도(차수) /year-list 의 uuid", + example = "8584e8d4-53b3-4582-bde2-28a81495a626") + @RequestParam + UUID uuid, + @Parameter(description = "도곽/일반(MAPSHEET/ADDRESS) 검색 타입", required = true) + @RequestParam(defaultValue = "MAPSHEET") + DetectSearchType type, + @Parameter(description = "5k/50k 구분(SCALE_5K/SCALE_50K))", required = true) + @RequestParam(defaultValue = "SCALE_50K") + MapScaleType scale, + @Parameter(description = "탐지된 도엽번호", example = "35905") @RequestParam String mapSheetNum) { + return ApiResponseDto.ok( + changeDetectionService.getChangeDetectionClassCount(type, scale, uuid, mapSheetNum)); } @Operation(summary = "변화탐지 COG Url", description = "변화탐지 COG Url") @GetMapping("/cog-url") public ApiResponseDto getChangeDetectionCogUrl( + @Parameter(description = "도곽/일반(MAPSHEET/ADDRESS) 검색 타입", required = true) + @RequestParam(defaultValue = "MAPSHEET") + DetectSearchType type, + @Parameter(description = "5k/50k 구분(SCALE_5K/SCALE_50K))", required = true) + @RequestParam(defaultValue = "SCALE_50K") + MapScaleType scale, @Parameter(description = "이전 년도", example = "2023") @RequestParam Integer beforeYear, @Parameter(description = "이후 년도", example = "2024") @RequestParam Integer afterYear, @Parameter(description = "도엽번호(5k)", example = "35905086") @RequestParam String mapSheetNum) { ChangeDetectionDto.CogUrlReq req = - new ChangeDetectionDto.CogUrlReq(beforeYear, afterYear, mapSheetNum); + new ChangeDetectionDto.CogUrlReq(beforeYear, afterYear, mapSheetNum, type, scale); return ApiResponseDto.ok(changeDetectionService.getChangeDetectionCogUrl(req)); } @@ -72,25 +91,54 @@ public class ChangeDetectionApiController { @Operation(summary = "변화탐지 탐지된 도엽 목록", description = "변화탐지 탐지된 도엽 목록") @GetMapping("/map-list") public ApiResponseDto> getChangeDetectionMapSheetList( - @Parameter(description = "도엽목록 그룹id", example = "1") @RequestParam Long analUid) { - return ApiResponseDto.ok(changeDetectionService.getChangeDetectionMapSheetList(analUid)); + @Parameter(description = "도곽/일반(MAPSHEET/ADDRESS) 검색 타입", required = true) + @RequestParam(defaultValue = "MAPSHEET") + DetectSearchType type, + @Parameter(description = "5k/50k 구분(SCALE_5K/SCALE_50K))", required = true) + @RequestParam(defaultValue = "SCALE_50K") + MapScaleType scale, + @Parameter( + description = "변화탐지 년도(차수) /year-list 의 uuid", + example = "8584e8d4-53b3-4582-bde2-28a81495a626") + @RequestParam + UUID uuid) { + return ApiResponseDto.ok( + changeDetectionService.getChangeDetectionMapSheetList(type, scale, uuid)); } @Operation(summary = "변화탐지 결과 Polygon", description = "변화탐지 결과 Polygon") @GetMapping("/polygon") public ApiResponseDto getChangeDetectionPolygonList( - @Parameter(description = "년도목록 id", example = "53") @RequestParam Long analUid, - @Parameter(description = "도엽번호", example = "35905086") @RequestParam String mapSheetNum) { + @Parameter(description = "도곽/일반(MAPSHEET/ADDRESS) 검색 타입", required = true) + @RequestParam(defaultValue = "MAPSHEET") + DetectSearchType type, + @Parameter(description = "5k/50k 구분(SCALE_5K/SCALE_50K))", required = true) + @RequestParam(defaultValue = "SCALE_50K") + MapScaleType scale, + @Parameter( + description = "변화탐지 년도(차수) /year-list 의 uuid", + example = "8584e8d4-53b3-4582-bde2-28a81495a626") + UUID uuid, + @Parameter(description = "도엽번호", example = "34607") @RequestParam String mapSheetNum) { return ApiResponseDto.ok( - changeDetectionService.getChangeDetectionPolygonList(analUid, mapSheetNum)); + changeDetectionService.getChangeDetectionPolygonList(type, scale, uuid, mapSheetNum)); } @Operation(summary = "변화탐지 결과 Point", description = "변화탐지 결과 Point") @GetMapping("/point") public ApiResponseDto getChangeDetectionPointList( - @Parameter(description = "년도목록 id", example = "53") @RequestParam Long analUid, - @Parameter(description = "도엽번호", example = "35905086") @RequestParam String mapSheetNum) { + @Parameter(description = "도곽/일반(MAPSHEET/ADDRESS) 검색 타입", required = true) + @RequestParam(defaultValue = "MAPSHEET") + DetectSearchType type, + @Parameter(description = "5k/50k 구분(SCALE_5K/SCALE_50K))", required = true) + @RequestParam(defaultValue = "SCALE_50K") + MapScaleType scale, + @Parameter( + description = "변화탐지 년도(차수) /year-list 의 uuid", + example = "8584e8d4-53b3-4582-bde2-28a81495a626") + UUID uuid, + @Parameter(description = "도엽번호", example = "34607") @RequestParam String mapSheetNum) { return ApiResponseDto.ok( - changeDetectionService.getChangeDetectionPointList(analUid, mapSheetNum)); + changeDetectionService.getChangeDetectionPointList(type, scale, uuid, 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 8f546763..fb5953f9 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 @@ -1,8 +1,11 @@ package com.kamco.cd.kamcoback.changedetection.dto; import com.fasterxml.jackson.databind.JsonNode; +import com.kamco.cd.kamcoback.common.utils.enums.CodeExpose; +import com.kamco.cd.kamcoback.common.utils.enums.EnumType; import io.swagger.v3.oas.annotations.media.Schema; import java.util.List; +import java.util.UUID; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @@ -11,6 +14,46 @@ import org.locationtech.jts.geom.Geometry; public class ChangeDetectionDto { + @CodeExpose + @Getter + @AllArgsConstructor + public enum DetectSearchType implements EnumType { + MAPSHEET("도곽"), + ADDRESS("주소"); + + private String desc; + + @Override + public String getId() { + return name(); + } + + @Override + public String getText() { + return desc; + } + } + + @CodeExpose + @Getter + @AllArgsConstructor + public enum MapScaleType implements EnumType { + SCALE_5K("1:5000"), + SCALE_50K("1:50000"); + + private String desc; + + @Override + public String getId() { + return name(); + } + + @Override + public String getText() { + return desc; + } + } + @Schema(name = "TestDto", description = "테스트용") @Getter @Setter @@ -46,6 +89,8 @@ public class ChangeDetectionDto { private Integer beforeYear; private Integer afterYear; private String mapSheetNum; + private DetectSearchType type; + private MapScaleType scale; } @Schema(name = "CogUrlDto", description = "COG Url 정보") @@ -79,6 +124,7 @@ public class ChangeDetectionDto { @AllArgsConstructor public static class AnalYearList { + private UUID uuid; private Long analUid; private String analTitle; private Integer beforeYear; 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 ba3450bb..444e2d4d 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 @@ -2,8 +2,11 @@ package com.kamco.cd.kamcoback.changedetection.service; import com.fasterxml.jackson.databind.JsonNode; import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto; +import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.DetectSearchType; +import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapScaleType; import com.kamco.cd.kamcoback.postgres.core.ChangeDetectionCoreService; import java.util.List; +import java.util.UUID; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; @@ -22,8 +25,16 @@ public class ChangeDetectionService { } public List getChangeDetectionClassCount( - Long id, String mapSheetNum) { - return changeDetectionCoreService.getChangeDetectionClassCount(id, mapSheetNum); + DetectSearchType type, MapScaleType scale, UUID uuid, String mapSheetNum) { + switch (type) { + case MAPSHEET -> { + return changeDetectionCoreService.getChangeDetectionClassCount(scale, uuid, mapSheetNum); + } + case ADDRESS -> { + return List.of(); // TODO: 일반 주소 검색 로직 확인 후 작업 필요 + } + default -> throw new IllegalArgumentException("Unsupported type: " + type); + } } public ChangeDetectionDto.CogUrlDto getChangeDetectionCogUrl(ChangeDetectionDto.CogUrlReq req) { @@ -35,18 +46,47 @@ public class ChangeDetectionService { } public ChangeDetectionDto.PolygonFeatureList getChangeDetectionPolygonList( - Long analUid, String mapSheetNum) { - - return changeDetectionCoreService.getChangeDetectionPolygonList(analUid, mapSheetNum); + DetectSearchType type, MapScaleType scale, UUID uuid, String mapSheetNum) { + switch (type) { + case MAPSHEET -> { + return changeDetectionCoreService.getChangeDetectionPolygonList(scale, uuid, mapSheetNum); + } + case ADDRESS -> { + return new ChangeDetectionDto.PolygonFeatureList(); // TODO: 일반 주소 검색 로직 확인 후 작업 필요 + } + default -> throw new IllegalArgumentException("Unsupported type: " + type); + } } // Geometry 객체 순환 참조 문제로 캐싱 불가 public ChangeDetectionDto.PointFeatureList getChangeDetectionPointList( - Long analUid, String mapSheetNum) { - return changeDetectionCoreService.getChangeDetectionPointList(analUid, mapSheetNum); + DetectSearchType type, MapScaleType scale, UUID uuid, String mapSheetNum) { + + switch (type) { + case MAPSHEET -> { + return changeDetectionCoreService.getChangeDetectionPointList(scale, uuid, mapSheetNum); + } + case ADDRESS -> { + return new ChangeDetectionDto.PointFeatureList(); // TODO: 일반 주소 검색 로직 확인 후 작업 필요 + } + default -> throw new IllegalArgumentException("Unsupported type: " + type); + } } - public List getChangeDetectionMapSheetList(Long analUid) { - return changeDetectionCoreService.getChangeDetectionMapSheetList(analUid); + public List getChangeDetectionMapSheetList( + DetectSearchType type, MapScaleType scale, UUID uuid) { + switch (type) { + case MAPSHEET -> { + return switch (scale) { + case SCALE_5K -> changeDetectionCoreService.getChangeDetectionMapSheetList(uuid); + case SCALE_50K -> changeDetectionCoreService.getChangeDetectionMapSheet50kList(uuid); + default -> throw new IllegalArgumentException("Unsupported scale: " + scale); + }; + } + case ADDRESS -> { + return List.of(); // TODO: 일반 주소 검색 로직 확인 후 작업 필요 + } + default -> throw new IllegalArgumentException("Unsupported type: " + type); + } } } 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 e60bf5de..d9612056 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,10 +4,13 @@ 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.changedetection.dto.ChangeDetectionDto.MapScaleType; +import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapSheetList; import com.kamco.cd.kamcoback.common.enums.DetectionClassification; import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceGeomEntity; import com.kamco.cd.kamcoback.postgres.repository.changedetection.ChangeDetectionRepository; import java.util.List; +import java.util.UUID; import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; import org.locationtech.jts.geom.Geometry; @@ -53,9 +56,9 @@ public class ChangeDetectionCoreService { } public List getChangeDetectionClassCount( - Long id, String mapSheetNum) { + MapScaleType scale, UUID uuid, String mapSheetNum) { List list = - changeDetectionRepository.getChangeDetectionClassCount(id, mapSheetNum); + changeDetectionRepository.getChangeDetectionClassCount(scale, uuid, mapSheetNum); return list.stream() .map( @@ -77,25 +80,20 @@ public class ChangeDetectionCoreService { } public ChangeDetectionDto.PolygonFeatureList getChangeDetectionPolygonList( - Long analUid, String mapSheetNum) { - return changeDetectionRepository.getChangeDetectionPolygonList(analUid, mapSheetNum); + MapScaleType scale, UUID uuid, String mapSheetNum) { + return changeDetectionRepository.getChangeDetectionPolygonList(scale, uuid, mapSheetNum); } public ChangeDetectionDto.PointFeatureList getChangeDetectionPointList( - Long analUid, String mapSheetNum) { - return changeDetectionRepository.getChangeDetectionPointList(analUid, mapSheetNum); + MapScaleType scale, UUID uuid, String mapSheetNum) { + return changeDetectionRepository.getChangeDetectionPointList(scale, uuid, 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()); + public List getChangeDetectionMapSheetList(UUID uuid) { + return changeDetectionRepository.getChangeDetectionMapSheetList(uuid); + } + + public List getChangeDetectionMapSheet50kList(UUID uuid) { + return changeDetectionRepository.getChangeDetectionMapSheet50kList(uuid); } } 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 1efc8443..3edf367c 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 @@ -1,7 +1,10 @@ package com.kamco.cd.kamcoback.postgres.repository.changedetection; import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto; +import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapScaleType; +import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapSheetList; import java.util.List; +import java.util.UUID; public interface ChangeDetectionRepositoryCustom { @@ -9,16 +12,20 @@ public interface ChangeDetectionRepositoryCustom { List findPolygonJson(); - List getChangeDetectionClassCount(Long id, String mapSheetNum); + List getChangeDetectionClassCount( + MapScaleType scale, UUID uuid, String mapSheetNum); ChangeDetectionDto.CogUrlDto getChangeDetectionCogUrl(ChangeDetectionDto.CogUrlReq req); List getChangeDetectionYearList(); ChangeDetectionDto.PolygonFeatureList getChangeDetectionPolygonList( - Long analUid, String mapSheetNum); + MapScaleType scale, UUID uuid, String mapSheetNum); - ChangeDetectionDto.PointFeatureList getChangeDetectionPointList(Long analUid, String mapSheetNum); + ChangeDetectionDto.PointFeatureList getChangeDetectionPointList( + MapScaleType scale, UUID uuid, String mapSheetNum); - List getChangeDetectionMapSheetList(Long analUid); + List getChangeDetectionMapSheetList(UUID uuid); + + List getChangeDetectionMapSheet50kList(UUID uuid); } 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 c0f5fc37..4c8191a7 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,7 +1,7 @@ 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.QMapInkx50kEntity.mapInkx50kEntity; import static com.kamco.cd.kamcoback.postgres.entity.QMapInkx5kEntity.mapInkx5kEntity; import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceEntity.mapSheetAnalDataInferenceEntity; import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity; @@ -12,14 +12,19 @@ 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.changedetection.dto.ChangeDetectionDto.MapScaleType; +import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapSheetList; import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceGeomEntity; import com.querydsl.core.types.Projections; +import com.querydsl.core.types.dsl.BooleanExpression; 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 java.util.Objects; +import java.util.UUID; import java.util.stream.Collectors; import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport; @@ -52,7 +57,7 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport @Override public List getChangeDetectionClassCount( - Long id, String mapSheetNum) { + MapScaleType scale, UUID uuid, String mapSheetNum) { return queryFactory .select( Projections.constructor( @@ -66,12 +71,44 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport .innerJoin(mapSheetAnalSttcEntity) .on(mapSheetAnalSttcEntity.id.dataUid.eq(mapSheetAnalDataInferenceEntity.id)) .where( - mapSheetAnalInferenceEntity.id.eq(id), - mapSheetAnalSttcEntity.id.mapSheetNum.eq(Long.valueOf(mapSheetNum))) + mapSheetAnalInferenceEntity.uuid.eq(uuid), + mapScaleTypeSearchExpression(scale, mapSheetNum)) .groupBy(mapSheetAnalSttcEntity.id.classAfterCd) .fetch(); } + private BooleanExpression mapScaleTypeSearchExpression(MapScaleType scale, String mapSheetNum) { + if (scale.equals(MapScaleType.SCALE_5K)) { + return mapSheetAnalSttcEntity.id.mapSheetNum.eq(Long.valueOf(mapSheetNum)); + } else { + return mapSheetAnalSttcEntity + .id + .mapSheetNum + .stringValue() + .in( + JPAExpressions.select(mapInkx5kEntity.mapidcdNo) + .from(mapInkx5kEntity) + .innerJoin(mapInkx5kEntity.mapInkx50k, mapInkx50kEntity) + .where(mapInkx50kEntity.mapidcdNo.eq(mapSheetNum))); + } + } + + private BooleanExpression mapScaleTypeAnalDataSearchExpression( + MapScaleType scale, String mapSheetNum) { + if (scale.equals(MapScaleType.SCALE_5K)) { + return mapSheetAnalDataInferenceGeomEntity.mapSheetNum.eq(Long.valueOf(mapSheetNum)); + } else { + return mapSheetAnalDataInferenceGeomEntity + .mapSheetNum + .stringValue() + .in( + JPAExpressions.select(mapInkx5kEntity.mapidcdNo) + .from(mapInkx5kEntity) + .innerJoin(mapInkx5kEntity.mapInkx50k, mapInkx50kEntity) + .where(mapInkx50kEntity.mapidcdNo.eq(mapSheetNum))); + } + } + @Override public ChangeDetectionDto.CogUrlDto getChangeDetectionCogUrl(ChangeDetectionDto.CogUrlReq req) { ChangeDetectionDto.CogUrlData data = @@ -114,6 +151,7 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport .select( Projections.constructor( ChangeDetectionDto.AnalYearList.class, + mapSheetAnalInferenceEntity.uuid, mapSheetAnalInferenceEntity.id, mapSheetAnalInferenceEntity.analTitle, mapSheetAnalInferenceEntity.compareYyyy.as("beforeYear"), @@ -126,7 +164,7 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport @Override public ChangeDetectionDto.PolygonFeatureList getChangeDetectionPolygonList( - Long analUid, String mapSheetNum) { + MapScaleType scale, UUID uuid, String mapSheetNum) { List list = queryFactory @@ -151,8 +189,8 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport .innerJoin(mapSheetAnalInferenceEntity) .on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalDataInferenceEntity.analUid)) .where( - mapSheetAnalInferenceEntity.id.eq(analUid), - mapSheetAnalDataInferenceGeomEntity.mapSheetNum.eq(Long.valueOf(mapSheetNum))) + mapSheetAnalInferenceEntity.uuid.eq(uuid), + mapScaleTypeAnalDataSearchExpression(scale, mapSheetNum)) .fetch(); ObjectMapper mapper = new ObjectMapper(); @@ -193,7 +231,7 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport @Override public ChangeDetectionDto.PointFeatureList getChangeDetectionPointList( - Long analUid, String mapSheetNum) { + MapScaleType scale, UUID uuid, String mapSheetNum) { List list = queryFactory .select( @@ -213,8 +251,8 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport .innerJoin(mapSheetAnalInferenceEntity) .on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalDataInferenceEntity.analUid)) .where( - mapSheetAnalInferenceEntity.id.eq(analUid), - mapSheetAnalDataInferenceGeomEntity.mapSheetNum.eq(Long.valueOf(mapSheetNum))) + mapSheetAnalInferenceEntity.uuid.eq(uuid), + mapScaleTypeAnalDataSearchExpression(scale, mapSheetNum)) .fetch(); ObjectMapper mapper = new ObjectMapper(); @@ -239,20 +277,43 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport } @Override - public List getChangeDetectionMapSheetList(Long analUid) { + public List getChangeDetectionMapSheetList(UUID uuid) { return queryFactory .select( Projections.constructor( ChangeDetectionDto.MapSheetList.class, mapInkx5kEntity.mapidcdNo, mapInkx5kEntity.mapidNm, - mapInkx5kEntity.mapidNm // alias 앞단 core에서 - )) - .from(demoLearningAnalysisSceneItemEntity) + Expressions.stringTemplate( + "concat({0}, ' ', {1})", mapInkx5kEntity.mapidNm, mapInkx5kEntity.mapidcdNo))) + .from(mapSheetAnalInferenceEntity) + .innerJoin(mapSheetAnalDataInferenceEntity) + .on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalDataInferenceEntity.analUid)) .innerJoin(mapInkx5kEntity) - .on(demoLearningAnalysisSceneItemEntity.fid.eq(mapInkx5kEntity.fid.longValue())) - .where(demoLearningAnalysisSceneItemEntity.groupId.eq(analUid)) - .orderBy(mapInkx5kEntity.mapidNm.asc(), mapInkx5kEntity.mapidcdNo.asc()) + .on(mapSheetAnalDataInferenceEntity.mapSheetNum.stringValue().eq(mapInkx5kEntity.mapidcdNo)) + .where(mapSheetAnalInferenceEntity.uuid.eq(uuid)) + .orderBy(mapInkx5kEntity.mapidcdNo.asc()) + .fetch(); + } + + @Override + public List getChangeDetectionMapSheet50kList(UUID uuid) { + return queryFactory + .select( + Projections.constructor( + ChangeDetectionDto.MapSheetList.class, + mapInkx50kEntity.mapidcdNo, + mapInkx50kEntity.mapidNm, + Expressions.stringTemplate( + "concat({0}, ' ', {1})", mapInkx50kEntity.mapidNm, mapInkx50kEntity.mapidcdNo))) + .from(mapSheetAnalInferenceEntity) + .innerJoin(mapSheetAnalDataInferenceEntity) + .on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalDataInferenceEntity.analUid)) + .innerJoin(mapInkx5kEntity) + .on(mapSheetAnalDataInferenceEntity.mapSheetNum.stringValue().eq(mapInkx5kEntity.mapidcdNo)) + .innerJoin(mapInkx5kEntity.mapInkx50k, mapInkx50kEntity) + .where(mapSheetAnalInferenceEntity.uuid.eq(uuid)) + .orderBy(mapInkx5kEntity.mapidcdNo.asc()) .fetch(); } diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/label/LabelAllocateRepositoryImpl.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/label/LabelAllocateRepositoryImpl.java index a4015c2f..c340eb55 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/label/LabelAllocateRepositoryImpl.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/label/LabelAllocateRepositoryImpl.java @@ -3,6 +3,7 @@ package com.kamco.cd.kamcoback.postgres.repository.label; import static com.kamco.cd.kamcoback.postgres.entity.QLabelingAssignmentEntity.labelingAssignmentEntity; import static com.kamco.cd.kamcoback.postgres.entity.QLabelingInspectorEntity.labelingInspectorEntity; import static com.kamco.cd.kamcoback.postgres.entity.QLabelingLabelerEntity.labelingLabelerEntity; +import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceEntity.mapSheetAnalDataInferenceEntity; import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity; import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity; import static com.kamco.cd.kamcoback.postgres.entity.QMemberEntity.memberEntity; @@ -537,11 +538,15 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto labelingTargetCount = queryFactory .select(mapSheetAnalDataInferenceGeomEntity.geoUid.count()) - .from(mapSheetAnalDataInferenceGeomEntity) + .from(mapSheetAnalInferenceEntity) + .innerJoin(mapSheetAnalDataInferenceEntity) + .on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalDataInferenceEntity.analUid)) + .innerJoin(mapSheetAnalDataInferenceGeomEntity) + .on( + mapSheetAnalDataInferenceEntity.id.eq( + mapSheetAnalDataInferenceGeomEntity.dataUid)) .where( - mapSheetAnalDataInferenceGeomEntity.compareYyyy.eq(analEntity.getCompareYyyy()), - mapSheetAnalDataInferenceGeomEntity.targetYyyy.eq(analEntity.getTargetYyyy()), - mapSheetAnalDataInferenceGeomEntity.stage.eq(analEntity.getStage()), + mapSheetAnalInferenceEntity.uuid.eq(targetUuid), mapSheetAnalDataInferenceGeomEntity.pnu.gt(0L), mapSheetAnalDataInferenceGeomEntity.passYn.isFalse()) .fetchOne();