|
|
|
@@ -4,11 +4,17 @@ import static com.kamco.cd.kamcoback.postgres.entity.QImageryEntity.imageryEntit
|
|
|
|
import static com.kamco.cd.kamcoback.postgres.entity.QLabelingAssignmentEntity.labelingAssignmentEntity;
|
|
|
|
import static com.kamco.cd.kamcoback.postgres.entity.QLabelingAssignmentEntity.labelingAssignmentEntity;
|
|
|
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapInkx5kEntity.mapInkx5kEntity;
|
|
|
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapInkx5kEntity.mapInkx5kEntity;
|
|
|
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
|
|
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
|
|
|
|
|
|
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnDataGeomEntity.mapSheetLearnDataGeomEntity;
|
|
|
|
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
|
|
|
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
|
|
|
|
|
|
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceGeomEntity;
|
|
|
|
|
|
|
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.ChangeDetectionInfo;
|
|
|
|
|
|
|
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.ClassificationInfo;
|
|
|
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.DetailRes;
|
|
|
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.DetailRes;
|
|
|
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.GeoFeatureRequest.Properties;
|
|
|
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.GeoFeatureRequest.Properties;
|
|
|
|
|
|
|
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.InspectionResultInfo;
|
|
|
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelingGeometryInfo;
|
|
|
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelingGeometryInfo;
|
|
|
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelingListDto;
|
|
|
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelingListDto;
|
|
|
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.SummaryRes;
|
|
|
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.SummaryRes;
|
|
|
|
@@ -20,6 +26,7 @@ import com.querydsl.core.types.dsl.Expressions;
|
|
|
|
import com.querydsl.core.types.dsl.NumberPath;
|
|
|
|
import com.querydsl.core.types.dsl.NumberPath;
|
|
|
|
import com.querydsl.core.types.dsl.StringExpression;
|
|
|
|
import com.querydsl.core.types.dsl.StringExpression;
|
|
|
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
|
|
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
|
|
|
|
|
|
|
import jakarta.persistence.EntityNotFoundException;
|
|
|
|
import java.time.LocalDate;
|
|
|
|
import java.time.LocalDate;
|
|
|
|
import java.time.ZonedDateTime;
|
|
|
|
import java.time.ZonedDateTime;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
@@ -170,24 +177,48 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void updateLabelingPolygonClass(
|
|
|
|
public void updateLabelingPolygonClass(
|
|
|
|
Long mapSheetAnalDataInferenceGeomEntityUid,
|
|
|
|
Long inferenceGeomUid, Geometry geometry, Properties properties, String status) {
|
|
|
|
Geometry geometry,
|
|
|
|
// inference_geom 테이블에 상태 업데이트
|
|
|
|
Properties properties,
|
|
|
|
|
|
|
|
String status) {
|
|
|
|
|
|
|
|
queryFactory
|
|
|
|
queryFactory
|
|
|
|
.update(mapSheetAnalDataInferenceGeomEntity)
|
|
|
|
.update(mapSheetAnalDataInferenceGeomEntity)
|
|
|
|
.set(mapSheetAnalDataInferenceGeomEntity.geom, geometry)
|
|
|
|
|
|
|
|
.set(
|
|
|
|
|
|
|
|
mapSheetAnalDataInferenceGeomEntity.classBeforeCd,
|
|
|
|
|
|
|
|
properties.getBeforeClass().toLowerCase())
|
|
|
|
|
|
|
|
.set(
|
|
|
|
|
|
|
|
mapSheetAnalDataInferenceGeomEntity.classAfterCd,
|
|
|
|
|
|
|
|
properties.getAfterClass().toLowerCase())
|
|
|
|
|
|
|
|
.set(mapSheetAnalDataInferenceGeomEntity.labelStateDttm, ZonedDateTime.now())
|
|
|
|
.set(mapSheetAnalDataInferenceGeomEntity.labelStateDttm, ZonedDateTime.now())
|
|
|
|
.set(mapSheetAnalDataInferenceGeomEntity.labelState, status)
|
|
|
|
.set(mapSheetAnalDataInferenceGeomEntity.labelState, status)
|
|
|
|
.set(mapSheetAnalDataInferenceGeomEntity.geomCenter, geometry.getCentroid())
|
|
|
|
.where(mapSheetAnalDataInferenceGeomEntity.geoUid.eq(inferenceGeomUid))
|
|
|
|
.where(
|
|
|
|
.execute();
|
|
|
|
mapSheetAnalDataInferenceGeomEntity.geoUid.eq(mapSheetAnalDataInferenceGeomEntityUid))
|
|
|
|
|
|
|
|
|
|
|
|
// compareYyyy, targetYyyy 정보 가져오기
|
|
|
|
|
|
|
|
MapSheetAnalDataInferenceGeomEntity entity =
|
|
|
|
|
|
|
|
queryFactory
|
|
|
|
|
|
|
|
.selectFrom(mapSheetAnalDataInferenceGeomEntity)
|
|
|
|
|
|
|
|
.where(mapSheetAnalDataInferenceGeomEntity.geoUid.eq(inferenceGeomUid))
|
|
|
|
|
|
|
|
.fetchOne();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Objects.isNull(entity)) {
|
|
|
|
|
|
|
|
throw new EntityNotFoundException(
|
|
|
|
|
|
|
|
"MapSheetAnalDataInferenceGeomEntity not found for analUid: ");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// learn_data_geom 에 insert
|
|
|
|
|
|
|
|
queryFactory
|
|
|
|
|
|
|
|
.insert(mapSheetLearnDataGeomEntity)
|
|
|
|
|
|
|
|
.columns(
|
|
|
|
|
|
|
|
mapSheetLearnDataGeomEntity.geoUid,
|
|
|
|
|
|
|
|
mapSheetLearnDataGeomEntity.afterYyyy,
|
|
|
|
|
|
|
|
mapSheetLearnDataGeomEntity.beforeYyyy,
|
|
|
|
|
|
|
|
mapSheetLearnDataGeomEntity.classAfterCd,
|
|
|
|
|
|
|
|
mapSheetLearnDataGeomEntity.classBeforeCd,
|
|
|
|
|
|
|
|
mapSheetLearnDataGeomEntity.geom,
|
|
|
|
|
|
|
|
mapSheetLearnDataGeomEntity.createdDate,
|
|
|
|
|
|
|
|
mapSheetLearnDataGeomEntity.modifiedDate)
|
|
|
|
|
|
|
|
.values(
|
|
|
|
|
|
|
|
inferenceGeomUid,
|
|
|
|
|
|
|
|
entity.getTargetYyyy(),
|
|
|
|
|
|
|
|
entity.getCompareYyyy(),
|
|
|
|
|
|
|
|
properties.getAfterClass().toLowerCase(),
|
|
|
|
|
|
|
|
properties.getBeforeClass().toLowerCase(),
|
|
|
|
|
|
|
|
geometry,
|
|
|
|
|
|
|
|
ZonedDateTime.now(),
|
|
|
|
|
|
|
|
ZonedDateTime.now())
|
|
|
|
.execute();
|
|
|
|
.execute();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -370,7 +401,7 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
|
|
|
|
|
|
|
|
|
|
|
|
// 5. DTO 생성
|
|
|
|
// 5. DTO 생성
|
|
|
|
var changeDetectionInfo =
|
|
|
|
var changeDetectionInfo =
|
|
|
|
com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.ChangeDetectionInfo.builder()
|
|
|
|
ChangeDetectionInfo.builder()
|
|
|
|
.mapSheetInfo(mapSheetEntity != null ? mapSheetEntity.getMapidNm() : "")
|
|
|
|
.mapSheetInfo(mapSheetEntity != null ? mapSheetEntity.getMapidNm() : "")
|
|
|
|
.detectionYear(
|
|
|
|
.detectionYear(
|
|
|
|
(mapSheetAnalDataInferenceGeomEntityEntity.getCompareYyyy() != null
|
|
|
|
(mapSheetAnalDataInferenceGeomEntityEntity.getCompareYyyy() != null
|
|
|
|
@@ -381,8 +412,7 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
|
|
|
|
? mapSheetAnalDataInferenceGeomEntityEntity.getTargetYyyy()
|
|
|
|
? mapSheetAnalDataInferenceGeomEntityEntity.getTargetYyyy()
|
|
|
|
: 0))
|
|
|
|
: 0))
|
|
|
|
.beforeClass(
|
|
|
|
.beforeClass(
|
|
|
|
com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.ClassificationInfo
|
|
|
|
ClassificationInfo.builder()
|
|
|
|
.builder()
|
|
|
|
|
|
|
|
.classification(
|
|
|
|
.classification(
|
|
|
|
mapSheetAnalDataInferenceGeomEntityEntity.getClassBeforeCd() != null
|
|
|
|
mapSheetAnalDataInferenceGeomEntityEntity.getClassBeforeCd() != null
|
|
|
|
? mapSheetAnalDataInferenceGeomEntityEntity.getClassBeforeCd()
|
|
|
|
? mapSheetAnalDataInferenceGeomEntityEntity.getClassBeforeCd()
|
|
|
|
@@ -393,8 +423,7 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
|
|
|
|
: 0.0)
|
|
|
|
: 0.0)
|
|
|
|
.build())
|
|
|
|
.build())
|
|
|
|
.afterClass(
|
|
|
|
.afterClass(
|
|
|
|
com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.ClassificationInfo
|
|
|
|
ClassificationInfo.builder()
|
|
|
|
.builder()
|
|
|
|
|
|
|
|
.classification(
|
|
|
|
.classification(
|
|
|
|
mapSheetAnalDataInferenceGeomEntityEntity.getClassAfterCd() != null
|
|
|
|
mapSheetAnalDataInferenceGeomEntityEntity.getClassAfterCd() != null
|
|
|
|
? mapSheetAnalDataInferenceGeomEntityEntity.getClassAfterCd()
|
|
|
|
? mapSheetAnalDataInferenceGeomEntityEntity.getClassAfterCd()
|
|
|
|
@@ -419,8 +448,7 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
|
|
|
|
.build();
|
|
|
|
.build();
|
|
|
|
|
|
|
|
|
|
|
|
var inspectionResultInfo =
|
|
|
|
var inspectionResultInfo =
|
|
|
|
com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.InspectionResultInfo
|
|
|
|
InspectionResultInfo.builder()
|
|
|
|
.builder()
|
|
|
|
|
|
|
|
.verificationResult(convertInspectState(assignment.toDto().getInspectState()))
|
|
|
|
.verificationResult(convertInspectState(assignment.toDto().getInspectState()))
|
|
|
|
.inappropriateReason("")
|
|
|
|
.inappropriateReason("")
|
|
|
|
// .memo(assignment.toDto().getInspectMemo() != null ?
|
|
|
|
// .memo(assignment.toDto().getInspectMemo() != null ?
|
|
|
|
@@ -428,7 +456,7 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
|
|
|
|
.build();
|
|
|
|
.build();
|
|
|
|
|
|
|
|
|
|
|
|
// 6. Geometry를 GeoJSON으로 변환
|
|
|
|
// 6. Geometry를 GeoJSON으로 변환
|
|
|
|
com.fasterxml.jackson.databind.JsonNode geomJson = null;
|
|
|
|
JsonNode geomJson = null;
|
|
|
|
if (mapSheetAnalDataInferenceGeomEntityEntity.getGeom() != null) {
|
|
|
|
if (mapSheetAnalDataInferenceGeomEntityEntity.getGeom() != null) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
String geomString =
|
|
|
|
String geomString =
|
|
|
|
@@ -443,8 +471,7 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
|
|
|
|
.fetchOne();
|
|
|
|
.fetchOne();
|
|
|
|
|
|
|
|
|
|
|
|
if (geomString != null) {
|
|
|
|
if (geomString != null) {
|
|
|
|
com.fasterxml.jackson.databind.ObjectMapper mapper =
|
|
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
|
|
new com.fasterxml.jackson.databind.ObjectMapper();
|
|
|
|
|
|
|
|
geomJson = mapper.readTree(geomString);
|
|
|
|
geomJson = mapper.readTree(geomString);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
@@ -464,8 +491,7 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
|
|
|
|
.where(mapInkx5kEntity.mapidcdNo.eq(assignment.toDto().getAssignGroupId()))
|
|
|
|
.where(mapInkx5kEntity.mapidcdNo.eq(assignment.toDto().getAssignGroupId()))
|
|
|
|
.fetchOne();
|
|
|
|
.fetchOne();
|
|
|
|
if (bboxString != null) {
|
|
|
|
if (bboxString != null) {
|
|
|
|
com.fasterxml.jackson.databind.ObjectMapper mapper =
|
|
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
|
|
new com.fasterxml.jackson.databind.ObjectMapper();
|
|
|
|
|
|
|
|
mapBbox = mapper.readTree(bboxString);
|
|
|
|
mapBbox = mapper.readTree(bboxString);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
@@ -473,6 +499,29 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 7. 라벨링 저장한 Geometry를 GeoJSON으로 변환
|
|
|
|
|
|
|
|
JsonNode learnJson = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
String learnString =
|
|
|
|
|
|
|
|
queryFactory
|
|
|
|
|
|
|
|
.select(
|
|
|
|
|
|
|
|
Expressions.stringTemplate(
|
|
|
|
|
|
|
|
"ST_AsGeoJSON({0})", mapSheetLearnDataGeomEntity.geom))
|
|
|
|
|
|
|
|
.from(mapSheetLearnDataGeomEntity)
|
|
|
|
|
|
|
|
.where(
|
|
|
|
|
|
|
|
mapSheetLearnDataGeomEntity.geoUid.eq(
|
|
|
|
|
|
|
|
mapSheetAnalDataInferenceGeomEntityEntity.getGeoUid()))
|
|
|
|
|
|
|
|
.fetchOne();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (learnString != null) {
|
|
|
|
|
|
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
|
|
|
|
|
|
learnJson = mapper.readTree(learnString);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
System.err.println("learnJson parsing error: " + e.getMessage());
|
|
|
|
|
|
|
|
// JSON 파싱 실패 시 null 유지
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return DetailRes.builder()
|
|
|
|
return DetailRes.builder()
|
|
|
|
.assignmentUid(assignmentUid)
|
|
|
|
.assignmentUid(assignmentUid)
|
|
|
|
.changeDetectionInfo(changeDetectionInfo)
|
|
|
|
.changeDetectionInfo(changeDetectionInfo)
|
|
|
|
@@ -481,7 +530,9 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
|
|
|
|
.beforeCogUrl(beforeCogUrl)
|
|
|
|
.beforeCogUrl(beforeCogUrl)
|
|
|
|
.afterCogUrl(afterCogUrl)
|
|
|
|
.afterCogUrl(afterCogUrl)
|
|
|
|
.mapBox(mapBbox)
|
|
|
|
.mapBox(mapBbox)
|
|
|
|
|
|
|
|
.learnGeometry(learnJson)
|
|
|
|
.build();
|
|
|
|
.build();
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
System.err.println("getDetail Error: " + e.getMessage());
|
|
|
|
System.err.println("getDetail Error: " + e.getMessage());
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
|