diff --git a/src/main/java/com/kamco/cd/kamcoback/common/enums/CrsType.java b/src/main/java/com/kamco/cd/kamcoback/common/enums/CrsType.java new file mode 100644 index 00000000..1589f875 --- /dev/null +++ b/src/main/java/com/kamco/cd/kamcoback/common/enums/CrsType.java @@ -0,0 +1,27 @@ +package com.kamco.cd.kamcoback.common.enums; + +import com.kamco.cd.kamcoback.common.utils.enums.CodeExpose; +import com.kamco.cd.kamcoback.common.utils.enums.EnumType; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@CodeExpose +@Getter +@AllArgsConstructor +public enum CrsType implements EnumType { + EPSG_3857("korea 2000, 미터단위"), + EPSG_4326("geojson, osm기본"), + EPSG_5186("google, EPSG:900913동일"); + + private final String desc; + + @Override + public String getId() { + return name(); + } + + @Override + public String getText() { + return desc; + } +} diff --git a/src/main/java/com/kamco/cd/kamcoback/layer/dto/LayerDto.java b/src/main/java/com/kamco/cd/kamcoback/layer/dto/LayerDto.java index 4ad12d51..bcba1204 100644 --- a/src/main/java/com/kamco/cd/kamcoback/layer/dto/LayerDto.java +++ b/src/main/java/com/kamco/cd/kamcoback/layer/dto/LayerDto.java @@ -103,6 +103,9 @@ public class LayerDto { @JsonFormatDttm @Schema(description = "등록일시") private ZonedDateTime createdDttm; + + @Schema(description = "좌표계") + private String crs; } @Getter @@ -140,6 +143,9 @@ public class LayerDto { @Schema(description = "zoom max", example = "18") private Short max; + + @Schema(description = "좌표계", example = "EPSG_3857") + private String crs; } @Getter diff --git a/src/main/java/com/kamco/cd/kamcoback/layer/service/LayerService.java b/src/main/java/com/kamco/cd/kamcoback/layer/service/LayerService.java index d5a7c476..edb3994f 100644 --- a/src/main/java/com/kamco/cd/kamcoback/layer/service/LayerService.java +++ b/src/main/java/com/kamco/cd/kamcoback/layer/service/LayerService.java @@ -65,7 +65,7 @@ public class LayerService { } case GEOJSON -> { - mapLayerCoreService.saveGeoJson(dto); + return mapLayerCoreService.saveGeoJson(dto); } case WMTS -> { @@ -91,7 +91,6 @@ public class LayerService { default -> throw new CustomApiException("BAD_REQUEST", HttpStatus.BAD_REQUEST); } - return null; } /** diff --git a/src/main/java/com/kamco/cd/kamcoback/mapsheet/dto/MapSheetMngDto.java b/src/main/java/com/kamco/cd/kamcoback/mapsheet/dto/MapSheetMngDto.java index 7db50900..722a17dc 100644 --- a/src/main/java/com/kamco/cd/kamcoback/mapsheet/dto/MapSheetMngDto.java +++ b/src/main/java/com/kamco/cd/kamcoback/mapsheet/dto/MapSheetMngDto.java @@ -103,6 +103,9 @@ public class MapSheetMngDto { @Schema(description = "tag") private String tag; + @Schema(description = "crs 좌표계") + private String crs; + @JsonIgnore private Long createdUid; } diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/core/MapLayerCoreService.java b/src/main/java/com/kamco/cd/kamcoback/postgres/core/MapLayerCoreService.java index 11368382..afaca0c5 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/core/MapLayerCoreService.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/core/MapLayerCoreService.java @@ -131,6 +131,10 @@ public class MapLayerCoreService { entity.setIsLabelingMap(dto.getIsLabelingMap()); } + if (dto.getCrs() != null) { + entity.setCrs(dto.getCrs()); + } + entity.setUpdatedUid(userUtil.getId()); entity.setUpdatedDttm(ZonedDateTime.now()); } @@ -210,13 +214,7 @@ public class MapLayerCoreService { * @param dto */ public UUID saveTile(LayerDto.AddReq dto) { - LayerDto.SearchReq searchReq = new LayerDto.SearchReq(); - searchReq.setLayerType(LayerType.TILE.getId()); - List entityList = mapLayerRepository.findAllLayer(searchReq); - - if (!entityList.isEmpty()) { - throw new CustomApiException("DUPLICATE_DATA", HttpStatus.CONFLICT); - } + Long order = mapLayerRepository.findSortOrderDesc(); MapLayerEntity mapLayerEntity = new MapLayerEntity(); mapLayerEntity.setDescription(dto.getDescription()); @@ -228,11 +226,12 @@ public class MapLayerCoreService { mapLayerEntity.setMaxLat(dto.getMaxLat()); mapLayerEntity.setMinZoom(dto.getMin()); mapLayerEntity.setMaxZoom(dto.getMax()); + mapLayerEntity.setCrs(dto.getCrs()); mapLayerEntity.setCreatedUid(userUtil.getId()); mapLayerEntity.setIsChangeMap(true); - mapLayerEntity.setIsLabelingMap(false); - mapLayerEntity.setOrder(1L); + mapLayerEntity.setIsLabelingMap(true); + mapLayerEntity.setOrder(order + 1); mapLayerEntity.setLayerType(LayerType.TILE.getId()); mapLayerEntity.setUpdatedDttm(ZonedDateTime.now()); return mapLayerRepository.save(mapLayerEntity).getUuid(); @@ -255,6 +254,7 @@ public class MapLayerCoreService { mapLayerEntity.setIsChangeMap(true); mapLayerEntity.setIsLabelingMap(true); mapLayerEntity.setLayerType(LayerType.GEOJSON.getId()); + mapLayerEntity.setCrs(addDto.getCrs()); mapLayerEntity.setUpdatedDttm(ZonedDateTime.now()); mapLayerEntity.setOrder(order + 1); return mapLayerRepository.save(mapLayerEntity).getUuid(); diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/entity/MapLayerEntity.java b/src/main/java/com/kamco/cd/kamcoback/postgres/entity/MapLayerEntity.java index fe0d1d81..dead013c 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/entity/MapLayerEntity.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/entity/MapLayerEntity.java @@ -103,6 +103,9 @@ public class MapLayerEntity { @Column(name = "is_deleted") private Boolean isDeleted = false; + @Column(name = "crs") + private String crs; + public LayerDto.Detail toDto() { return new LayerDto.Detail( this.uuid, @@ -120,6 +123,7 @@ public class MapLayerEntity { this.maxLat, this.minZoom, this.maxZoom, - this.createdDttm); + this.createdDttm, + this.crs); } } diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/entity/MapSheetMngTileEntity.java b/src/main/java/com/kamco/cd/kamcoback/postgres/entity/MapSheetMngTileEntity.java index 7e2e1ebf..c3e128e9 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/entity/MapSheetMngTileEntity.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/entity/MapSheetMngTileEntity.java @@ -45,6 +45,9 @@ public class MapSheetMngTileEntity { @Column(name = "tag") private String tag; + @Column(name = "crs") + private String crs; + @NotNull @ColumnDefault("now()") @Column(name = "created_dttm", nullable = false) diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/mapsheet/MapSheetMngRepositoryImpl.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/mapsheet/MapSheetMngRepositoryImpl.java index 04118275..5b6abb1a 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/mapsheet/MapSheetMngRepositoryImpl.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/mapsheet/MapSheetMngRepositoryImpl.java @@ -1056,7 +1056,8 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport mapSheetMngTileEntity.maxLat, mapSheetMngTileEntity.minZoom, mapSheetMngTileEntity.maxZoom, - mapSheetMngTileEntity.tag) + mapSheetMngTileEntity.tag, + mapSheetMngTileEntity.crs) .values( addReq.getMngYyyy(), addReq.getUrl(), @@ -1066,7 +1067,8 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport addReq.getMaxLat(), addReq.getMinZoom(), addReq.getMaxZoom(), - addReq.getTag()) + addReq.getTag(), + addReq.getCrs()) .execute(); }