feat/infer_dev_260107 #14
@@ -7,6 +7,7 @@ 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;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.ArraySchema;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -224,4 +225,12 @@ public class LayerApiController {
|
||||
public ApiResponseDto<List<LayerMapDto>> labelingMap() {
|
||||
return ApiResponseDto.ok(layerService.findLayerMapList("labeling"));
|
||||
}
|
||||
|
||||
@Operation(summary = "년도별 tile Url", description = "년도별 tile Url")
|
||||
@GetMapping("/tile-url")
|
||||
public ApiResponseDto<LayerDto.YearTileDto> getChangeDetectionTileUrl(
|
||||
@Parameter(description = "이전 년도", example = "2023") @RequestParam Integer beforeYear,
|
||||
@Parameter(description = "이후 년도", example = "2024") @RequestParam Integer afterYear) {
|
||||
return ApiResponseDto.ok(layerService.getChangeDetectionTileUrl(beforeYear, afterYear));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,6 +244,14 @@ public class LayerDto {
|
||||
|
||||
@JsonIgnore private String bboxGeometry;
|
||||
|
||||
@Schema(description = "uuid")
|
||||
private UUID uuid;
|
||||
|
||||
@JsonIgnore private String rawJsonString;
|
||||
|
||||
@Schema(description = "rawJson")
|
||||
private JsonNode rawJson;
|
||||
|
||||
public LayerMapDto(
|
||||
String layerType,
|
||||
String tag,
|
||||
@@ -255,7 +263,9 @@ public class LayerDto {
|
||||
BigDecimal maxLat,
|
||||
Short minZoom,
|
||||
Short maxZoom,
|
||||
String bboxGeometry) {
|
||||
String bboxGeometry,
|
||||
UUID uuid,
|
||||
String rawJsonString) {
|
||||
this.layerType = layerType;
|
||||
this.tag = tag;
|
||||
this.sortOrder = sortOrder;
|
||||
@@ -267,6 +277,92 @@ public class LayerDto {
|
||||
this.minZoom = minZoom;
|
||||
this.maxZoom = maxZoom;
|
||||
this.bboxGeometry = bboxGeometry;
|
||||
this.uuid = uuid;
|
||||
this.rawJsonString = rawJsonString;
|
||||
|
||||
JsonNode geoJson = null;
|
||||
JsonNode rawJson = null;
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
if (bboxGeometry != null) {
|
||||
try {
|
||||
geoJson = mapper.readTree(bboxGeometry);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (rawJsonString != null) {
|
||||
try {
|
||||
rawJson = mapper.readTree(rawJsonString);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
this.rawJson = rawJson;
|
||||
this.bbox = geoJson;
|
||||
}
|
||||
}
|
||||
|
||||
@Schema(name = "TileUrlDto", description = "Tile Url 정보")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public static class TileUrlDto {
|
||||
|
||||
@Schema(description = "mngYyyy")
|
||||
private Integer mngYyyy;
|
||||
|
||||
@Schema(description = "url")
|
||||
private String url;
|
||||
|
||||
@Schema(description = "태그")
|
||||
private String tag;
|
||||
|
||||
@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 TileUrlDto(
|
||||
Integer mngYyyy,
|
||||
String url,
|
||||
String tag,
|
||||
BigDecimal minLon,
|
||||
BigDecimal minLat,
|
||||
BigDecimal maxLon,
|
||||
BigDecimal maxLat,
|
||||
Short minZoom,
|
||||
Short maxZoom,
|
||||
String bboxGeometry) {
|
||||
this.mngYyyy = mngYyyy;
|
||||
this.url = url;
|
||||
this.tag = tag;
|
||||
this.minLon = minLon;
|
||||
this.minLat = minLat;
|
||||
this.maxLon = maxLon;
|
||||
this.maxLat = maxLat;
|
||||
this.minZoom = minZoom;
|
||||
this.maxZoom = maxZoom;
|
||||
this.bboxGeometry = bboxGeometry;
|
||||
|
||||
JsonNode geoJson = null;
|
||||
|
||||
@@ -282,4 +378,15 @@ public class LayerDto {
|
||||
this.bbox = geoJson;
|
||||
}
|
||||
}
|
||||
|
||||
@Schema(name = "TileUrlDto", description = "Tile Url 정보")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class YearTileDto {
|
||||
|
||||
private TileUrlDto before;
|
||||
private TileUrlDto after;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,4 +164,8 @@ public class LayerService {
|
||||
public List<LayerMapDto> findLayerMapList(String type) {
|
||||
return mapLayerCoreService.findLayerMapList(type);
|
||||
}
|
||||
|
||||
public LayerDto.YearTileDto getChangeDetectionTileUrl(Integer beforeYear, Integer afterYear) {
|
||||
return mapLayerCoreService.getChangeDetectionTileUrl(beforeYear, afterYear);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,4 +297,8 @@ public class MapLayerCoreService {
|
||||
public List<LayerMapDto> findLayerMapList(String type) {
|
||||
return mapLayerRepository.findLayerMapList(type);
|
||||
}
|
||||
|
||||
public LayerDto.YearTileDto getChangeDetectionTileUrl(Integer beforeYear, Integer afterYear) {
|
||||
return mapLayerRepository.getChangeDetectionTileUrl(beforeYear, afterYear);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,4 +19,6 @@ public interface MapLayerRepositoryCustom {
|
||||
List<MapLayerEntity> findAllByUuidIn(Collection<UUID> uuids);
|
||||
|
||||
List<LayerMapDto> findLayerMapList(String type);
|
||||
|
||||
LayerDto.YearTileDto getChangeDetectionTileUrl(Integer beforeYear, Integer afterYear);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.layer;
|
||||
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapLayerEntity.mapLayerEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetMngTileEntity.mapSheetMngTileEntity;
|
||||
|
||||
import com.kamco.cd.kamcoback.layer.dto.LayerDto;
|
||||
import com.kamco.cd.kamcoback.layer.dto.LayerDto.LayerMapDto;
|
||||
@@ -109,13 +110,68 @@ public class MapLayerRepositoryImpl implements MapLayerRepositoryCustom {
|
||||
mapLayerEntity.minLon,
|
||||
mapLayerEntity.minLat,
|
||||
mapLayerEntity.maxLon,
|
||||
mapLayerEntity.maxLat)))
|
||||
mapLayerEntity.maxLat),
|
||||
mapLayerEntity.uuid,
|
||||
Expressions.stringTemplate("cast({0} as text)", mapLayerEntity.rawJson)))
|
||||
.from(mapLayerEntity)
|
||||
.where(layerTypeCondition(type), mapLayerEntity.isDeleted.isFalse())
|
||||
.orderBy(mapLayerEntity.order.asc())
|
||||
.fetch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LayerDto.YearTileDto getChangeDetectionTileUrl(Integer beforeYear, Integer afterYear) {
|
||||
LayerDto.TileUrlDto before =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
LayerDto.TileUrlDto.class,
|
||||
mapSheetMngTileEntity.mngYyyy,
|
||||
mapSheetMngTileEntity.tag,
|
||||
mapSheetMngTileEntity.url,
|
||||
mapSheetMngTileEntity.minLon,
|
||||
mapSheetMngTileEntity.minLat,
|
||||
mapSheetMngTileEntity.maxLon,
|
||||
mapSheetMngTileEntity.maxLat,
|
||||
mapSheetMngTileEntity.minZoom,
|
||||
mapSheetMngTileEntity.maxZoom,
|
||||
Expressions.stringTemplate(
|
||||
"ST_AsGeoJSON(ST_MakeEnvelope({0}, {1}, {2}, {3}, 4326))",
|
||||
mapSheetMngTileEntity.minLon,
|
||||
mapSheetMngTileEntity.minLat,
|
||||
mapSheetMngTileEntity.maxLon,
|
||||
mapSheetMngTileEntity.maxLat)))
|
||||
.from(mapSheetMngTileEntity)
|
||||
.where(mapSheetMngTileEntity.mngYyyy.eq(beforeYear))
|
||||
.fetchOne();
|
||||
|
||||
LayerDto.TileUrlDto after =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
LayerDto.TileUrlDto.class,
|
||||
mapSheetMngTileEntity.mngYyyy,
|
||||
mapSheetMngTileEntity.tag,
|
||||
mapSheetMngTileEntity.url,
|
||||
mapSheetMngTileEntity.minLon,
|
||||
mapSheetMngTileEntity.minLat,
|
||||
mapSheetMngTileEntity.maxLon,
|
||||
mapSheetMngTileEntity.maxLat,
|
||||
mapSheetMngTileEntity.minZoom,
|
||||
mapSheetMngTileEntity.maxZoom,
|
||||
Expressions.stringTemplate(
|
||||
"ST_AsGeoJSON(ST_MakeEnvelope({0}, {1}, {2}, {3}, 4326))",
|
||||
mapSheetMngTileEntity.minLon,
|
||||
mapSheetMngTileEntity.minLat,
|
||||
mapSheetMngTileEntity.maxLon,
|
||||
mapSheetMngTileEntity.maxLat)))
|
||||
.from(mapSheetMngTileEntity)
|
||||
.where(mapSheetMngTileEntity.mngYyyy.eq(afterYear))
|
||||
.fetchOne();
|
||||
|
||||
return new LayerDto.YearTileDto(before, after);
|
||||
}
|
||||
|
||||
private BooleanExpression layerTypeCondition(String type) {
|
||||
return type.equals("change-detection")
|
||||
? mapLayerEntity.isChangeMap.isTrue()
|
||||
|
||||
Reference in New Issue
Block a user