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:
@@ -273,14 +273,25 @@ public class GeoToolsShpWriter implements ShpWriter {
|
|||||||
return b.buildFeatureType();
|
return b.buildFeatureType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* .shp .shx .dbf .fix 파일 생성 (껍데기 생성)
|
||||||
|
*
|
||||||
|
* @param shpFile
|
||||||
|
* @param schema
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
private ShapefileDataStore createDataStore(File shpFile, SimpleFeatureType schema)
|
private ShapefileDataStore createDataStore(File shpFile, SimpleFeatureType schema)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
Map<String, Serializable> params = new HashMap<>();
|
Map<String, Serializable> params = new HashMap<>();
|
||||||
params.put("url", shpFile.toURI().toURL());
|
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();
|
ShapefileDataStoreFactory factory = new ShapefileDataStoreFactory();
|
||||||
|
|
||||||
ShapefileDataStore dataStore = (ShapefileDataStore) factory.createNewDataStore(params);
|
ShapefileDataStore dataStore = (ShapefileDataStore) factory.createNewDataStore(params);
|
||||||
|
|
||||||
dataStore.setCharset(DBF_CHARSET);
|
dataStore.setCharset(DBF_CHARSET);
|
||||||
|
|||||||
@@ -33,8 +33,10 @@ public class InferenceResultShpService {
|
|||||||
@Transactional
|
@Transactional
|
||||||
public InferenceResultShpDto.FileCntDto createShpFile() {
|
public InferenceResultShpDto.FileCntDto createShpFile() {
|
||||||
|
|
||||||
|
// TODO 파일 경로는 정해지면 수정, properties 사용
|
||||||
String baseDir = System.getProperty("user.home") + "/export";
|
String baseDir = System.getProperty("user.home") + "/export";
|
||||||
|
|
||||||
|
// TODO 배치 실행으로 변경 필요
|
||||||
int batchSize = 100;
|
int batchSize = 100;
|
||||||
int geomLimit = 500_000;
|
int geomLimit = 500_000;
|
||||||
|
|
||||||
@@ -47,7 +49,7 @@ public class InferenceResultShpService {
|
|||||||
// 재생성을 위한 생성 상태 초기화
|
// 재생성을 위한 생성 상태 초기화
|
||||||
coreService.resetForRegenerate(dataUid);
|
coreService.resetForRegenerate(dataUid);
|
||||||
|
|
||||||
// 도형 데이터 조회
|
// 추론 데이터 조회
|
||||||
List<InferenceResultShpDto.Basic> dtoList = coreService.loadGeomDtos(dataUid, geomLimit);
|
List<InferenceResultShpDto.Basic> dtoList = coreService.loadGeomDtos(dataUid, geomLimit);
|
||||||
if (dtoList.isEmpty()) {
|
if (dtoList.isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
@@ -64,7 +66,7 @@ public class InferenceResultShpService {
|
|||||||
String geoJsonPath = baseDir + "/geojson/" + baseName + ".geojson";
|
String geoJsonPath = baseDir + "/geojson/" + baseName + ".geojson";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 폴더 안 파일을 세지 않고, Writer가 "이번 호출에서 write한 개수"를 반환
|
// Writer가 "이번 호출에서 write한 개수"를 반환
|
||||||
total = total.plus(shpWriter.writeShp(shpBasePath, dtoList));
|
total = total.plus(shpWriter.writeShp(shpBasePath, dtoList));
|
||||||
total = total.plus(shpWriter.writeGeoJson(geoJsonPath, dtoList));
|
total = total.plus(shpWriter.writeGeoJson(geoJsonPath, dtoList));
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public interface ShpWriter {
|
public interface ShpWriter {
|
||||||
|
|
||||||
// SHP (.shp/.shx/.dbf)
|
// SHP (.shp/.shx/.dbf/.fix)
|
||||||
WriteCnt writeShp(String shpBasePath, List<InferenceResultShpDto.Basic> rows);
|
WriteCnt writeShp(String shpBasePath, List<InferenceResultShpDto.Basic> rows);
|
||||||
|
|
||||||
// GeoJSON (.geojson)
|
// GeoJSON (.geojson)
|
||||||
|
|||||||
@@ -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.ApiResponseCode;
|
||||||
import com.kamco.cd.kamcoback.config.api.ApiResponseDto.ResponseObj;
|
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.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;
|
||||||
@@ -39,21 +38,13 @@ public class MapInkxMngCoreService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Integer fid50k = mapInkx50kRepository.findByMapidCdParentNo(req.getMapidcdNo());
|
Integer fid50k = mapInkx50kRepository.findByMapidCdParentNo(req.getMapidcdNo());
|
||||||
if (fid50k == null || fid50k <= 0) {
|
if (fid50k == null) {
|
||||||
// parent도 등록
|
return new ResponseObj(ApiResponseCode.NOT_FOUND_DATA, "1:50,000 도엽의 정보가 없습니다. 관리자에게 문의하세요.");
|
||||||
MapInkx50kEntity parent =
|
|
||||||
new MapInkx50kEntity(req.getMapidcdNo().substring(0, 5), req.getMapidNm(), "", null);
|
|
||||||
MapInkx50kEntity result = mapInkx50kRepository.save(parent);
|
|
||||||
fid50k = result.getFid();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MapInkx5kEntity entity =
|
MapInkx5kEntity entity =
|
||||||
new MapInkx5kEntity(
|
new MapInkx5kEntity(
|
||||||
req.getMapidcdNo(),
|
req.getMapidcdNo(), req.getMapidNm(), map_polygon, fid50k.longValue(), "USE" // 기본은 USE로
|
||||||
req.getMapidNm(),
|
|
||||||
map_polygon,
|
|
||||||
fid50k == null ? null : fid50k.longValue(),
|
|
||||||
"USE" // 기본은 USE로
|
|
||||||
);
|
);
|
||||||
|
|
||||||
mapInkx5kRepository.save(entity);
|
mapInkx5kRepository.save(entity);
|
||||||
|
|||||||
Reference in New Issue
Block a user