변화탐지 pnu로도 조회 가능하게 하기

This commit is contained in:
2026-03-04 08:04:04 +09:00
parent 278d5d20e8
commit 4d1ea53d8f
5 changed files with 74 additions and 33 deletions

View File

@@ -163,13 +163,13 @@ public class ChangeDetectionApiController {
@RequestParam
String chnDtctId,
@Parameter(description = "polygon 32자 uid", example = "3B1A7E5F895A4D9698489540EE1BBE1E")
@RequestParam
@RequestParam(required = false)
String cdObjectId,
@Parameter(
description = "polygon 32자 uids",
example =
"3B1A7E5F895A4D9698489540EE1BBE1E,3B221A2AF9614647A0903A972D56C574,3B22686A7ACE44FC9CB20F1B4FA6DEFD,3B376D94A183479BB5FBE3D7166E6E1A")
@RequestParam
@RequestParam(required = false)
List<String> cdObjectIds,
@Parameter(description = "pnu") @RequestParam(required = false) String pnu) {
return ApiResponseDto.ok(
@@ -183,13 +183,13 @@ public class ChangeDetectionApiController {
@RequestParam
String chnDtctId,
@Parameter(description = "polygon 32자 uid", example = "3B1A7E5F895A4D9698489540EE1BBE1E")
@RequestParam
@RequestParam(required = false)
String cdObjectId,
@Parameter(
description = "polygon 32자 uids",
example =
"3B1A7E5F895A4D9698489540EE1BBE1E,3B221A2AF9614647A0903A972D56C574,3B22686A7ACE44FC9CB20F1B4FA6DEFD,3B376D94A183479BB5FBE3D7166E6E1A")
@RequestParam
@RequestParam(required = false)
List<String> cdObjectIds,
@Parameter(description = "pnu") @RequestParam(required = false) String pnu) {
return ApiResponseDto.ok(

View File

@@ -101,7 +101,7 @@ public class ChangeDetectionService {
*/
public ChangeDetectionDto.PolygonFeatureList getPolygonListByCd(
String chnDtctId, String cdObjectId, List<String> cdObjectIds, String pnu) {
return changeDetectionCoreService.getPolygonListByCd(chnDtctId, cdObjectId, cdObjectIds);
return changeDetectionCoreService.getPolygonListByCd(chnDtctId, cdObjectId, cdObjectIds, pnu);
}
/**
@@ -115,7 +115,7 @@ public class ChangeDetectionService {
*/
public ChangeDetectionDto.PointFeatureList getPointListByCd(
String chnDtctId, String cdObjectId, List<String> cdObjectIds, String pnu) {
return changeDetectionCoreService.getPointListByCd(chnDtctId, cdObjectId, cdObjectIds);
return changeDetectionCoreService.getPointListByCd(chnDtctId, cdObjectId, cdObjectIds, pnu);
}
/**

View File

@@ -108,8 +108,8 @@ public class ChangeDetectionCoreService {
* @return
*/
public ChangeDetectionDto.PolygonFeatureList getPolygonListByCd(
String chnDtctId, String cdObjectId, List<String> cdObjectIds) {
return changeDetectionRepository.getPolygonListByCd(chnDtctId, cdObjectId, cdObjectIds);
String chnDtctId, String cdObjectId, List<String> cdObjectIds, String pnu) {
return changeDetectionRepository.getPolygonListByCd(chnDtctId, cdObjectId, cdObjectIds, pnu);
}
/**
@@ -121,8 +121,8 @@ public class ChangeDetectionCoreService {
* @return
*/
public ChangeDetectionDto.PointFeatureList getPointListByCd(
String chnDtctId, String cdObjectId, List<String> cdObjectIds) {
return changeDetectionRepository.getPointListByCd(chnDtctId, cdObjectId, cdObjectIds);
String chnDtctId, String cdObjectId, List<String> cdObjectIds, String pnu) {
return changeDetectionRepository.getPointListByCd(chnDtctId, cdObjectId, cdObjectIds, pnu);
}
/**

View File

@@ -31,10 +31,10 @@ public interface ChangeDetectionRepositoryCustom {
List<MapSheetList> getChangeDetectionMapSheet50kList(UUID uuid);
ChangeDetectionDto.PolygonFeatureList getPolygonListByCd(
String chnDtctId, String cdObjectId, List<String> cdObjectIds);
String chnDtctId, String cdObjectId, List<String> cdObjectIds, String pnu);
ChangeDetectionDto.PointFeatureList getPointListByCd(
String chnDtctId, String cdObjectId, List<String> cdObjectIds);
String chnDtctId, String cdObjectId, List<String> cdObjectIds, String pnu);
ChangeDetectionDto.PolygonFeatureList getSelectedChangeDetectionPolygonListByPnu(
String chnDtctId, String pnu);

View File

@@ -18,7 +18,9 @@ import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.DetectSearc
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapScaleType;
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapSheetList;
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.PointFeatureList;
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.PointQueryData;
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.PolygonFeatureList;
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.PolygonQueryData;
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Status;
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceGeomEntity;
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceEntity;
@@ -31,6 +33,7 @@ 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.JPAQuery;
import com.querydsl.jpa.impl.JPAQueryFactory;
import java.util.List;
import java.util.Objects;
@@ -391,16 +394,23 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
@Override
public PolygonFeatureList getPolygonListByCd(
String chnDtctId, String cdObjectId, List<String> cdObjectIds) {
String chnDtctId, String cdObjectId, List<String> cdObjectIds, String pnu) {
BooleanBuilder builder = new BooleanBuilder();
builder.and(mapSheetLearnEntity.uid.eq(chnDtctId));
builder.and(
mapSheetAnalDataInferenceGeomEntity
.resultUid
.eq(chnDtctId)
.or(mapSheetAnalDataInferenceGeomEntity.resultUid.in(cdObjectIds)));
List<ChangeDetectionDto.PolygonQueryData> list =
// pnu가 들어온 경우
boolean hasPnu = pnu != null && !pnu.isBlank();
if (!hasPnu) {
builder.and(
mapSheetAnalDataInferenceGeomEntity
.resultUid
.eq(chnDtctId)
.or(mapSheetAnalDataInferenceGeomEntity.resultUid.in(cdObjectIds)));
}
// List<ChangeDetectionDto.PolygonQueryData> list =
JPAQuery<PolygonQueryData> query =
queryFactory
.select(
Projections.constructor(
@@ -425,10 +435,22 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
.innerJoin(mapSheetAnalInferenceEntity)
.on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalDataInferenceEntity.analUid))
.innerJoin(mapSheetLearnEntity)
.on(mapSheetLearnEntity.id.eq(mapSheetAnalInferenceEntity.learnId))
.where(builder)
.orderBy(mapSheetAnalDataInferenceGeomEntity.mapSheetNum.asc())
.fetch();
.on(mapSheetLearnEntity.id.eq(mapSheetAnalInferenceEntity.learnId));
// .where(builder)
// .orderBy(mapSheetAnalDataInferenceGeomEntity.mapSheetNum.asc());
// .fetch();
// 🔥 pnu 조건이면 tb_pnu join 추가
if (hasPnu) {
query
.innerJoin(pnuEntity)
.on(pnuEntity.geo.geoUid.eq(mapSheetAnalDataInferenceGeomEntity.geoUid));
builder.and(pnuEntity.pnu.eq(pnu));
}
List<ChangeDetectionDto.PolygonQueryData> list =
query.where(builder).orderBy(mapSheetAnalDataInferenceGeomEntity.mapSheetNum.asc()).fetch();
ObjectMapper mapper = new ObjectMapper();
List<ChangeDetectionDto.PolygonFeature> result =
@@ -470,16 +492,23 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
@Override
public PointFeatureList getPointListByCd(
String chnDtctId, String cdObjectId, List<String> cdObjectIds) {
String chnDtctId, String cdObjectId, List<String> cdObjectIds, String pnu) {
BooleanBuilder builder = new BooleanBuilder();
builder.and(mapSheetLearnEntity.uid.eq(chnDtctId));
builder.and(
mapSheetAnalDataInferenceGeomEntity
.resultUid
.eq(chnDtctId)
.or(mapSheetAnalDataInferenceGeomEntity.resultUid.in(cdObjectIds)));
List<ChangeDetectionDto.PointQueryData> list =
// pnu가 들어온 경우
boolean hasPnu = pnu != null && !pnu.isBlank();
if (!hasPnu) {
builder.and(
mapSheetAnalDataInferenceGeomEntity
.resultUid
.eq(chnDtctId)
.or(mapSheetAnalDataInferenceGeomEntity.resultUid.in(cdObjectIds)));
}
// List<ChangeDetectionDto.PointQueryData> list =
JPAQuery<PointQueryData> query =
queryFactory
.select(
Projections.constructor(
@@ -498,9 +527,21 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
.innerJoin(mapSheetAnalInferenceEntity)
.on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalDataInferenceEntity.analUid))
.innerJoin(mapSheetLearnEntity)
.on(mapSheetLearnEntity.id.eq(mapSheetAnalInferenceEntity.learnId))
.where(builder)
.fetch();
.on(mapSheetLearnEntity.id.eq(mapSheetAnalInferenceEntity.learnId));
// .where(builder)
// .fetch();
// 🔥 pnu 조건이면 tb_pnu join 추가
if (hasPnu) {
query
.innerJoin(pnuEntity)
.on(pnuEntity.geo.geoUid.eq(mapSheetAnalDataInferenceGeomEntity.geoUid));
builder.and(pnuEntity.pnu.eq(pnu));
}
List<ChangeDetectionDto.PointQueryData> list =
query.where(builder).orderBy(mapSheetAnalDataInferenceGeomEntity.mapSheetNum.asc()).fetch();
ObjectMapper mapper = new ObjectMapper();
List<ChangeDetectionDto.PointFeature> result =