레이어관리 - 변화지도,라벨링툴 맵 리스트 #10

Merged
gina merged 1 commits from feat/infer_dev_260107 into develop 2026-01-29 20:56:34 +09:00
7 changed files with 184 additions and 1 deletions

View File

@@ -85,7 +85,8 @@ public class SecurityConfig {
"/api/model/file-chunk-upload",
"/api/upload/file-chunk-upload",
"/api/upload/chunk-upload-complete",
"/api/change-detection/**")
"/api/change-detection/**",
"/api/layer/map/**")
.permitAll()
// 로그인한 사용자만 가능 IAM
.requestMatchers(

View File

@@ -2,6 +2,7 @@ package com.kamco.cd.kamcoback.layer;
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
import com.kamco.cd.kamcoback.layer.dto.LayerDto;
import com.kamco.cd.kamcoback.layer.dto.LayerDto.LayerMapDto;
import com.kamco.cd.kamcoback.layer.dto.LayerDto.OrderReq;
import com.kamco.cd.kamcoback.layer.dto.LayerDto.SearchReq;
import com.kamco.cd.kamcoback.layer.service.LayerService;
@@ -187,4 +188,40 @@ public class LayerApiController {
public ApiResponseDto<List<String>> getWmsTile() {
return ApiResponseDto.ok(layerService.getWmsTitle());
}
@Operation(summary = "변화지도 레이어 조회", description = "변화지도 레이어 조회")
@ApiResponses(
value = {
@ApiResponse(
responseCode = "200",
description = "검색 성공",
content =
@Content(
mediaType = "application/json",
array = @ArraySchema(schema = @Schema(implementation = String.class)))),
@ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
@GetMapping("/map/change-detection")
public ApiResponseDto<List<LayerMapDto>> changeDetectionMap() {
return ApiResponseDto.ok(layerService.findLayerMapList("change-detection"));
}
@Operation(summary = "라벨링 툴 레이어 조회", description = "라벨링 툴 레이어 조회")
@ApiResponses(
value = {
@ApiResponse(
responseCode = "200",
description = "검색 성공",
content =
@Content(
mediaType = "application/json",
array = @ArraySchema(schema = @Schema(implementation = String.class)))),
@ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
@GetMapping("/map/labeling")
public ApiResponseDto<List<LayerMapDto>> labelingMap() {
return ApiResponseDto.ok(layerService.findLayerMapList("labeling"));
}
}

View File

@@ -1,5 +1,9 @@
package com.kamco.cd.kamcoback.layer.dto;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm;
import io.swagger.v3.oas.annotations.media.Schema;
import java.math.BigDecimal;
@@ -17,6 +21,7 @@ public class LayerDto {
@AllArgsConstructor
@Schema(name = "LayerBasic")
public static class Basic {
@Schema(description = "uuid")
private UUID uuid;
@@ -48,6 +53,7 @@ public class LayerDto {
@AllArgsConstructor
@Schema(name = "LayerDetail")
public static class Detail {
@Schema(description = "uuid")
private UUID uuid;
@@ -153,6 +159,7 @@ public class LayerDto {
@AllArgsConstructor
@NoArgsConstructor
public static class SearchReq {
private String tag;
private String layerType;
}
@@ -162,6 +169,7 @@ public class LayerDto {
@AllArgsConstructor
@NoArgsConstructor
public static class TileAddReqDto {
@Schema(description = "설명", example = "배경지도 입니다.")
private String description;
@@ -189,4 +197,89 @@ public class LayerDto {
@Schema(description = "zoom max", example = "18")
private Short max;
}
@Getter
@Setter
@Schema(name = "LayerMapDto")
public static class LayerMapDto {
@Schema(example = "WMTS", description = "유형 (TILE/GEOJSON/WMTS/WMS)")
private String layerType;
@Schema(description = "title")
private String title;
@Schema(description = "설명")
private String description;
@Schema(description = "태그")
private String tag;
@Schema(description = "순서")
private Long sortOrder;
@Schema(description = "url")
private String url;
@Schema(description = "좌측상단 경도", example = "126.0")
private BigDecimal minLon;
@Schema(description = "좌측상단 위도", example = "34.0")
private BigDecimal minLat;
@Schema(description = "우측하단 경도", example = "130.0")
private BigDecimal maxLon;
@Schema(description = "우측하단 위도", example = "38.5")
private BigDecimal maxLat;
@Schema(description = "zoom min", example = "5")
private Short minZoom;
@Schema(description = "zoom max", example = "18")
private Short maxZoom;
@Schema(description = "bbox")
private JsonNode bbox;
@JsonIgnore private String bboxGeometry;
public LayerMapDto(
String layerType,
String tag,
Long sortOrder,
String url,
BigDecimal minLon,
BigDecimal minLat,
BigDecimal maxLon,
BigDecimal maxLat,
Short minZoom,
Short maxZoom,
String bboxGeometry) {
this.layerType = layerType;
this.tag = tag;
this.sortOrder = sortOrder;
this.url = url;
this.minLon = minLon;
this.minLat = minLat;
this.maxLon = maxLon;
this.maxLat = maxLat;
this.minZoom = minZoom;
this.maxZoom = maxZoom;
this.bboxGeometry = bboxGeometry;
JsonNode geoJson = null;
if (bboxGeometry != null) {
ObjectMapper mapper = new ObjectMapper();
try {
geoJson = mapper.readTree(bboxGeometry);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
this.bbox = geoJson;
}
}
}

View File

@@ -4,6 +4,7 @@ import com.kamco.cd.kamcoback.common.enums.LayerType;
import com.kamco.cd.kamcoback.common.exception.CustomApiException;
import com.kamco.cd.kamcoback.layer.dto.LayerDto;
import com.kamco.cd.kamcoback.layer.dto.LayerDto.Basic;
import com.kamco.cd.kamcoback.layer.dto.LayerDto.LayerMapDto;
import com.kamco.cd.kamcoback.layer.dto.LayerDto.OrderReq;
import com.kamco.cd.kamcoback.layer.dto.WmsDto.WmsAddDto;
import com.kamco.cd.kamcoback.layer.dto.WmsDto.WmsAddReqDto;
@@ -159,4 +160,8 @@ public class LayerService {
addDto.setTag(dto.getTag());
return mapLayerCoreService.saveWms(addDto);
}
public List<LayerMapDto> findLayerMapList(String type) {
return mapLayerCoreService.findLayerMapList(type);
}
}

View File

@@ -6,6 +6,7 @@ import com.kamco.cd.kamcoback.common.enums.LayerType;
import com.kamco.cd.kamcoback.common.exception.CustomApiException;
import com.kamco.cd.kamcoback.common.utils.UserUtil;
import com.kamco.cd.kamcoback.layer.dto.LayerDto;
import com.kamco.cd.kamcoback.layer.dto.LayerDto.LayerMapDto;
import com.kamco.cd.kamcoback.layer.dto.LayerDto.OrderReq;
import com.kamco.cd.kamcoback.layer.dto.WmsDto.WmsAddDto;
import com.kamco.cd.kamcoback.layer.dto.WmtsDto.WmtsAddDto;
@@ -25,6 +26,7 @@ import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
public class MapLayerCoreService {
private final MapLayerRepository mapLayerRepository;
private final UserUtil userUtil;
private final ObjectMapper objectMapper;
@@ -291,4 +293,8 @@ public class MapLayerCoreService {
mapLayerEntity.setTag(addDto.getTag());
return mapLayerRepository.save(mapLayerEntity).getUuid();
}
public List<LayerMapDto> findLayerMapList(String type) {
return mapLayerRepository.findLayerMapList(type);
}
}

View File

@@ -1,6 +1,7 @@
package com.kamco.cd.kamcoback.postgres.repository.layer;
import com.kamco.cd.kamcoback.layer.dto.LayerDto;
import com.kamco.cd.kamcoback.layer.dto.LayerDto.LayerMapDto;
import com.kamco.cd.kamcoback.postgres.entity.MapLayerEntity;
import java.util.Collection;
import java.util.List;
@@ -8,6 +9,7 @@ import java.util.Optional;
import java.util.UUID;
public interface MapLayerRepositoryCustom {
Long findSortOrderDesc();
List<LayerDto.Basic> findAllLayer(LayerDto.SearchReq searchReq);
@@ -15,4 +17,6 @@ public interface MapLayerRepositoryCustom {
Optional<MapLayerEntity> findDetailByUuid(UUID uuid);
List<MapLayerEntity> findAllByUuidIn(Collection<UUID> uuids);
List<LayerMapDto> findLayerMapList(String type);
}

View File

@@ -3,9 +3,12 @@ package com.kamco.cd.kamcoback.postgres.repository.layer;
import static com.kamco.cd.kamcoback.postgres.entity.QMapLayerEntity.mapLayerEntity;
import com.kamco.cd.kamcoback.layer.dto.LayerDto;
import com.kamco.cd.kamcoback.layer.dto.LayerDto.LayerMapDto;
import com.kamco.cd.kamcoback.postgres.entity.MapLayerEntity;
import com.querydsl.core.BooleanBuilder;
import com.querydsl.core.types.Projections;
import com.querydsl.core.types.dsl.BooleanExpression;
import com.querydsl.core.types.dsl.Expressions;
import com.querydsl.jpa.impl.JPAQueryFactory;
import java.util.Collection;
import java.util.List;
@@ -84,4 +87,38 @@ public class MapLayerRepositoryImpl implements MapLayerRepositoryCustom {
.orderBy(mapLayerEntity.order.asc())
.fetch();
}
@Override
public List<LayerMapDto> findLayerMapList(String type) {
return queryFactory
.select(
Projections.constructor(
LayerMapDto.class,
mapLayerEntity.layerType,
mapLayerEntity.tag,
mapLayerEntity.order,
mapLayerEntity.url,
mapLayerEntity.minLon,
mapLayerEntity.minLat,
mapLayerEntity.maxLon,
mapLayerEntity.maxLat,
mapLayerEntity.minZoom,
mapLayerEntity.maxZoom,
Expressions.stringTemplate(
"ST_AsGeoJSON(ST_MakeEnvelope({0}, {1}, {2}, {3}, 4326))",
mapLayerEntity.minLon,
mapLayerEntity.minLat,
mapLayerEntity.maxLon,
mapLayerEntity.maxLat)))
.from(mapLayerEntity)
.where(layerTypeCondition(type), mapLayerEntity.isDeleted.isFalse())
.orderBy(mapLayerEntity.order.asc())
.fetch();
}
private BooleanExpression layerTypeCondition(String type) {
return type.equals("change-detection")
? mapLayerEntity.isChangeMap.isTrue()
: mapLayerEntity.isLabelingMap.isTrue();
}
}