변화탐지 COG URL API 로직 수정

This commit is contained in:
2026-01-20 10:55:40 +09:00
parent 9090c94611
commit d4b4ffc5e9
3 changed files with 30 additions and 2 deletions

View File

@@ -74,11 +74,16 @@ public class ChangeDetectionApiController {
@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,
@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, type, scale);
new ChangeDetectionDto.CogUrlReq(uuid, beforeYear, afterYear, mapSheetNum, type, scale);
return ApiResponseDto.ok(changeDetectionService.getChangeDetectionCogUrl(req));
}

View File

@@ -86,6 +86,7 @@ public class ChangeDetectionDto {
@AllArgsConstructor
public static class CogUrlReq {
private UUID uuid;
private Integer beforeYear;
private Integer afterYear;
private String mapSheetNum;

View File

@@ -12,6 +12,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.changedetection.dto.ChangeDetectionDto.DetectSearchType;
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;
@@ -111,6 +112,26 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
@Override
public ChangeDetectionDto.CogUrlDto getChangeDetectionCogUrl(ChangeDetectionDto.CogUrlReq req) {
String mapSheetNum = req.getMapSheetNum();
if (req.getType().equals(DetectSearchType.MAPSHEET)
&& req.getScale().equals(MapScaleType.SCALE_50K)) {
mapSheetNum =
queryFactory
.select(mapSheetAnalDataInferenceEntity.mapSheetNum.stringValue())
.from(mapSheetAnalInferenceEntity)
.innerJoin(mapSheetAnalDataInferenceEntity)
.on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalDataInferenceEntity.analUid))
.where(
mapSheetAnalInferenceEntity.uuid.eq(req.getUuid()),
mapSheetAnalDataInferenceEntity
.mapSheetNum
.stringValue()
.like("%" + req.getMapSheetNum() + "%"))
.orderBy(mapSheetAnalDataInferenceEntity.mapSheetNum.asc())
.fetchFirst();
}
ChangeDetectionDto.CogUrlData data =
queryFactory
.select(
@@ -128,7 +149,7 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
.year
.eq(req.getBeforeYear())
.or(imageryEntity.year.eq(req.getAfterYear())),
imageryEntity.scene5k.eq(req.getMapSheetNum()))
imageryEntity.scene5k.eq(mapSheetNum))
.groupBy(mapInkx5kEntity.geom)
.fetchOne();
@@ -191,6 +212,7 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
.where(
mapSheetAnalInferenceEntity.uuid.eq(uuid),
mapScaleTypeAnalDataSearchExpression(scale, mapSheetNum))
.orderBy(mapSheetAnalDataInferenceGeomEntity.mapSheetNum.asc())
.fetch();
ObjectMapper mapper = new ObjectMapper();