Merge pull request 'feat/dev_251201' (#117) from feat/dev_251201 into develop

Reviewed-on: https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice/pulls/117
This commit is contained in:
2025-12-29 11:11:15 +09:00
4 changed files with 20 additions and 16 deletions

View File

@@ -273,14 +273,25 @@ public class GeoToolsShpWriter implements ShpWriter {
return b.buildFeatureType();
}
/**
* .shp .shx .dbf .fix 파일 생성 (껍데기 생성)
*
* @param shpFile
* @param schema
* @return
* @throws Exception
*/
private ShapefileDataStore createDataStore(File shpFile, SimpleFeatureType schema)
throws Exception {
Map<String, Serializable> params = new HashMap<>();
params.put("url", shpFile.toURI().toURL());
params.put("create spatial index", Boolean.TRUE);
// .fix 파일 생성 Boolean.TRUE, 미생성 Boolean.FALSE
params.put("create spatial index", Boolean.FALSE);
ShapefileDataStoreFactory factory = new ShapefileDataStoreFactory();
ShapefileDataStore dataStore = (ShapefileDataStore) factory.createNewDataStore(params);
dataStore.setCharset(DBF_CHARSET);

View File

@@ -33,8 +33,10 @@ public class InferenceResultShpService {
@Transactional
public InferenceResultShpDto.FileCntDto createShpFile() {
// TODO 파일 경로는 정해지면 수정, properties 사용
String baseDir = System.getProperty("user.home") + "/export";
// TODO 배치 실행으로 변경 필요
int batchSize = 100;
int geomLimit = 500_000;
@@ -47,7 +49,7 @@ public class InferenceResultShpService {
// 재생성을 위한 생성 상태 초기화
coreService.resetForRegenerate(dataUid);
// 도형 데이터 조회
// 추론 데이터 조회
List<InferenceResultShpDto.Basic> dtoList = coreService.loadGeomDtos(dataUid, geomLimit);
if (dtoList.isEmpty()) {
continue;
@@ -64,7 +66,7 @@ public class InferenceResultShpService {
String geoJsonPath = baseDir + "/geojson/" + baseName + ".geojson";
try {
// 폴더 안 파일을 세지 않고, Writer가 "이번 호출에서 write한 개수"를 반환
// Writer가 "이번 호출에서 write한 개수"를 반환
total = total.plus(shpWriter.writeShp(shpBasePath, dtoList));
total = total.plus(shpWriter.writeGeoJson(geoJsonPath, dtoList));

View File

@@ -6,7 +6,7 @@ import java.util.List;
public interface ShpWriter {
// SHP (.shp/.shx/.dbf)
// SHP (.shp/.shx/.dbf/.fix)
WriteCnt writeShp(String shpBasePath, List<InferenceResultShpDto.Basic> rows);
// GeoJSON (.geojson)

View File

@@ -2,7 +2,6 @@ package com.kamco.cd.kamcoback.postgres.core;
import com.kamco.cd.kamcoback.config.api.ApiResponseDto.ApiResponseCode;
import com.kamco.cd.kamcoback.config.api.ApiResponseDto.ResponseObj;
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;
import com.kamco.cd.kamcoback.postgres.repository.scene.MapInkx5kRepository;
@@ -39,21 +38,13 @@ public class MapInkxMngCoreService {
}
Integer fid50k = mapInkx50kRepository.findByMapidCdParentNo(req.getMapidcdNo());
if (fid50k == null || fid50k <= 0) {
// parent도 등록
MapInkx50kEntity parent =
new MapInkx50kEntity(req.getMapidcdNo().substring(0, 5), req.getMapidNm(), "", null);
MapInkx50kEntity result = mapInkx50kRepository.save(parent);
fid50k = result.getFid();
if (fid50k == null) {
return new ResponseObj(ApiResponseCode.NOT_FOUND_DATA, "1:50,000 도엽의 정보가 없습니다. 관리자에게 문의하세요.");
}
MapInkx5kEntity entity =
new MapInkx5kEntity(
req.getMapidcdNo(),
req.getMapidNm(),
map_polygon,
fid50k == null ? null : fid50k.longValue(),
"USE" // 기본은 USE로
req.getMapidcdNo(), req.getMapidNm(), map_polygon, fid50k.longValue(), "USE" // 기본은 USE로
);
mapInkx5kRepository.save(entity);