변화탐지 기획안에 맞게 수정, 학습데이터현황 쿼리 수정
This commit is contained in:
@@ -4,10 +4,13 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto;
|
||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapScaleType;
|
||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapSheetList;
|
||||
import com.kamco.cd.kamcoback.common.enums.DetectionClassification;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceGeomEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.repository.changedetection.ChangeDetectionRepository;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
@@ -53,9 +56,9 @@ public class ChangeDetectionCoreService {
|
||||
}
|
||||
|
||||
public List<ChangeDetectionDto.CountDto> getChangeDetectionClassCount(
|
||||
Long id, String mapSheetNum) {
|
||||
MapScaleType scale, UUID uuid, String mapSheetNum) {
|
||||
List<ChangeDetectionDto.CountDto> list =
|
||||
changeDetectionRepository.getChangeDetectionClassCount(id, mapSheetNum);
|
||||
changeDetectionRepository.getChangeDetectionClassCount(scale, uuid, mapSheetNum);
|
||||
|
||||
return list.stream()
|
||||
.map(
|
||||
@@ -77,25 +80,20 @@ public class ChangeDetectionCoreService {
|
||||
}
|
||||
|
||||
public ChangeDetectionDto.PolygonFeatureList getChangeDetectionPolygonList(
|
||||
Long analUid, String mapSheetNum) {
|
||||
return changeDetectionRepository.getChangeDetectionPolygonList(analUid, mapSheetNum);
|
||||
MapScaleType scale, UUID uuid, String mapSheetNum) {
|
||||
return changeDetectionRepository.getChangeDetectionPolygonList(scale, uuid, mapSheetNum);
|
||||
}
|
||||
|
||||
public ChangeDetectionDto.PointFeatureList getChangeDetectionPointList(
|
||||
Long analUid, String mapSheetNum) {
|
||||
return changeDetectionRepository.getChangeDetectionPointList(analUid, mapSheetNum);
|
||||
MapScaleType scale, UUID uuid, String mapSheetNum) {
|
||||
return changeDetectionRepository.getChangeDetectionPointList(scale, uuid, mapSheetNum);
|
||||
}
|
||||
|
||||
public List<ChangeDetectionDto.MapSheetList> getChangeDetectionMapSheetList(Long analUid) {
|
||||
List<ChangeDetectionDto.MapSheetList> list =
|
||||
changeDetectionRepository.getChangeDetectionMapSheetList(analUid);
|
||||
return list.stream()
|
||||
.map(
|
||||
s -> {
|
||||
String name = s.getMapSheetName();
|
||||
s.setAlias(name + s.getMapSheetNum().substring(5, 8));
|
||||
return s;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
public List<ChangeDetectionDto.MapSheetList> getChangeDetectionMapSheetList(UUID uuid) {
|
||||
return changeDetectionRepository.getChangeDetectionMapSheetList(uuid);
|
||||
}
|
||||
|
||||
public List<MapSheetList> getChangeDetectionMapSheet50kList(UUID uuid) {
|
||||
return changeDetectionRepository.getChangeDetectionMapSheet50kList(uuid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.changedetection;
|
||||
|
||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto;
|
||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapScaleType;
|
||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapSheetList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface ChangeDetectionRepositoryCustom {
|
||||
|
||||
@@ -9,16 +12,20 @@ public interface ChangeDetectionRepositoryCustom {
|
||||
|
||||
List<String> findPolygonJson();
|
||||
|
||||
List<ChangeDetectionDto.CountDto> getChangeDetectionClassCount(Long id, String mapSheetNum);
|
||||
List<ChangeDetectionDto.CountDto> getChangeDetectionClassCount(
|
||||
MapScaleType scale, UUID uuid, String mapSheetNum);
|
||||
|
||||
ChangeDetectionDto.CogUrlDto getChangeDetectionCogUrl(ChangeDetectionDto.CogUrlReq req);
|
||||
|
||||
List<ChangeDetectionDto.AnalYearList> getChangeDetectionYearList();
|
||||
|
||||
ChangeDetectionDto.PolygonFeatureList getChangeDetectionPolygonList(
|
||||
Long analUid, String mapSheetNum);
|
||||
MapScaleType scale, UUID uuid, String mapSheetNum);
|
||||
|
||||
ChangeDetectionDto.PointFeatureList getChangeDetectionPointList(Long analUid, String mapSheetNum);
|
||||
ChangeDetectionDto.PointFeatureList getChangeDetectionPointList(
|
||||
MapScaleType scale, UUID uuid, String mapSheetNum);
|
||||
|
||||
List<ChangeDetectionDto.MapSheetList> getChangeDetectionMapSheetList(Long analUid);
|
||||
List<ChangeDetectionDto.MapSheetList> getChangeDetectionMapSheetList(UUID uuid);
|
||||
|
||||
List<MapSheetList> getChangeDetectionMapSheet50kList(UUID uuid);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.changedetection;
|
||||
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QDemoLearningAnalysisSceneItemEntity.demoLearningAnalysisSceneItemEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QImageryEntity.imageryEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapInkx50kEntity.mapInkx50kEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapInkx5kEntity.mapInkx5kEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceEntity.mapSheetAnalDataInferenceEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
||||
@@ -12,14 +12,19 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto;
|
||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapScaleType;
|
||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapSheetList;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceGeomEntity;
|
||||
import com.querydsl.core.types.Projections;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
import com.querydsl.core.types.dsl.CaseBuilder;
|
||||
import com.querydsl.core.types.dsl.Expressions;
|
||||
import com.querydsl.core.types.dsl.StringExpression;
|
||||
import com.querydsl.jpa.JPAExpressions;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
|
||||
|
||||
@@ -52,7 +57,7 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
|
||||
|
||||
@Override
|
||||
public List<ChangeDetectionDto.CountDto> getChangeDetectionClassCount(
|
||||
Long id, String mapSheetNum) {
|
||||
MapScaleType scale, UUID uuid, String mapSheetNum) {
|
||||
return queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
@@ -66,12 +71,44 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
|
||||
.innerJoin(mapSheetAnalSttcEntity)
|
||||
.on(mapSheetAnalSttcEntity.id.dataUid.eq(mapSheetAnalDataInferenceEntity.id))
|
||||
.where(
|
||||
mapSheetAnalInferenceEntity.id.eq(id),
|
||||
mapSheetAnalSttcEntity.id.mapSheetNum.eq(Long.valueOf(mapSheetNum)))
|
||||
mapSheetAnalInferenceEntity.uuid.eq(uuid),
|
||||
mapScaleTypeSearchExpression(scale, mapSheetNum))
|
||||
.groupBy(mapSheetAnalSttcEntity.id.classAfterCd)
|
||||
.fetch();
|
||||
}
|
||||
|
||||
private BooleanExpression mapScaleTypeSearchExpression(MapScaleType scale, String mapSheetNum) {
|
||||
if (scale.equals(MapScaleType.SCALE_5K)) {
|
||||
return mapSheetAnalSttcEntity.id.mapSheetNum.eq(Long.valueOf(mapSheetNum));
|
||||
} else {
|
||||
return mapSheetAnalSttcEntity
|
||||
.id
|
||||
.mapSheetNum
|
||||
.stringValue()
|
||||
.in(
|
||||
JPAExpressions.select(mapInkx5kEntity.mapidcdNo)
|
||||
.from(mapInkx5kEntity)
|
||||
.innerJoin(mapInkx5kEntity.mapInkx50k, mapInkx50kEntity)
|
||||
.where(mapInkx50kEntity.mapidcdNo.eq(mapSheetNum)));
|
||||
}
|
||||
}
|
||||
|
||||
private BooleanExpression mapScaleTypeAnalDataSearchExpression(
|
||||
MapScaleType scale, String mapSheetNum) {
|
||||
if (scale.equals(MapScaleType.SCALE_5K)) {
|
||||
return mapSheetAnalDataInferenceGeomEntity.mapSheetNum.eq(Long.valueOf(mapSheetNum));
|
||||
} else {
|
||||
return mapSheetAnalDataInferenceGeomEntity
|
||||
.mapSheetNum
|
||||
.stringValue()
|
||||
.in(
|
||||
JPAExpressions.select(mapInkx5kEntity.mapidcdNo)
|
||||
.from(mapInkx5kEntity)
|
||||
.innerJoin(mapInkx5kEntity.mapInkx50k, mapInkx50kEntity)
|
||||
.where(mapInkx50kEntity.mapidcdNo.eq(mapSheetNum)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChangeDetectionDto.CogUrlDto getChangeDetectionCogUrl(ChangeDetectionDto.CogUrlReq req) {
|
||||
ChangeDetectionDto.CogUrlData data =
|
||||
@@ -114,6 +151,7 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
|
||||
.select(
|
||||
Projections.constructor(
|
||||
ChangeDetectionDto.AnalYearList.class,
|
||||
mapSheetAnalInferenceEntity.uuid,
|
||||
mapSheetAnalInferenceEntity.id,
|
||||
mapSheetAnalInferenceEntity.analTitle,
|
||||
mapSheetAnalInferenceEntity.compareYyyy.as("beforeYear"),
|
||||
@@ -126,7 +164,7 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
|
||||
|
||||
@Override
|
||||
public ChangeDetectionDto.PolygonFeatureList getChangeDetectionPolygonList(
|
||||
Long analUid, String mapSheetNum) {
|
||||
MapScaleType scale, UUID uuid, String mapSheetNum) {
|
||||
|
||||
List<ChangeDetectionDto.PolygonQueryData> list =
|
||||
queryFactory
|
||||
@@ -151,8 +189,8 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
|
||||
.innerJoin(mapSheetAnalInferenceEntity)
|
||||
.on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalDataInferenceEntity.analUid))
|
||||
.where(
|
||||
mapSheetAnalInferenceEntity.id.eq(analUid),
|
||||
mapSheetAnalDataInferenceGeomEntity.mapSheetNum.eq(Long.valueOf(mapSheetNum)))
|
||||
mapSheetAnalInferenceEntity.uuid.eq(uuid),
|
||||
mapScaleTypeAnalDataSearchExpression(scale, mapSheetNum))
|
||||
.fetch();
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
@@ -193,7 +231,7 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
|
||||
|
||||
@Override
|
||||
public ChangeDetectionDto.PointFeatureList getChangeDetectionPointList(
|
||||
Long analUid, String mapSheetNum) {
|
||||
MapScaleType scale, UUID uuid, String mapSheetNum) {
|
||||
List<ChangeDetectionDto.PointQueryData> list =
|
||||
queryFactory
|
||||
.select(
|
||||
@@ -213,8 +251,8 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
|
||||
.innerJoin(mapSheetAnalInferenceEntity)
|
||||
.on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalDataInferenceEntity.analUid))
|
||||
.where(
|
||||
mapSheetAnalInferenceEntity.id.eq(analUid),
|
||||
mapSheetAnalDataInferenceGeomEntity.mapSheetNum.eq(Long.valueOf(mapSheetNum)))
|
||||
mapSheetAnalInferenceEntity.uuid.eq(uuid),
|
||||
mapScaleTypeAnalDataSearchExpression(scale, mapSheetNum))
|
||||
.fetch();
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
@@ -239,20 +277,43 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ChangeDetectionDto.MapSheetList> getChangeDetectionMapSheetList(Long analUid) {
|
||||
public List<ChangeDetectionDto.MapSheetList> getChangeDetectionMapSheetList(UUID uuid) {
|
||||
return queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
ChangeDetectionDto.MapSheetList.class,
|
||||
mapInkx5kEntity.mapidcdNo,
|
||||
mapInkx5kEntity.mapidNm,
|
||||
mapInkx5kEntity.mapidNm // alias 앞단 core에서
|
||||
))
|
||||
.from(demoLearningAnalysisSceneItemEntity)
|
||||
Expressions.stringTemplate(
|
||||
"concat({0}, ' ', {1})", mapInkx5kEntity.mapidNm, mapInkx5kEntity.mapidcdNo)))
|
||||
.from(mapSheetAnalInferenceEntity)
|
||||
.innerJoin(mapSheetAnalDataInferenceEntity)
|
||||
.on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalDataInferenceEntity.analUid))
|
||||
.innerJoin(mapInkx5kEntity)
|
||||
.on(demoLearningAnalysisSceneItemEntity.fid.eq(mapInkx5kEntity.fid.longValue()))
|
||||
.where(demoLearningAnalysisSceneItemEntity.groupId.eq(analUid))
|
||||
.orderBy(mapInkx5kEntity.mapidNm.asc(), mapInkx5kEntity.mapidcdNo.asc())
|
||||
.on(mapSheetAnalDataInferenceEntity.mapSheetNum.stringValue().eq(mapInkx5kEntity.mapidcdNo))
|
||||
.where(mapSheetAnalInferenceEntity.uuid.eq(uuid))
|
||||
.orderBy(mapInkx5kEntity.mapidcdNo.asc())
|
||||
.fetch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MapSheetList> getChangeDetectionMapSheet50kList(UUID uuid) {
|
||||
return queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
ChangeDetectionDto.MapSheetList.class,
|
||||
mapInkx50kEntity.mapidcdNo,
|
||||
mapInkx50kEntity.mapidNm,
|
||||
Expressions.stringTemplate(
|
||||
"concat({0}, ' ', {1})", mapInkx50kEntity.mapidNm, mapInkx50kEntity.mapidcdNo)))
|
||||
.from(mapSheetAnalInferenceEntity)
|
||||
.innerJoin(mapSheetAnalDataInferenceEntity)
|
||||
.on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalDataInferenceEntity.analUid))
|
||||
.innerJoin(mapInkx5kEntity)
|
||||
.on(mapSheetAnalDataInferenceEntity.mapSheetNum.stringValue().eq(mapInkx5kEntity.mapidcdNo))
|
||||
.innerJoin(mapInkx5kEntity.mapInkx50k, mapInkx50kEntity)
|
||||
.where(mapSheetAnalInferenceEntity.uuid.eq(uuid))
|
||||
.orderBy(mapInkx5kEntity.mapidcdNo.asc())
|
||||
.fetch();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.kamco.cd.kamcoback.postgres.repository.label;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QLabelingAssignmentEntity.labelingAssignmentEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QLabelingInspectorEntity.labelingInspectorEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QLabelingLabelerEntity.labelingLabelerEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceEntity.mapSheetAnalDataInferenceEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QMemberEntity.memberEntity;
|
||||
@@ -537,11 +538,15 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
labelingTargetCount =
|
||||
queryFactory
|
||||
.select(mapSheetAnalDataInferenceGeomEntity.geoUid.count())
|
||||
.from(mapSheetAnalDataInferenceGeomEntity)
|
||||
.from(mapSheetAnalInferenceEntity)
|
||||
.innerJoin(mapSheetAnalDataInferenceEntity)
|
||||
.on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalDataInferenceEntity.analUid))
|
||||
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||
.on(
|
||||
mapSheetAnalDataInferenceEntity.id.eq(
|
||||
mapSheetAnalDataInferenceGeomEntity.dataUid))
|
||||
.where(
|
||||
mapSheetAnalDataInferenceGeomEntity.compareYyyy.eq(analEntity.getCompareYyyy()),
|
||||
mapSheetAnalDataInferenceGeomEntity.targetYyyy.eq(analEntity.getTargetYyyy()),
|
||||
mapSheetAnalDataInferenceGeomEntity.stage.eq(analEntity.getStage()),
|
||||
mapSheetAnalInferenceEntity.uuid.eq(targetUuid),
|
||||
mapSheetAnalDataInferenceGeomEntity.pnu.gt(0L),
|
||||
mapSheetAnalDataInferenceGeomEntity.passYn.isFalse())
|
||||
.fetchOne();
|
||||
|
||||
Reference in New Issue
Block a user