review-to-geojson 로그작성,prod수정, spotless

This commit is contained in:
2026-03-02 21:01:14 +09:00
parent 2ea6a62730
commit a9d9aa746f
19 changed files with 71 additions and 51 deletions

View File

@@ -15,7 +15,6 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
@Log4j2

View File

@@ -84,28 +84,28 @@ mapsheet:
baseurl: /app/detect/result #현재사용안함
file:
sync-root-dir: /data/images/
sync-tmp-dir: /data/repo/tmp # image upload temp dir
sync-root-dir: /kamco-nfs/images/
sync-tmp-dir: /kamco-nfs/repo/tmp # image upload temp dir
sync-file-extention: tfw,tif
#dataset-dir: D:/data/model_output/ #변경 model_output
dataset-dir: /data/model_output/export/ # 마운트경로 AI 추론결과
#dataset-dir: D:/kamco-nfs/model_output/ #변경 model_output
dataset-dir: /kamco-nfs/model_output/export/ # 마운트경로 AI 추론결과
dataset-tmp-dir: ${file.dataset-dir}tmp/
#model-dir: D:/data/ckpt/model/
model-dir: /data/ckpt/model/ # 학습서버에서 트레이닝한 모델업로드경로
#model-dir: D:/kamco-nfs/ckpt/model/
model-dir: /kamco-nfs/ckpt/model/ # 학습서버에서 트레이닝한 모델업로드경로
model-tmp-dir: ${file.model-dir}tmp/
model-file-extention: pth,json,py
pt-path: /data/ckpt/v6-cls-checkpoints/
pt-path: /kamco-nfs/ckpt/v6-cls-checkpoints/
pt-FileName: yolov8_6th-6m.pt
dataset-response: /data/dataset/response/
dataset-response: /kamco-nfs/dataset/response/
inference:
url: http://127.0.0.1:8000/jobs
batch-url: http://127.0.0.1:8000/batches
geojson-dir: /data/requests/ # 학습서버에서 트레이닝한 모델업로드경로
jar-path: /data/repo/jar/shp-exporter.jar # 추론실행을 위한 파일생성경로
geojson-dir: /kamco-nfs/requests/ # 학습서버에서 트레이닝한 모델업로드경로
jar-path: /kamco-nfs/repo/jar/shp-exporter.jar # 추론실행을 위한 파일생성경로
inference-server-name: server1,server2,server3,server4
gukyuin:
@@ -113,7 +113,7 @@ gukyuin:
cdi: ${gukyuin.url}/api/kcd/cdi
training-data:
geojson-dir: /data/dataset/request/
geojson-dir: /kamco-nfs/dataset/request/
layer:
geoserver-url: https://kamco.geo-dev.gs.dabeeo.com

View File

