학습데이터 obj-list API geojson 로직 수정
This commit is contained in:
@@ -86,26 +86,6 @@ public class DatasetApiController {
|
|||||||
return ApiResponseDto.ok(datasetService.getDatasetDetail(uuid));
|
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 = "학습데이터 제목, 메모 수정")
|
@Operation(summary = "학습데이터 수정", description = "학습데이터 제목, 메모 수정")
|
||||||
@ApiResponses(
|
@ApiResponses(
|
||||||
value = {
|
value = {
|
||||||
@@ -157,15 +137,11 @@ public class DatasetApiController {
|
|||||||
})
|
})
|
||||||
@GetMapping("/obj-list")
|
@GetMapping("/obj-list")
|
||||||
public ApiResponseDto<Page<DatasetObjDto.Basic>> searchDatasetObjectList(
|
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)
|
@RequestParam(required = true)
|
||||||
UUID uuid,
|
UUID uuid,
|
||||||
@Parameter(description = "비교년도", example = "2021") @RequestParam(required = false)
|
|
||||||
Integer compareYyyy,
|
|
||||||
@Parameter(description = "비교년도분류", example = "container") @RequestParam(required = false)
|
@Parameter(description = "비교년도분류", example = "container") @RequestParam(required = false)
|
||||||
String compareClassCd,
|
String compareClassCd,
|
||||||
@Parameter(description = "기준년도", example = "2022") @RequestParam(required = false)
|
|
||||||
Integer targetYyyy,
|
|
||||||
@Parameter(description = "기준년도분류", example = "waste") @RequestParam(required = false)
|
@Parameter(description = "기준년도분류", example = "waste") @RequestParam(required = false)
|
||||||
String targetClassCd,
|
String targetClassCd,
|
||||||
@Parameter(description = "도엽번호", example = "36713060") @RequestParam(required = false)
|
@Parameter(description = "도엽번호", example = "36713060") @RequestParam(required = false)
|
||||||
@@ -174,9 +150,7 @@ public class DatasetApiController {
|
|||||||
@RequestParam(defaultValue = "20") int size) {
|
@RequestParam(defaultValue = "20") int size) {
|
||||||
DatasetObjDto.SearchReq searchReq = new DatasetObjDto.SearchReq();
|
DatasetObjDto.SearchReq searchReq = new DatasetObjDto.SearchReq();
|
||||||
searchReq.setUuid(uuid);
|
searchReq.setUuid(uuid);
|
||||||
searchReq.setCompareYyyy(compareYyyy);
|
|
||||||
searchReq.setCompareClassCd(compareClassCd);
|
searchReq.setCompareClassCd(compareClassCd);
|
||||||
searchReq.setTargetYyyy(targetYyyy);
|
|
||||||
searchReq.setTargetClassCd(targetClassCd);
|
searchReq.setTargetClassCd(targetClassCd);
|
||||||
searchReq.setMapSheetNum(mapSheetNum);
|
searchReq.setMapSheetNum(mapSheetNum);
|
||||||
searchReq.setPage(page);
|
searchReq.setPage(page);
|
||||||
@@ -242,7 +216,7 @@ public class DatasetApiController {
|
|||||||
return ApiResponseDto.ok(datasetService.getUsableBytes());
|
return ApiResponseDto.ok(datasetService.getUsableBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "데이터셋 등록", description = "데이터셋을 등록 합니다.")
|
@Operation(summary = "학습데이터 zip파일 등록", description = "학습데이터 zip파일 등록 합니다.")
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public ApiResponseDto<ApiResponseDto.ResponseObj> insertDataset(
|
public ApiResponseDto<ApiResponseDto.ResponseObj> insertDataset(
|
||||||
@RequestBody @Valid DatasetDto.AddReq addReq) {
|
@RequestBody @Valid DatasetDto.AddReq addReq) {
|
||||||
@@ -250,7 +224,7 @@ public class DatasetApiController {
|
|||||||
return ApiResponseDto.ok(datasetService.insertDataset(addReq));
|
return ApiResponseDto.ok(datasetService.insertDataset(addReq));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "파일 Path 조회", description = "파일 Path 조회")
|
@Operation(summary = "객체별 파일 Path 조회", description = "파일 Path 조회")
|
||||||
@GetMapping("/files")
|
@GetMapping("/files")
|
||||||
public ResponseEntity<Resource> getFile(@RequestParam UUID uuid, @RequestParam String pathType)
|
public ResponseEntity<Resource> getFile(@RequestParam UUID uuid, @RequestParam String pathType)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package com.kamco.cd.training.dataset.dto;
|
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.JsonNode;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.kamco.cd.training.common.enums.DetectionClassification;
|
import com.kamco.cd.training.common.enums.DetectionClassification;
|
||||||
import com.kamco.cd.training.common.utils.interfaces.JsonFormatDttm;
|
import com.kamco.cd.training.common.utils.interfaces.JsonFormatDttm;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@@ -40,7 +43,8 @@ public class DatasetObjDto {
|
|||||||
private Long createdUid;
|
private Long createdUid;
|
||||||
private Boolean deleted;
|
private Boolean deleted;
|
||||||
private UUID uuid;
|
private UUID uuid;
|
||||||
private String geoJsonb;
|
@JsonIgnore private String geoJsonb;
|
||||||
|
private JsonNode geoJson;
|
||||||
|
|
||||||
public Basic(
|
public Basic(
|
||||||
Long objId,
|
Long objId,
|
||||||
@@ -75,6 +79,18 @@ public class DatasetObjDto {
|
|||||||
this.deleted = deleted;
|
this.deleted = deleted;
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
this.geoJsonb = geoJsonb;
|
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
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public static class SearchReq {
|
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;
|
private UUID uuid;
|
||||||
|
|
||||||
@Schema(description = "비교년도", example = "2021")
|
|
||||||
private Integer compareYyyy;
|
|
||||||
|
|
||||||
@Schema(description = "비교년도분류", example = "waste")
|
@Schema(description = "비교년도분류", example = "waste")
|
||||||
private String compareClassCd;
|
private String compareClassCd;
|
||||||
|
|
||||||
@Schema(description = "기준년도", example = "2022")
|
|
||||||
private Integer targetYyyy;
|
|
||||||
|
|
||||||
@Schema(description = "기준년도분류", example = "land")
|
@Schema(description = "기준년도분류", example = "land")
|
||||||
private String targetClassCd;
|
private String targetClassCd;
|
||||||
|
|
||||||
|
|||||||
@@ -102,12 +102,6 @@ public class DatasetObjRepositoryImpl implements DatasetObjRepositoryCustom {
|
|||||||
Pageable pageable = searchReq.toPageable();
|
Pageable pageable = searchReq.toPageable();
|
||||||
BooleanBuilder builder = new BooleanBuilder();
|
BooleanBuilder builder = new BooleanBuilder();
|
||||||
|
|
||||||
if (searchReq.getCompareYyyy() != null) {
|
|
||||||
builder.and(datasetObjEntity.compareYyyy.eq(searchReq.getCompareYyyy()));
|
|
||||||
}
|
|
||||||
if (searchReq.getTargetYyyy() != null) {
|
|
||||||
builder.and(datasetObjEntity.targetYyyy.eq(searchReq.getTargetYyyy()));
|
|
||||||
}
|
|
||||||
if (StringUtils.isNotBlank(searchReq.getCompareClassCd())) {
|
if (StringUtils.isNotBlank(searchReq.getCompareClassCd())) {
|
||||||
builder.and(datasetObjEntity.compareClassCd.eq(searchReq.getCompareClassCd()));
|
builder.and(datasetObjEntity.compareClassCd.eq(searchReq.getCompareClassCd()));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user