polishing

This commit is contained in:
2025-12-30 10:00:32 +09:00
parent 436bac32a3
commit 7e4f3476b3
9 changed files with 151 additions and 21 deletions

View File

@@ -1,7 +1,9 @@
package com.kamco.cd.kamcoback.postgres.core;
import com.kamco.cd.kamcoback.common.enums.CommonUseStatus;
import com.kamco.cd.kamcoback.config.api.ApiResponseDto.ApiResponseCode;
import com.kamco.cd.kamcoback.config.api.ApiResponseDto.ResponseObj;
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.MapSheet;
import com.kamco.cd.kamcoback.postgres.entity.MapInkx50kEntity;
import com.kamco.cd.kamcoback.postgres.entity.MapInkx5kEntity;
import com.kamco.cd.kamcoback.postgres.repository.scene.MapInkx50kRepository;
@@ -10,12 +12,16 @@ import com.kamco.cd.kamcoback.scene.dto.MapInkxMngDto;
import com.kamco.cd.kamcoback.scene.dto.MapInkxMngDto.UseInferReq;
import jakarta.persistence.EntityNotFoundException;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import java.util.Optional;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.locationtech.jts.geom.Polygon;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Slf4j
@Service
@RequiredArgsConstructor
public class MapInkxMngCoreService {
@@ -25,7 +31,7 @@ public class MapInkxMngCoreService {
// 목록
public Page<MapInkxMngDto.MapList> findMapInkxMngList(
MapInkxMngDto.searchReq searchReq, String useInference, String searchVal) {
MapInkxMngDto.searchReq searchReq, CommonUseStatus useInference, String searchVal) {
return mapInkx5kRepository.findMapInkxMngList(searchReq, useInference, searchVal);
}
@@ -44,15 +50,14 @@ public class MapInkxMngCoreService {
}
MapInkx5kEntity entity =
new MapInkx5kEntity(
req.getMapidcdNo(), req.getMapidNm(), map_polygon, mapInkx50k, "USE" // 기본은 USE로
);
new MapInkx5kEntity(req.getMapidcdNo(), req.getMapidNm(), map_polygon, mapInkx50k);
mapInkx5kRepository.save(entity);
return new ResponseObj(ApiResponseCode.OK, "");
}
// 도엽의 사용여부를 변경한다.
public ResponseObj updateUseInference(@Valid UseInferReq useInferReq) {
Optional<MapInkx5kEntity> entity =
Optional.ofNullable(
@@ -63,4 +68,37 @@ public class MapInkxMngCoreService {
entity.get().updateUseInference(useInferReq.getUseInference());
return new ResponseObj(ApiResponseCode.OK, "");
}
/**
* Updates the inference usage status of a given map sheet (도엽) based on the provided scene ID and
* usage status. 도엽의 사용여부를 변경한다.
*
* @param sceneId5k the unique identifier for the map sheet whose usage status is being updated
* @param useStatus the new usage status to be set for the specified map sheet
* @return a ResponseObj indicating the outcome of the operation, including a response code and
* message
* @throws EntityNotFoundException if no map sheet is found for the provided scene ID
*/
@Transactional
public MapSheet updateUseInference(
@NotNull String sceneId5k, @NotNull CommonUseStatus useStatus) {
log.debug("[updateUseInference]CHANGE_SCENE STATUS start: {}", sceneId5k);
// 5k도엽 정보를 가져온다.
MapInkx5kEntity getScene5k =
mapInkx5kRepository
.findByMapidCdNoInfo(sceneId5k)
.orElseThrow(() -> new EntityNotFoundException("도엽정보를 찾을 수 없습니다."));
log.debug(
"[updateUseInference]CHANGE_SCENE STATUS: {} |BEFORE {} |AFTER {}",
sceneId5k,
getScene5k.getUseInference(),
useStatus);
// 상태를 업데이트한다.
getScene5k.updateUseInference(useStatus);
return getScene5k.toEntity();
}
}

View File

@@ -1,10 +1,13 @@
package com.kamco.cd.kamcoback.postgres.entity;
import com.kamco.cd.kamcoback.common.enums.CommonUseStatus;
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.MapSheet;
import com.kamco.cd.kamcoback.postgres.CommonDateEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
@@ -46,23 +49,24 @@ public class MapInkx5kEntity extends CommonDateEntity {
@JoinColumn(name = "fid_k50", referencedColumnName = "fid")
private MapInkx50kEntity mapInkx50k;
// 사용상태 USE,
@Column(name = "use_inference")
private String useInference;
@Enumerated(EnumType.STRING)
private CommonUseStatus useInference;
// Constructor
public MapInkx5kEntity(
String mapidcdNo,
String mapidNm,
Geometry geom,
MapInkx50kEntity mapInkx50k,
String useInference) {
String mapidcdNo, String mapidNm, Geometry geom, MapInkx50kEntity mapInkx50k) {
this.mapidcdNo = mapidcdNo;
this.mapidNm = mapidNm;
this.geom = geom;
this.mapInkx50k = mapInkx50k;
this.useInference = useInference;
// 생성시 default 사용함 (사용,제외,사용안함)
this.useInference = CommonUseStatus.USE;
}
public void updateUseInference(String useInference) {
// 변경 사용상태 (추론사용여부)
public void updateUseInference(CommonUseStatus useInference) {
this.useInference = useInference;
}

View File

@@ -1,5 +1,6 @@
package com.kamco.cd.kamcoback.postgres.repository.scene;
import com.kamco.cd.kamcoback.common.enums.CommonUseStatus;
import com.kamco.cd.kamcoback.postgres.entity.MapInkx5kEntity;
import com.kamco.cd.kamcoback.scene.dto.MapInkxMngDto;
import com.kamco.cd.kamcoback.scene.dto.MapInkxMngDto.MapList;
@@ -12,7 +13,7 @@ public interface MapInkx5kRepositoryCustom {
List<MapInkx5kEntity> listGetScenes5k(List<String> codes);
Page<MapList> findMapInkxMngList(
MapInkxMngDto.searchReq searchReq, String useInference, String searchVal);
MapInkxMngDto.searchReq searchReq, CommonUseStatus useInference, String searchVal);
Long findByMapidCdNoExists(String mapidcdNo);

View File

@@ -3,6 +3,7 @@ package com.kamco.cd.kamcoback.postgres.repository.scene;
import static com.kamco.cd.kamcoback.postgres.entity.QMapInkx50kEntity.mapInkx50kEntity;
import static com.kamco.cd.kamcoback.postgres.entity.QMapInkx5kEntity.mapInkx5kEntity;
import com.kamco.cd.kamcoback.common.enums.CommonUseStatus;
import com.kamco.cd.kamcoback.postgres.entity.MapInkx5kEntity;
import com.kamco.cd.kamcoback.postgres.entity.QMapInkx5kEntity;
import com.kamco.cd.kamcoback.scene.dto.MapInkxMngDto;
@@ -42,7 +43,7 @@ public class MapInkx5kRepositoryImpl extends QuerydslRepositorySupport
@Override
public Page<MapList> findMapInkxMngList(
searchReq searchReq, String useInference, String searchVal) {
searchReq searchReq, CommonUseStatus useInference, String searchVal) {
Pageable pageable = searchReq.toPageable();
List<MapInkxMngDto.MapList> foundContent =
@@ -103,7 +104,7 @@ public class MapInkx5kRepositoryImpl extends QuerydslRepositorySupport
.fetchOne());
}
private BooleanExpression searchUseInference(String useInference) {
private BooleanExpression searchUseInference(CommonUseStatus useInference) {
if (Objects.isNull(useInference)) {
return null;
}