Merge pull request '클래스네임 enum 추가, cors 설정 추가' (#21) from feat/demo-20251205 into develop

Reviewed-on: https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice/pulls/21
This commit is contained in:
2025-11-28 11:20:03 +09:00
5 changed files with 157 additions and 1 deletions

View File

@@ -0,0 +1,13 @@
package com.kamco.cd.kamcoback.common.api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/common")
public class CommonController {
@GetMapping("/sheets/{id}")
public void getSheetList() {}
}

View File

@@ -0,0 +1,44 @@
package com.kamco.cd.kamcoback.common.dto;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum DetectionClassification {
BUILDING("building", "빌딩"),
CONTAINER("container", "컨테이너(창고·적재함)"),
FIELD("field", "경작지 / 들판"),
FOREST("forest", ""),
GRASS("grass", "초지 / 잔디지역"),
GREENHOUSE("greenhouse", "비닐하우스"),
LAND("land", "나지"),
ORCHARD("orchard", "과수원"),
ROAD("road", "도로"),
STONE("stone", "암석 / 돌 지역"),
TANK("tank", "탱크(저유탱크 등 저장시설)"),
TUMULUS("tumulus", "고분(무덤)"),
WASTE("waste", "폐기물 적치장 / 황폐지"),
WATER("water", "수체(水域) / 물"),
ETC("ETC", "기타"); // For 'etc' (miscellaneous/other)
private final String id;
private final String desc;
/**
* Optional: Helper method to get the enum from a String, case-insensitive, or return ETC if not
* found.
*/
public static DetectionClassification fromString(String text) {
if (text == null || text.trim().isEmpty()) {
return ETC;
}
try {
return DetectionClassification.valueOf(text.toUpperCase());
} catch (IllegalArgumentException e) {
// If the string doesn't match any enum constant name, return ETC
return ETC;
}
}
}

View File

@@ -0,0 +1,44 @@
package com.kamco.cd.kamcoback.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum DetectionClassification {
BUILDING("building", "빌딩"),
CONTAINER("container", "컨테이너(창고·적재함)"),
FIELD("field", "경작지 / 들판"),
FOREST("forest", ""),
GRASS("grass", "초지 / 잔디지역"),
GREENHOUSE("greenhouse", "비닐하우스"),
LAND("land", "나지"),
ORCHARD("orchard", "과수원"),
ROAD("road", "도로"),
STONE("stone", "암석 / 돌 지역"),
TANK("tank", "탱크(저유탱크 등 저장시설)"),
TUMULUS("tumulus", "고분(무덤)"),
WASTE("waste", "폐기물 적치장 / 황폐지"),
WATER("water", "수체(水域) / 물"),
ETC("ETC", "기타"); // For 'etc' (miscellaneous/other)
private final String id;
private final String desc;
/**
* Optional: Helper method to get the enum from a String, case-insensitive, or return ETC if not
* found.
*/
public static DetectionClassification fromString(String text) {
if (text == null || text.trim().isEmpty()) {
return ETC;
}
try {
return DetectionClassification.valueOf(text.toUpperCase());
} catch (IllegalArgumentException e) {
// If the string doesn't match any enum constant name, return ETC
return ETC;
}
}
}

View File

@@ -10,9 +10,21 @@ import org.locationtech.jts.geom.Polygon;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebConfig {
public class WebConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry
.addMapping("/**") // 모든 URL 허용
.allowedOriginPatterns("*")
.allowedMethods("*")
.allowedHeaders("*")
.allowCredentials(true);
}
@Bean
public ObjectMapper objectMapper() {

View File

@@ -2,6 +2,7 @@ package com.kamco.cd.kamcoback.postgres.entity;
import jakarta.persistence.*;
import jakarta.validation.constraints.Size;
import java.time.OffsetDateTime;
import java.time.ZonedDateTime;
import lombok.Getter;
import lombok.Setter;
@@ -72,4 +73,46 @@ public class MapSheetAnalDataGeomEntity {
@Column(name = "geom", columnDefinition = "geometry")
private Geometry geom;
@Column(name = "geom_cnt")
private Long geomCnt;
@Column(name = "pnu")
private Long pnu;
@Size(max = 20)
@Column(name = "fit_state", length = 20)
private String fitState;
@Column(name = "fit_state_dttm")
private OffsetDateTime fitStateDttm;
@Column(name = "labeler_uid")
private Long labelerUid;
@Size(max = 20)
@Column(name = "label_state", length = 20)
private String labelState;
@Column(name = "label_state_dttm")
private OffsetDateTime labelStateDttm;
@Column(name = "tester_uid")
private Long testerUid;
@Size(max = 20)
@Column(name = "test_state", length = 20)
private String testState;
@Column(name = "test_state_dttm")
private OffsetDateTime testStateDttm;
@Column(name = "fit_state_cmmnt", length = Integer.MAX_VALUE)
private String fitStateCmmnt;
@Column(name = "ref_map_sheet_num", length = Integer.MAX_VALUE)
private String refMapSheetNum;
@Column(name = "geom_center", columnDefinition = "geometry")
private Geometry geomCenter;
}