레이어 관리 api 추가

This commit is contained in:
2026-01-27 21:14:12 +09:00
parent 1b6ed5e4cf
commit 7a932acd25
4 changed files with 34 additions and 11 deletions

View File

@@ -1,5 +1,6 @@
package com.kamco.cd.kamcoback.layer.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.List;
@@ -16,10 +17,6 @@ public class WmtsLayerInfo {
public List<ResourceUrl> resourceUrls = new ArrayList<>();
public List<Style> styles = new ArrayList<>();
public void setIdentifier(String identifier) {
this.identifier = identifier;
}
public void setTitle(String title) {
this.title = title;
}
@@ -225,6 +222,8 @@ public class WmtsLayerInfo {
private String identifier;
private String title;
@JsonProperty("default")
private boolean isDefault;
public Style() {}

View File

@@ -58,6 +58,7 @@ public class WmtsService {
*
* @param dto
*/
@Transactional
public void save(WmtsAddReqDto dto) {
// 선택한 tile 상세정보 조회
WmtsLayerInfo info = getDetail(dto.getTitle());

View File

@@ -1,5 +1,6 @@
package com.kamco.cd.kamcoback.postgres.core;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.kamco.cd.kamcoback.common.utils.UserUtil;
import com.kamco.cd.kamcoback.layer.dto.WmtsDto.WmtsAddDto;
import com.kamco.cd.kamcoback.postgres.entity.MapLayerEntity;
@@ -12,6 +13,7 @@ import org.springframework.stereotype.Service;
public class MapLayerCoreService {
private final MapLayerRepository mapLayerRepository;
private final UserUtil userUtil;
private final ObjectMapper objectMapper;
/**
* wmts 저장
@@ -20,9 +22,22 @@ public class MapLayerCoreService {
*/
public void save(WmtsAddDto addDto) {
MapLayerEntity mapLayerEntity = new MapLayerEntity();
mapLayerEntity.setTitle(addDto.getTitle());
mapLayerEntity.setDescription(addDto.getDescription());
mapLayerEntity.setCreatedUid(userUtil.getId());
try {
String rawJson = objectMapper.writeValueAsString(addDto.getWmtsLayerInfo()); // data 없는 형태로 저장
MapLayerEntity mapLayerEntity = new MapLayerEntity();
mapLayerEntity.setTitle(addDto.getTitle());
mapLayerEntity.setDescription(addDto.getDescription());
mapLayerEntity.setCreatedUid(userUtil.getId());
mapLayerEntity.setRawJson(rawJson);
mapLayerEntity.setIsChangeMap(true);
mapLayerEntity.setIsLabelingMap(true);
mapLayerEntity.setOrder(10L);
mapLayerEntity.setLayerType("WMTS");
mapLayerRepository.save(mapLayerEntity);
} catch (Exception e) {
e.printStackTrace();
}
//
}
}

View File

@@ -11,7 +11,6 @@ import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.math.BigDecimal;
import java.time.ZonedDateTime;
import java.util.Map;
import java.util.UUID;
import lombok.Getter;
import lombok.Setter;
@@ -67,9 +66,9 @@ public class MapLayerEntity {
@Column(name = "max_zoom")
private Short maxZoom;
@Column(name = "raw_json")
@Column(name = "raw_json", columnDefinition = "jsonb")
@JdbcTypeCode(SqlTypes.JSON)
private Map<String, Object> rawJson;
private String rawJson;
@NotNull
@ColumnDefault("now()")
@@ -87,4 +86,13 @@ public class MapLayerEntity {
@Column(name = "updated_uid")
private Long updatedUid;
@Column(name = "is_change_map")
private Boolean isChangeMap;
@Column(name = "is_labeling_map")
private Boolean isLabelingMap;
@Column(name = "order")
private Long order;
}