학습데이터 obj-list API geojson 로직 수정

This commit is contained in:
2026-02-10 16:36:07 +09:00
parent 0e9fa80092
commit 025b573859
3 changed files with 21 additions and 43 deletions

View File

@@ -86,26 +86,6 @@ public class DatasetApiController {
return ApiResponseDto.ok(datasetService.getDatasetDetail(uuid));
}
@Operation(summary = "학습데이터 등록", description = "학습데이터 파일 업로드")
@ApiResponses(
value = {
@ApiResponse(
responseCode = "201",
description = "등록 성공",
content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = Long.class))),
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
@PostMapping("/register")
public ApiResponseDto<Long> registerDataset(
@RequestBody @Valid DatasetDto.RegisterReq registerReq) {
Long id = datasetService.registerDataset(registerReq);
return ApiResponseDto.createOK(id);
}
@Operation(summary = "학습데이터 수정", description = "학습데이터 제목, 메모 수정")
@ApiResponses(
value = {
@@ -157,15 +137,11 @@ public class DatasetApiController {
})
@GetMapping("/obj-list")
public ApiResponseDto<Page<DatasetObjDto.Basic>> searchDatasetObjectList(
@Parameter(description = "회차 uuid", example = "35e20bb2-9014-4c9d-abe2-9046db5f930c")
@Parameter(description = "회차 uuid", example = "e9a6774b-4f81-4402-b080-51d27fac1f01")
@RequestParam(required = true)
UUID uuid,
@Parameter(description = "비교년도", example = "2021") @RequestParam(required = false)
Integer compareYyyy,
@Parameter(description = "비교년도분류", example = "container") @RequestParam(required = false)
String compareClassCd,
@Parameter(description = "기준년도", example = "2022") @RequestParam(required = false)
Integer targetYyyy,
@Parameter(description = "기준년도분류", example = "waste") @RequestParam(required = false)
String targetClassCd,
@Parameter(description = "도엽번호", example = "36713060") @RequestParam(required = false)
@@ -174,9 +150,7 @@ public class DatasetApiController {
@RequestParam(defaultValue = "20") int size) {
DatasetObjDto.SearchReq searchReq = new DatasetObjDto.SearchReq();
searchReq.setUuid(uuid);
searchReq.setCompareYyyy(compareYyyy);
searchReq.setCompareClassCd(compareClassCd);
searchReq.setTargetYyyy(targetYyyy);
searchReq.setTargetClassCd(targetClassCd);
searchReq.setMapSheetNum(mapSheetNum);
searchReq.setPage(page);
@@ -242,7 +216,7 @@ public class DatasetApiController {
return ApiResponseDto.ok(datasetService.getUsableBytes());
}
@Operation(summary = "데이터 등록", description = "데이터셋을 등록 합니다.")
@Operation(summary = "학습데이터 zip파일 등록", description = "학습데이터 zip파일 등록 합니다.")
@PostMapping
public ApiResponseDto<ApiResponseDto.ResponseObj> insertDataset(
@RequestBody @Valid DatasetDto.AddReq addReq) {
@@ -250,7 +224,7 @@ public class DatasetApiController {
return ApiResponseDto.ok(datasetService.insertDataset(addReq));
}
@Operation(summary = "파일 Path 조회", description = "파일 Path 조회")
@Operation(summary = "객체별 파일 Path 조회", description = "파일 Path 조회")
@GetMapping("/files")
public ResponseEntity<Resource> getFile(@RequestParam UUID uuid, @RequestParam String pathType)
throws Exception {

View File

@@ -1,6 +1,9 @@
package com.kamco.cd.training.dataset.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.training.common.enums.DetectionClassification;
import com.kamco.cd.training.common.utils.interfaces.JsonFormatDttm;
import io.swagger.v3.oas.annotations.media.Schema;
@@ -40,7 +43,8 @@ public class DatasetObjDto {
private Long createdUid;
private Boolean deleted;
private UUID uuid;
private String geoJsonb;
@JsonIgnore private String geoJsonb;
private JsonNode geoJson;
public Basic(
Long objId,
@@ -75,6 +79,18 @@ public class DatasetObjDto {
this.deleted = deleted;
this.uuid = uuid;
this.geoJsonb = geoJsonb;
JsonNode geoJsonNode = null;
ObjectMapper mapper = new ObjectMapper();
if (geoJsonb != null) {
try {
geoJsonNode = mapper.readTree(geoJsonb);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
this.geoJson = geoJsonNode;
}
}
@@ -84,18 +100,12 @@ public class DatasetObjDto {
@NoArgsConstructor
@AllArgsConstructor
public static class SearchReq {
@Schema(description = "회차 uuid", example = "35e20bb2-9014-4c9d-abe2-9046db5f930c")
@Schema(description = "회차 uuid", example = "e9a6774b-4f81-4402-b080-51d27fac1f01")
private UUID uuid;
@Schema(description = "비교년도", example = "2021")
private Integer compareYyyy;
@Schema(description = "비교년도분류", example = "waste")
private String compareClassCd;
@Schema(description = "기준년도", example = "2022")
private Integer targetYyyy;
@Schema(description = "기준년도분류", example = "land")
private String targetClassCd;