@@ -18,7 +18,6 @@ import java.util.Objects;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -40,53 +39,69 @@ public class TrainingDataReviewJobService {
return "local".equalsIgnoreCase(profile);
}
@Scheduled(cron = "0 0 2 * * *")
public void runTask() {
exportGeojsonLabelingGeom(null);
}
@Transactional
public void exportGeojsonLabelingGeom(LocalDate baseDate) {
//
// if (isLocalProfile()) {
// return;
// }
// 1) 경로/파일명 결정
String targetDir =
"local".equals(profile) ? System.getProperty("user.home") + "/geojson" : trainingDataDir;
log.info("[Step 1-1] geojson 파일 생성할 경로: {}", targetDir);
// 2) 진행중인 회차 중, complete_cnt 가 존재하는 회차 목록 가져오기
log.info("[Step 1-2] 진행중인 회차 중, complete_cnt 가 존재하는 회차 목록 가져오기");
List<AnalCntInfo> analList = trainingDataReviewJobCoreService.findAnalCntInfoList();
log.info("[Step 1-3] 회차 리스트 건수: {}", analList == null ? 0 : analList.size());
if (analList.isEmpty()) {
log.info("[Step 1-4] 회차 리스트 없어 return 하고 종료");
return;
}
for (AnalCntInfo info : analList) {
log.info("[Step 2-1] 회차 폴리곤 전체 건수 == 파일 생성 건수 같은지 확인");
log.info("=== info.getAllCnt(): {}", info.getAllCnt());
log.info("=== info.getFileCnt(): {}", info.getFileCnt());
if (Objects.equals(info.getAllCnt(), info.getFileCnt())) {
log.info("[Step 2-2] 회차 폴리곤 전체 건수 == 파일 생성 건수 같아서 파일 생성 진행하지 않음 continue");
continue;
}
String resultUid = info.getResultUid(); // 회차의 대문자 uid (폴더명으로 사용)
// 3) 회차 + 어제까지 검수 완료된 총 데이터의 도엽별 목록 가져오기
log.info("[Step 3-1] 회차 + 어제까지 검수 완료된 총 데이터의 도엽별 목록 가져오기");
List<AnalMapSheetList> analMapList =
trainingDataReviewJobCoreService.findCompletedAnalMapSheetList(
info.getAnalUid(), baseDate);
log.info("=== analMapList cnt: {}", analMapList == null ? 0 : analMapList.size());
if (analMapList.isEmpty()) {
log.info("[Step 3-2] 도엽 목록 조회되지 않아 continue");
continue;
}
log.info("[Step 4-1] 도엽별 geom 데이터 가지고 와서 geojson 만들기 시작");
for (AnalMapSheetList mapSheet : analMapList) {
// 4) 도엽별 geom 데이터 가지고 와서 geojson 만들기
log.info("[Step 4-2] 도엽별 검수완료된 폴리곤 데이터 목록 조회");
List<CompleteLabelData> completeList =
trainingDataReviewJobCoreService.findCompletedYesterdayLabelingList(
info.getAnalUid(), mapSheet.getMapSheetNum(), baseDate);
log.info("=== completeList size: {}", completeList == null ? 0 : completeList.size());
if (!completeList.isEmpty()) {
log.info("[Step 4-3] 목록에서 filter로 geoUid List 생성, 폴리곤 feature별 리스트 생성");
List<Long> geoUids = completeList.stream().map(CompleteLabelData::getGeoUid).toList();
List<GeoJsonFeature> features = completeList.stream().map(GeoJsonFeature::from).toList();
// 5) 파일서버에 uid 폴더 생성 후 업로드 하기
log.info("[Step 5-1] 파일서버에 uid 폴더 생성 후 업로드 하기 시작");
FeatureCollection collection = new FeatureCollection(features);
String filename =
String.format(
@@ -96,15 +111,21 @@ public class TrainingDataReviewJobService {
mapSheet.getTargetYyyy(),
mapSheet.getMapSheetNum());
log.info("=== filename: {}", filename);
log.info("=== 회차의 uid: {}", resultUid);
Path outputPath = Paths.get(targetDir + "/" + resultUid, filename);
log.info("=== outputPath: {}", outputPath);
try {
log.info("[Step 6-1] Uid로 폴더 생성");
Files.createDirectories(outputPath.getParent());
log.info("[Step 6-2] geoJson 파일 생성");
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
objectMapper.writeValue(outputPath.toFile(), collection);
// geoUids : file_create_yn = true 로 업데이트
log.info("[Step 6-3] learn_data_geom 에 file_create_yn = true 로 업데이트");
trainingDataReviewJobCoreService.updateLearnDataGeomFileCreateYn(geoUids);
} catch (IOException e) {

View File

@@ -84,28 +84,28 @@ mapsheet:
baseurl: /app/detect/result #현재사용안함
file:
sync-root-dir: /data/images/
sync-tmp-dir: /data/repo/tmp # image upload temp dir
sync-root-dir: /kamco-nfs/images/
sync-tmp-dir: /kamco-nfs/repo/tmp # image upload temp dir
sync-file-extention: tfw,tif
#dataset-dir: D:/data/model_output/ #변경 model_output
dataset-dir: /data/model_output/export/ # 마운트경로 AI 추론결과
#dataset-dir: D:/kamco-nfs/model_output/ #변경 model_output
dataset-dir: /kamco-nfs/model_output/export/ # 마운트경로 AI 추론결과
dataset-tmp-dir: ${file.dataset-dir}tmp/
#model-dir: D:/data/ckpt/model/
model-dir: /data/ckpt/model/ # 학습서버에서 트레이닝한 모델업로드경로
#model-dir: D:/kamco-nfs/ckpt/model/
model-dir: /kamco-nfs/ckpt/model/ # 학습서버에서 트레이닝한 모델업로드경로
model-tmp-dir: ${file.model-dir}tmp/
model-file-extention: pth,json,py
pt-path: /data/ckpt/v6-cls-checkpoints/
pt-path: /kamco-nfs/ckpt/v6-cls-checkpoints/
pt-FileName: yolov8_6th-6m.pt
dataset-response: /data/dataset/response/
dataset-response: /kamco-nfs/dataset/response/
inference:
url: http://127.0.0.1:8000/jobs
batch-url: http://127.0.0.1:8000/batches
geojson-dir: /data/requests/ # 학습서버에서 트레이닝한 모델업로드경로
jar-path: /data/repo/jar/shp-exporter.jar # 추론실행을 위한 파일생성경로
geojson-dir: /kamco-nfs/requests/ # 학습서버에서 트레이닝한 모델업로드경로
jar-path: /kamco-nfs/repo/jar/shp-exporter.jar # 추론실행을 위한 파일생성경로
inference-server-name: server1,server2,server3,server4
gukyuin:
@@ -113,7 +113,7 @@ gukyuin:
cdi: ${gukyuin.url}/api/kcd/cdi
training-data:
geojson-dir: /data/dataset/request/
geojson-dir: /kamco-nfs/dataset/request/
layer:
geoserver-url: https://kamco.geo-dev.gs.dabeeo.com