api scene
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
package com.kamco.cd.kamcoback.common.enums;
|
package com.kamco.cd.kamcoback.common.enums;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.common.enums.ApiConfigEnum.EnumDto;
|
||||||
|
import com.kamco.cd.kamcoback.common.utils.enums.CodeExpose;
|
||||||
import com.kamco.cd.kamcoback.common.utils.enums.EnumType;
|
import com.kamco.cd.kamcoback.common.utils.enums.EnumType;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -11,18 +13,19 @@ import lombok.Getter;
|
|||||||
* <p>This enum represents whether a resource is active, excluded from processing, or inactive. It
|
* <p>This enum represents whether a resource is active, excluded from processing, or inactive. It
|
||||||
* is commonly used for filtering, business rules, and status management.
|
* is commonly used for filtering, business rules, and status management.
|
||||||
*/
|
*/
|
||||||
|
@CodeExpose
|
||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum CommonUseStatus implements EnumType {
|
public enum CommonUseStatus implements EnumType {
|
||||||
|
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
USE("USE", "Active", 100)
|
USE("USE", "사용중", 100)
|
||||||
/** Actively used and available */
|
/** Actively used and available */
|
||||||
,
|
,
|
||||||
EXCEPT("EXCEPT", "Excluded", 200)
|
EXCEPT("EXCEPT", "영구 추론제외", 200)
|
||||||
/** Explicitly excluded from use or processing */
|
/** Explicitly excluded from use or processing */
|
||||||
,
|
,
|
||||||
NOT_USE("NOT_USE", "Inactive", 999)
|
NOT_USE("NOT_USE", "사용안", 999)
|
||||||
/** Not used or disabled */
|
/** Not used or disabled */
|
||||||
;
|
;
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
@@ -37,4 +40,8 @@ public enum CommonUseStatus implements EnumType {
|
|||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(CommonUseStatus.NOT_USE);
|
.orElse(CommonUseStatus.NOT_USE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EnumDto<CommonUseStatus> getEnumDto() {
|
||||||
|
return new EnumDto<>(this, this.id, this.text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.kamco.cd.kamcoback.postgres.entity.MapInkx5kEntity;
|
|||||||
import com.kamco.cd.kamcoback.postgres.repository.scene.MapInkx50kRepository;
|
import com.kamco.cd.kamcoback.postgres.repository.scene.MapInkx50kRepository;
|
||||||
import com.kamco.cd.kamcoback.postgres.repository.scene.MapInkx5kRepository;
|
import com.kamco.cd.kamcoback.postgres.repository.scene.MapInkx5kRepository;
|
||||||
import com.kamco.cd.kamcoback.scene.dto.MapInkxMngDto;
|
import com.kamco.cd.kamcoback.scene.dto.MapInkxMngDto;
|
||||||
|
import com.kamco.cd.kamcoback.scene.dto.MapInkxMngDto.MapListEntity;
|
||||||
import com.kamco.cd.kamcoback.scene.dto.MapInkxMngDto.UseInferReq;
|
import com.kamco.cd.kamcoback.scene.dto.MapInkxMngDto.UseInferReq;
|
||||||
import jakarta.persistence.EntityNotFoundException;
|
import jakarta.persistence.EntityNotFoundException;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
@@ -101,4 +102,11 @@ public class MapInkxMngCoreService {
|
|||||||
|
|
||||||
return getScene5k.toEntity();
|
return getScene5k.toEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Page<MapListEntity> getSceneListByPage(
|
||||||
|
CommonUseStatus useInference, String searchVal, MapInkxMngDto.searchReq searchReq) {
|
||||||
|
return mapInkx5kRepository
|
||||||
|
.getSceneListByPage(useInference, searchVal, searchReq)
|
||||||
|
.map(MapInkx5kEntity::toDto);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.entity;
|
package com.kamco.cd.kamcoback.postgres.entity;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.MapSheet;
|
||||||
import com.kamco.cd.kamcoback.postgres.CommonDateEntity;
|
import com.kamco.cd.kamcoback.postgres.CommonDateEntity;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
@@ -46,4 +47,8 @@ public class MapInkx50kEntity extends CommonDateEntity {
|
|||||||
this.mapidNo = mapidNo;
|
this.mapidNo = mapidNo;
|
||||||
this.geom = geom;
|
this.geom = geom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MapSheet toEntity() {
|
||||||
|
return new MapSheet(mapidcdNo, mapidNm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.kamco.cd.kamcoback.common.enums.CommonUseStatus;
|
|||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.MapSheet;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.MapSheet;
|
||||||
import com.kamco.cd.kamcoback.postgres.CommonDateEntity;
|
import com.kamco.cd.kamcoback.postgres.CommonDateEntity;
|
||||||
|
import com.kamco.cd.kamcoback.scene.dto.MapInkxMngDto.MapListEntity;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.EnumType;
|
import jakarta.persistence.EnumType;
|
||||||
@@ -73,4 +74,14 @@ public class MapInkx5kEntity extends CommonDateEntity {
|
|||||||
public InferenceResultDto.MapSheet toEntity() {
|
public InferenceResultDto.MapSheet toEntity() {
|
||||||
return new MapSheet(mapidcdNo, mapidNm);
|
return new MapSheet(mapidcdNo, mapidNm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MapListEntity toDto() {
|
||||||
|
return MapListEntity.builder()
|
||||||
|
.scene5k(this.toEntity())
|
||||||
|
.scene50k(this.mapInkx50k.toEntity())
|
||||||
|
.useInference(useInference)
|
||||||
|
.createdDttm(super.getCreatedDate())
|
||||||
|
.updatedDttm(super.getModifiedDate())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.kamco.cd.kamcoback.common.enums.CommonUseStatus;
|
|||||||
import com.kamco.cd.kamcoback.postgres.entity.MapInkx5kEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.MapInkx5kEntity;
|
||||||
import com.kamco.cd.kamcoback.scene.dto.MapInkxMngDto;
|
import com.kamco.cd.kamcoback.scene.dto.MapInkxMngDto;
|
||||||
import com.kamco.cd.kamcoback.scene.dto.MapInkxMngDto.MapList;
|
import com.kamco.cd.kamcoback.scene.dto.MapInkxMngDto.MapList;
|
||||||
|
import com.kamco.cd.kamcoback.scene.dto.MapInkxMngDto.searchReq;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
@@ -18,4 +19,7 @@ public interface MapInkx5kRepositoryCustom {
|
|||||||
Long findByMapidCdNoExists(String mapidcdNo);
|
Long findByMapidCdNoExists(String mapidcdNo);
|
||||||
|
|
||||||
Optional<MapInkx5kEntity> findByMapidCdNoInfo(String mapidcdNo);
|
Optional<MapInkx5kEntity> findByMapidCdNoInfo(String mapidcdNo);
|
||||||
|
|
||||||
|
Page<MapInkx5kEntity> getSceneListByPage(
|
||||||
|
CommonUseStatus useInference, String searchVal, searchReq searchReq);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,6 +102,31 @@ public class MapInkx5kRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
.fetchOne());
|
.fetchOne());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<MapInkx5kEntity> getSceneListByPage(
|
||||||
|
CommonUseStatus useInference, String searchVal, searchReq searchReq) {
|
||||||
|
Pageable pageable = searchReq.toPageable();
|
||||||
|
List<MapInkx5kEntity> content =
|
||||||
|
queryFactory
|
||||||
|
.selectFrom(mapInkx5kEntity)
|
||||||
|
.innerJoin(mapInkx5kEntity.mapInkx50k, mapInkx50kEntity)
|
||||||
|
.fetchJoin()
|
||||||
|
.where(searchUseInference(useInference), searchValueMapCdNm(searchVal))
|
||||||
|
.offset(pageable.getOffset())
|
||||||
|
.limit(pageable.getPageSize())
|
||||||
|
.orderBy(mapInkx5kEntity.mapidcdNo.asc())
|
||||||
|
.fetch();
|
||||||
|
Long count =
|
||||||
|
queryFactory
|
||||||
|
.select(mapInkx5kEntity.count())
|
||||||
|
.from(mapInkx5kEntity)
|
||||||
|
.innerJoin(mapInkx5kEntity.mapInkx50k, mapInkx50kEntity)
|
||||||
|
.where(searchUseInference(useInference), searchValueMapCdNm(searchVal))
|
||||||
|
.fetchOne();
|
||||||
|
|
||||||
|
return new PageImpl<>(content, pageable, count);
|
||||||
|
}
|
||||||
|
|
||||||
private BooleanExpression searchUseInference(CommonUseStatus useInference) {
|
private BooleanExpression searchUseInference(CommonUseStatus useInference) {
|
||||||
if (Objects.isNull(useInference)) {
|
if (Objects.isNull(useInference)) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package com.kamco.cd.kamcoback.scene;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.code.dto.CommonCodeDto;
|
||||||
|
import com.kamco.cd.kamcoback.common.enums.CommonUseStatus;
|
||||||
|
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
||||||
|
import com.kamco.cd.kamcoback.scene.dto.MapInkxMngDto;
|
||||||
|
import com.kamco.cd.kamcoback.scene.service.MapInkxMngService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Content;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
|
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@Tag(name = "도엽 관리", description = "도엽 관리 API")
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping("/api/v2/scene")
|
||||||
|
public class MapInkxMngApiV2Controller {
|
||||||
|
|
||||||
|
private final MapInkxMngService mapInkxMngService;
|
||||||
|
|
||||||
|
@Operation(summary = "목록 조회", description = "도엽 목록 조회")
|
||||||
|
@ApiResponses(
|
||||||
|
value = {
|
||||||
|
@ApiResponse(
|
||||||
|
responseCode = "200",
|
||||||
|
description = "조회 성공",
|
||||||
|
content =
|
||||||
|
@Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = CommonCodeDto.Basic.class))),
|
||||||
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
|
})
|
||||||
|
@GetMapping
|
||||||
|
public ApiResponseDto<Page<MapInkxMngDto.MapListEntity>> findMapInkxMngList(
|
||||||
|
@RequestParam(defaultValue = "0") int page,
|
||||||
|
@RequestParam(defaultValue = "20") int size,
|
||||||
|
@RequestParam(required = false) CommonUseStatus useInference,
|
||||||
|
@RequestParam(required = false) String searchVal) {
|
||||||
|
MapInkxMngDto.searchReq searchReq = new MapInkxMngDto.searchReq(page, size, "");
|
||||||
|
return ApiResponseDto.ok(
|
||||||
|
mapInkxMngService.findMapInkxMngLists(useInference, searchVal, searchReq));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,15 +1,17 @@
|
|||||||
package com.kamco.cd.kamcoback.scene.dto;
|
package com.kamco.cd.kamcoback.scene.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
import com.kamco.cd.kamcoback.common.enums.ApiConfigEnum.EnumDto;
|
||||||
import com.kamco.cd.kamcoback.common.enums.CommonUseStatus;
|
import com.kamco.cd.kamcoback.common.enums.CommonUseStatus;
|
||||||
import com.kamco.cd.kamcoback.common.utils.enums.CodeExpose;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||||
import com.kamco.cd.kamcoback.common.utils.enums.EnumType;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.persistence.EntityNotFoundException;
|
import jakarta.persistence.EntityNotFoundException;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@@ -19,25 +21,26 @@ import org.springframework.data.domain.Sort;
|
|||||||
|
|
||||||
public class MapInkxMngDto {
|
public class MapInkxMngDto {
|
||||||
|
|
||||||
@CodeExpose
|
// CommonUseStatus class로 통합 20251230
|
||||||
@Getter
|
// @CodeExpose
|
||||||
@AllArgsConstructor
|
// @Getter
|
||||||
public enum UseInferenceType implements EnumType {
|
// @AllArgsConstructor
|
||||||
USE("사용중"),
|
// public enum UseInferenceType implements EnumType {
|
||||||
EXCEPT("영구 추론제외");
|
// USE("사용중"),
|
||||||
|
// EXCEPT("영구 추론제외");
|
||||||
private final String desc;
|
//
|
||||||
|
// private final String desc;
|
||||||
@Override
|
//
|
||||||
public String getId() {
|
// @Override
|
||||||
return name();
|
// public String getId() {
|
||||||
}
|
// return name();
|
||||||
|
// }
|
||||||
@Override
|
//
|
||||||
public String getText() {
|
// @Override
|
||||||
return desc;
|
// public String getText() {
|
||||||
}
|
// return desc;
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
@Schema(name = "Basic", description = "Basic")
|
@Schema(name = "Basic", description = "Basic")
|
||||||
@Getter
|
@Getter
|
||||||
@@ -55,6 +58,46 @@ public class MapInkxMngDto {
|
|||||||
private ZonedDateTime updatedDttm;
|
private ZonedDateTime updatedDttm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Schema(name = "MapListEntity", description = "목록 항목")
|
||||||
|
public static class MapListEntity {
|
||||||
|
|
||||||
|
private InferenceResultDto.MapSheet scene50k;
|
||||||
|
private InferenceResultDto.MapSheet scene5k;
|
||||||
|
private CommonUseStatus useInference;
|
||||||
|
|
||||||
|
@JsonFormat(
|
||||||
|
shape = JsonFormat.Shape.STRING,
|
||||||
|
pattern = "yyyy-MM-dd'T'HH:mm:ssXXX",
|
||||||
|
timezone = "Asia/Seoul")
|
||||||
|
private ZonedDateTime createdDttm;
|
||||||
|
|
||||||
|
@JsonFormat(
|
||||||
|
shape = JsonFormat.Shape.STRING,
|
||||||
|
pattern = "yyyy-MM-dd'T'HH:mm:ssXXX",
|
||||||
|
timezone = "Asia/Seoul")
|
||||||
|
private ZonedDateTime updatedDttm;
|
||||||
|
|
||||||
|
public EnumDto<CommonUseStatus> getUseInference() {
|
||||||
|
EnumDto<CommonUseStatus> enumDto = useInference.getEnumDto();
|
||||||
|
return enumDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
public MapListEntity(
|
||||||
|
InferenceResultDto.MapSheet scene50k,
|
||||||
|
InferenceResultDto.MapSheet scene5k,
|
||||||
|
CommonUseStatus useInference,
|
||||||
|
ZonedDateTime createdDttm,
|
||||||
|
ZonedDateTime updatedDttm) {
|
||||||
|
this.scene50k = scene50k;
|
||||||
|
this.scene5k = scene5k;
|
||||||
|
this.useInference = useInference;
|
||||||
|
this.createdDttm = createdDttm;
|
||||||
|
this.updatedDttm = updatedDttm;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Schema(name = "MapList", description = "목록 항목")
|
@Schema(name = "MapList", description = "목록 항목")
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
|
|||||||
@@ -25,11 +25,18 @@ public class MapInkxMngService {
|
|||||||
|
|
||||||
private final MapInkxMngCoreService mapInkxMngCoreService;
|
private final MapInkxMngCoreService mapInkxMngCoreService;
|
||||||
|
|
||||||
|
// 도엽의 리스트 조회
|
||||||
public Page<MapList> findMapInkxMngList(
|
public Page<MapList> findMapInkxMngList(
|
||||||
MapInkxMngDto.searchReq searchReq, CommonUseStatus useInference, String searchVal) {
|
MapInkxMngDto.searchReq searchReq, CommonUseStatus useInference, String searchVal) {
|
||||||
return mapInkxMngCoreService.findMapInkxMngList(searchReq, useInference, searchVal);
|
return mapInkxMngCoreService.findMapInkxMngList(searchReq, useInference, searchVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 도엽의 리스트 조회
|
||||||
|
public Page<MapInkxMngDto.MapListEntity> findMapInkxMngLists(
|
||||||
|
CommonUseStatus useInference, String searchVal, MapInkxMngDto.searchReq searchReq) {
|
||||||
|
return mapInkxMngCoreService.getSceneListByPage(useInference, searchVal, searchReq);
|
||||||
|
}
|
||||||
|
|
||||||
public ResponseObj saveMapInkx5k(@Valid MapInkxMngDto.AddMapReq req) {
|
public ResponseObj saveMapInkx5k(@Valid MapInkxMngDto.AddMapReq req) {
|
||||||
|
|
||||||
String[] coordinates = req.getCoordinates().split("\\r?\\n");
|
String[] coordinates = req.getCoordinates().split("\\r?\\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user