추론관리 api 수정, 분석된 도엽 목록 추가
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package com.kamco.cd.kamcoback.postgres.core;
|
||||
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Dashboard;
|
||||
import com.kamco.cd.kamcoback.postgres.repository.Inference.InferenceResultRepository;
|
||||
import jakarta.persistence.EntityNotFoundException;
|
||||
import java.util.List;
|
||||
@@ -22,7 +21,7 @@ public class InferenceResultCoreService {
|
||||
* @return
|
||||
*/
|
||||
public Page<InferenceResultDto.AnalResList> getInferenceResultList(
|
||||
InferenceResultDto.SearchReq searchReq) {
|
||||
InferenceResultDto.SearchReq searchReq) {
|
||||
return inferenceResultRepository.getInferenceResultList(searchReq);
|
||||
}
|
||||
|
||||
@@ -34,25 +33,12 @@ public class InferenceResultCoreService {
|
||||
*/
|
||||
public InferenceResultDto.AnalResSummary getInferenceResultSummary(Long id) {
|
||||
InferenceResultDto.AnalResSummary summary =
|
||||
inferenceResultRepository
|
||||
.getInferenceResultSummary(id)
|
||||
.orElseThrow(() -> new EntityNotFoundException("요약정보를 찾을 수 없습니다. " + id));
|
||||
inferenceResultRepository
|
||||
.getInferenceResultSummary(id)
|
||||
.orElseThrow(() -> new EntityNotFoundException("요약정보를 찾을 수 없습니다. " + id));
|
||||
return summary;
|
||||
}
|
||||
|
||||
/**
|
||||
* 분석결과 대시보드 조회
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public List<Dashboard> getInferenceResultDashboard(Long id) {
|
||||
return null;
|
||||
// inferenceResultRepository.getInferenceResultDashboard(id).stream()
|
||||
// .map(MapSheetAnalSttcEntity::toDto)
|
||||
// .toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 분석결과 상세 목록
|
||||
*
|
||||
@@ -60,12 +46,17 @@ public class InferenceResultCoreService {
|
||||
* @return
|
||||
*/
|
||||
public Page<InferenceResultDto.Geom> getInferenceResultGeomList(
|
||||
InferenceResultDto.SearchGeoReq searchGeoReq) {
|
||||
return inferenceResultRepository.getInferenceGeomList(searchGeoReq);
|
||||
Long id, InferenceResultDto.SearchGeoReq searchGeoReq) {
|
||||
return inferenceResultRepository.getInferenceGeomList(id, searchGeoReq);
|
||||
}
|
||||
|
||||
/**
|
||||
* 추론된 5000:1 도엽 목록
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public List<Long> getSheets(Long id) {
|
||||
return inferenceResultRepository.getSheets(id);
|
||||
}
|
||||
//
|
||||
// public List<Long> getSheets(
|
||||
// return inferenceResultRepository.get
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -21,8 +21,13 @@ import org.locationtech.jts.geom.Geometry;
|
||||
public class MapSheetAnalDataGeomEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "tb_map_sheet_anal_data_geom_id_gen")
|
||||
@SequenceGenerator(name = "tb_map_sheet_anal_data_geom_id_gen", sequenceName = "tb_map_sheet_learn_data_geom_geom_uid", allocationSize = 1)
|
||||
@GeneratedValue(
|
||||
strategy = GenerationType.SEQUENCE,
|
||||
generator = "tb_map_sheet_anal_data_geom_id_gen")
|
||||
@SequenceGenerator(
|
||||
name = "tb_map_sheet_anal_data_geom_id_gen",
|
||||
sequenceName = "tb_map_sheet_learn_data_geom_geom_uid",
|
||||
allocationSize = 1)
|
||||
@Column(name = "geo_uid", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@@ -119,6 +124,7 @@ public class MapSheetAnalDataGeomEntity {
|
||||
|
||||
@Column(name = "fit_state_cmmnt", length = Integer.MAX_VALUE)
|
||||
private String fitStateCmmnt;
|
||||
|
||||
@Column(name = "ref_map_sheet_num")
|
||||
private Long refMapSheetNum;
|
||||
|
||||
@@ -127,6 +133,4 @@ public class MapSheetAnalDataGeomEntity {
|
||||
|
||||
@Column(name = "geom_center", columnDefinition = "geometry")
|
||||
private Geometry geomCenter;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.ZonedDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
@@ -17,8 +17,7 @@ import org.hibernate.annotations.ColumnDefault;
|
||||
@Table(name = "tb_map_sheet_anal_sttc")
|
||||
public class MapSheetAnalSttcEntity {
|
||||
|
||||
@EmbeddedId
|
||||
private MapSheetAnalSttcEntityId id;
|
||||
@EmbeddedId private MapSheetAnalSttcEntityId id;
|
||||
|
||||
@ColumnDefault("0")
|
||||
@Column(name = "class_before_cnt")
|
||||
@@ -30,14 +29,14 @@ public class MapSheetAnalSttcEntity {
|
||||
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "created_dttm")
|
||||
private OffsetDateTime createdDttm;
|
||||
private ZonedDateTime createdDttm;
|
||||
|
||||
@Column(name = "created_uid")
|
||||
private Long createdUid;
|
||||
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "updated_dttm")
|
||||
private OffsetDateTime updatedDttm;
|
||||
private ZonedDateTime updatedDttm;
|
||||
|
||||
@Column(name = "updated_uid")
|
||||
private Long updatedUid;
|
||||
@@ -57,5 +56,4 @@ public class MapSheetAnalSttcEntity {
|
||||
@Size(max = 30)
|
||||
@Column(name = "class_after_cd", length = 30)
|
||||
private String classAfterCd;
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.hibernate.Hibernate;
|
||||
public class MapSheetAnalSttcEntityId implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 2285491656408229553L;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "compare_yyyy", nullable = false)
|
||||
private Integer compareYyyy;
|
||||
@@ -36,14 +37,13 @@ public class MapSheetAnalSttcEntityId implements Serializable {
|
||||
return false;
|
||||
}
|
||||
MapSheetAnalSttcEntityId entity = (MapSheetAnalSttcEntityId) o;
|
||||
return Objects.equals(this.targetYyyy, entity.targetYyyy) &&
|
||||
Objects.equals(this.compareYyyy, entity.compareYyyy) &&
|
||||
Objects.equals(this.mapSheetNum, entity.mapSheetNum);
|
||||
return Objects.equals(this.targetYyyy, entity.targetYyyy)
|
||||
&& Objects.equals(this.compareYyyy, entity.compareYyyy)
|
||||
&& Objects.equals(this.mapSheetNum, entity.mapSheetNum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(targetYyyy, compareYyyy, mapSheetNum);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.Inference;
|
||||
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalSttcEntity;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -9,13 +8,12 @@ import org.springframework.data.domain.Page;
|
||||
public interface InferenceResultRepositoryCustom {
|
||||
|
||||
Page<InferenceResultDto.AnalResList> getInferenceResultList(
|
||||
InferenceResultDto.SearchReq searchReq);
|
||||
InferenceResultDto.SearchReq searchReq);
|
||||
|
||||
Optional<InferenceResultDto.AnalResSummary> getInferenceResultSummary(Long id);
|
||||
|
||||
List<MapSheetAnalSttcEntity> getInferenceResultDashboard(Long id);
|
||||
|
||||
Page<InferenceResultDto.Geom> getInferenceGeomList(InferenceResultDto.SearchGeoReq searchGeoReq);
|
||||
Page<InferenceResultDto.Geom> getInferenceGeomList(
|
||||
Long id, InferenceResultDto.SearchGeoReq searchGeoReq);
|
||||
|
||||
List<Long> getSheets(Long id);
|
||||
}
|
||||
|
||||
@@ -2,11 +2,9 @@ package com.kamco.cd.kamcoback.postgres.repository.Inference;
|
||||
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.SearchGeoReq;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalSttcEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataGeomEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalSttcEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QModelMngEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QModelVerEntity;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
@@ -30,12 +28,11 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
private final JPAQueryFactory queryFactory;
|
||||
private final QModelMngEntity tmm = QModelMngEntity.modelMngEntity;
|
||||
private final QModelVerEntity tmv = QModelVerEntity.modelVerEntity;
|
||||
private final QMapSheetAnalEntity mapSheetAnal = QMapSheetAnalEntity.mapSheetAnalEntity;
|
||||
private final QMapSheetAnalDataEntity mapSheetAnalEntity = QMapSheetAnalDataEntity.mapSheetAnalDataEntity;
|
||||
private final QMapSheetAnalSttcEntity mapSheetAnalSttc =
|
||||
QMapSheetAnalSttcEntity.mapSheetAnalSttcEntity;
|
||||
private final QMapSheetAnalDataGeomEntity mapSheetAnalDataGeom =
|
||||
QMapSheetAnalDataGeomEntity.mapSheetAnalDataGeomEntity;
|
||||
private final QMapSheetAnalEntity mapSheetAnalEntity = QMapSheetAnalEntity.mapSheetAnalEntity;
|
||||
private final QMapSheetAnalDataEntity mapSheetAnalDataEntity =
|
||||
QMapSheetAnalDataEntity.mapSheetAnalDataEntity;
|
||||
private final QMapSheetAnalDataGeomEntity mapSheetAnalDataGeomEntity =
|
||||
QMapSheetAnalDataGeomEntity.mapSheetAnalDataGeomEntity;
|
||||
|
||||
/**
|
||||
* 분석결과 목록 조회
|
||||
@@ -45,45 +42,49 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
*/
|
||||
@Override
|
||||
public Page<InferenceResultDto.AnalResList> getInferenceResultList(
|
||||
InferenceResultDto.SearchReq searchReq) {
|
||||
InferenceResultDto.SearchReq searchReq) {
|
||||
Pageable pageable = searchReq.toPageable();
|
||||
// "0000" 전체조회
|
||||
BooleanBuilder builder = new BooleanBuilder();
|
||||
if (searchReq.getStatCode() != null && !"0000".equals(searchReq.getStatCode())) {
|
||||
builder.and(mapSheetAnal.analState.eq(searchReq.getStatCode()));
|
||||
builder.and(mapSheetAnalEntity.analState.eq(searchReq.getStatCode()));
|
||||
}
|
||||
|
||||
// 제목
|
||||
if (searchReq.getTitle() != null) {
|
||||
builder.and(mapSheetAnal.analTitle.like("%" + searchReq.getTitle() + "%"));
|
||||
builder.and(mapSheetAnalEntity.analTitle.like("%" + searchReq.getTitle() + "%"));
|
||||
}
|
||||
|
||||
List<InferenceResultDto.AnalResList> content =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
InferenceResultDto.AnalResList.class,
|
||||
mapSheetAnal.id,
|
||||
mapSheetAnal.analTitle,
|
||||
mapSheetAnal.analMapSheet,
|
||||
mapSheetAnal.detectingCnt,
|
||||
mapSheetAnal.analStrtDttm,
|
||||
mapSheetAnal.analEndDttm,
|
||||
mapSheetAnal.analSec,
|
||||
mapSheetAnal.analPredSec,
|
||||
mapSheetAnal.analState,
|
||||
Expressions.stringTemplate(
|
||||
"fn_code_name({0}, {1})", "0002", mapSheetAnal.analState),
|
||||
mapSheetAnal.gukyuinUsed))
|
||||
.from(mapSheetAnal)
|
||||
.where(builder)
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.orderBy(mapSheetAnal.createdDttm.desc())
|
||||
.fetch();
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
InferenceResultDto.AnalResList.class,
|
||||
mapSheetAnalEntity.id,
|
||||
mapSheetAnalEntity.analTitle,
|
||||
mapSheetAnalEntity.analMapSheet,
|
||||
mapSheetAnalEntity.detectingCnt,
|
||||
mapSheetAnalEntity.analStrtDttm,
|
||||
mapSheetAnalEntity.analEndDttm,
|
||||
mapSheetAnalEntity.analSec,
|
||||
mapSheetAnalEntity.analPredSec,
|
||||
mapSheetAnalEntity.analState,
|
||||
Expressions.stringTemplate(
|
||||
"fn_code_name({0}, {1})", "0002", mapSheetAnalEntity.analState),
|
||||
mapSheetAnalEntity.gukyuinUsed))
|
||||
.from(mapSheetAnalEntity)
|
||||
.where(builder)
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.orderBy(mapSheetAnalEntity.createdDttm.desc())
|
||||
.fetch();
|
||||
|
||||
long total =
|
||||
queryFactory.select(mapSheetAnal.id).from(mapSheetAnal).where(builder).fetchCount();
|
||||
queryFactory
|
||||
.select(mapSheetAnalEntity.id)
|
||||
.from(mapSheetAnalEntity)
|
||||
.where(builder)
|
||||
.fetchCount();
|
||||
|
||||
return new PageImpl<>(content, pageable, total);
|
||||
}
|
||||
@@ -99,55 +100,40 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
|
||||
// 1. 최신 버전 UID를 가져오는 서브쿼리
|
||||
JPQLQuery<Long> latestVerUidSub =
|
||||
JPAExpressions.select(tmv.id.max()).from(tmv).where(tmv.modelUid.eq(tmm.id));
|
||||
JPAExpressions.select(tmv.id.max()).from(tmv).where(tmv.modelUid.eq(tmm.id));
|
||||
|
||||
Optional<InferenceResultDto.AnalResSummary> content =
|
||||
Optional.ofNullable(
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
InferenceResultDto.AnalResSummary.class,
|
||||
mapSheetAnal.id,
|
||||
mapSheetAnal.analTitle,
|
||||
tmm.modelNm.concat(" ").concat(tmv.modelVer).as("modelInfo"),
|
||||
mapSheetAnal.targetYyyy,
|
||||
mapSheetAnal.compareYyyy,
|
||||
mapSheetAnal.analMapSheet,
|
||||
mapSheetAnal.analStrtDttm,
|
||||
mapSheetAnal.analEndDttm,
|
||||
mapSheetAnal.analSec,
|
||||
mapSheetAnal.analPredSec,
|
||||
mapSheetAnal.resultUrl,
|
||||
mapSheetAnal.detectingCnt,
|
||||
mapSheetAnal.accuracy,
|
||||
mapSheetAnal.analState,
|
||||
Expressions.stringTemplate(
|
||||
"fn_code_name({0}, {1})", "0002", mapSheetAnal.analState)))
|
||||
.from(mapSheetAnal)
|
||||
.leftJoin(tmm)
|
||||
.on(mapSheetAnal.modelUid.eq(tmm.id))
|
||||
.leftJoin(tmv)
|
||||
.on(tmv.modelUid.eq(tmm.id).and(tmv.id.eq(latestVerUidSub)))
|
||||
.where(mapSheetAnal.id.eq(id))
|
||||
.fetchOne());
|
||||
Optional.ofNullable(
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
InferenceResultDto.AnalResSummary.class,
|
||||
mapSheetAnalEntity.id,
|
||||
mapSheetAnalEntity.analTitle,
|
||||
tmm.modelNm.concat(" ").concat(tmv.modelVer).as("modelInfo"),
|
||||
mapSheetAnalEntity.targetYyyy,
|
||||
mapSheetAnalEntity.compareYyyy,
|
||||
mapSheetAnalEntity.analMapSheet,
|
||||
mapSheetAnalEntity.analStrtDttm,
|
||||
mapSheetAnalEntity.analEndDttm,
|
||||
mapSheetAnalEntity.analSec,
|
||||
mapSheetAnalEntity.analPredSec,
|
||||
mapSheetAnalEntity.resultUrl,
|
||||
mapSheetAnalEntity.detectingCnt,
|
||||
mapSheetAnalEntity.accuracy,
|
||||
mapSheetAnalEntity.analState,
|
||||
Expressions.stringTemplate(
|
||||
"fn_code_name({0}, {1})", "0002", mapSheetAnalEntity.analState)))
|
||||
.from(mapSheetAnalEntity)
|
||||
.leftJoin(tmm)
|
||||
.on(mapSheetAnalEntity.modelUid.eq(tmm.id))
|
||||
.leftJoin(tmv)
|
||||
.on(tmv.modelUid.eq(tmm.id).and(tmv.id.eq(latestVerUidSub)))
|
||||
.where(mapSheetAnalEntity.id.eq(id))
|
||||
.fetchOne());
|
||||
return content;
|
||||
}
|
||||
|
||||
/**
|
||||
* 분석결과 상세 대시보드 조회
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<MapSheetAnalSttcEntity> getInferenceResultDashboard(Long id) {
|
||||
return queryFactory
|
||||
.select(mapSheetAnalSttc)
|
||||
.from(mapSheetAnalSttc)
|
||||
.where(mapSheetAnalSttc.dataUid.eq(id))
|
||||
.fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 분석결과 상세 목록
|
||||
*
|
||||
@@ -155,52 +141,61 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<InferenceResultDto.Geom> getInferenceGeomList(SearchGeoReq searchGeoReq) {
|
||||
public Page<InferenceResultDto.Geom> getInferenceGeomList(Long id, SearchGeoReq searchGeoReq) {
|
||||
Pageable pageable = searchGeoReq.toPageable();
|
||||
BooleanBuilder builder = new BooleanBuilder();
|
||||
|
||||
// 추론결과 id
|
||||
builder.and(mapSheetAnalEntity.id.eq(id));
|
||||
|
||||
// 기준년도 분류
|
||||
if (searchGeoReq.getTargetClass() != null && !searchGeoReq.getTargetClass().equals("")) {
|
||||
builder.and(mapSheetAnalDataGeom.classAfterCd.eq(searchGeoReq.getTargetClass()));
|
||||
builder.and(mapSheetAnalDataGeomEntity.classAfterCd.eq(searchGeoReq.getTargetClass()));
|
||||
}
|
||||
|
||||
// 비교년도 분류
|
||||
if (searchGeoReq.getCompareClass() != null && !searchGeoReq.getCompareClass().equals("")) {
|
||||
builder.and(mapSheetAnalDataGeom.classBeforeCd.eq(searchGeoReq.getCompareClass()));
|
||||
builder.and(mapSheetAnalDataGeomEntity.classBeforeCd.eq(searchGeoReq.getCompareClass()));
|
||||
}
|
||||
|
||||
// 분석도엽
|
||||
if (searchGeoReq.getMapSheetNum() != null && !searchGeoReq.getMapSheetNum().isEmpty()) {
|
||||
List<Long> mapSheetNum = searchGeoReq.getMapSheetNum();
|
||||
builder.and(mapSheetAnalDataGeom.mapSheetNum.in(mapSheetNum));
|
||||
builder.and(mapSheetAnalDataGeomEntity.mapSheetNum.in(mapSheetNum));
|
||||
}
|
||||
|
||||
List<InferenceResultDto.Geom> content =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
InferenceResultDto.Geom.class,
|
||||
mapSheetAnalDataGeom.compareYyyy,
|
||||
mapSheetAnalDataGeom.targetYyyy,
|
||||
mapSheetAnalDataGeom.classBeforeCd,
|
||||
Expressions.stringTemplate(
|
||||
"fn_code_name({0}, {1})", "0000", mapSheetAnalDataGeom.classBeforeCd),
|
||||
mapSheetAnalDataGeom.classBeforeProb,
|
||||
mapSheetAnalDataGeom.classAfterCd,
|
||||
Expressions.stringTemplate(
|
||||
"fn_code_name({0}, {1})", "0000", mapSheetAnalDataGeom.classAfterCd),
|
||||
mapSheetAnalDataGeom.classAfterProb,
|
||||
mapSheetAnalDataGeom.mapSheetNum))
|
||||
.from(mapSheetAnalDataGeom)
|
||||
.where(builder)
|
||||
.fetch();
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
InferenceResultDto.Geom.class,
|
||||
mapSheetAnalDataGeomEntity.compareYyyy,
|
||||
mapSheetAnalDataGeomEntity.targetYyyy,
|
||||
mapSheetAnalDataGeomEntity.classBeforeCd,
|
||||
mapSheetAnalDataGeomEntity.classBeforeProb,
|
||||
mapSheetAnalDataGeomEntity.classAfterCd,
|
||||
mapSheetAnalDataGeomEntity.classAfterProb,
|
||||
mapSheetAnalDataGeomEntity.mapSheetNum,
|
||||
mapSheetAnalDataGeomEntity.geom,
|
||||
mapSheetAnalDataGeomEntity.geomCenter))
|
||||
.from(mapSheetAnalEntity)
|
||||
.join(mapSheetAnalDataEntity)
|
||||
.on(mapSheetAnalDataEntity.analUid.eq(mapSheetAnalEntity.id))
|
||||
.join(mapSheetAnalDataGeomEntity)
|
||||
.on(mapSheetAnalDataGeomEntity.dataUid.eq(mapSheetAnalDataEntity.id))
|
||||
.where(builder)
|
||||
.fetch();
|
||||
|
||||
long total =
|
||||
queryFactory
|
||||
.select(mapSheetAnalDataGeom.id)
|
||||
.from(mapSheetAnalDataGeom)
|
||||
.where(builder)
|
||||
.fetchCount();
|
||||
queryFactory
|
||||
.select(mapSheetAnalDataGeomEntity.id)
|
||||
.from(mapSheetAnalEntity)
|
||||
.join(mapSheetAnalDataEntity)
|
||||
.on(mapSheetAnalDataEntity.analUid.eq(mapSheetAnalEntity.id))
|
||||
.join(mapSheetAnalDataGeomEntity)
|
||||
.on(mapSheetAnalDataGeomEntity.dataUid.eq(mapSheetAnalDataEntity.id))
|
||||
.where(builder)
|
||||
.fetchCount();
|
||||
|
||||
return new PageImpl<>(content, pageable, total);
|
||||
}
|
||||
@@ -214,12 +209,14 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
@Override
|
||||
public List<Long> getSheets(Long id) {
|
||||
return queryFactory
|
||||
.select(mapSheetAnalDataGeom.mapSheetNum)
|
||||
.from(mapSheetAnal)
|
||||
.join(mapSheetAnalEntity).on(mapSheetAnalEntity.analUid.eq(mapSheetAnal.id))
|
||||
.join(mapSheetAnalDataGeom).on(mapSheetAnalDataGeom.dataUid.eq(mapSheetAnalEntity.id))
|
||||
.where(mapSheetAnal.id.eq(id))
|
||||
.groupBy(mapSheetAnalDataGeom.mapSheetNum)
|
||||
.fetch();
|
||||
.select(mapSheetAnalDataGeomEntity.mapSheetNum)
|
||||
.from(mapSheetAnalEntity)
|
||||
.join(mapSheetAnalDataEntity)
|
||||
.on(mapSheetAnalDataEntity.analUid.eq(mapSheetAnalEntity.id))
|
||||
.join(mapSheetAnalDataGeomEntity)
|
||||
.on(mapSheetAnalDataGeomEntity.dataUid.eq(mapSheetAnalDataEntity.id))
|
||||
.where(mapSheetAnalEntity.id.eq(id))
|
||||
.groupBy(mapSheetAnalDataGeomEntity.mapSheetNum)
|
||||
.fetch();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,8 @@ public interface MapSheetLearnDataGeomRepository
|
||||
|
||||
/** 데이터 UID로 유효하지 않은 지오메트리 데이터만 조건부 삭제 (안전성을 위해 직접 사용 금지) */
|
||||
@Deprecated
|
||||
@Query("DELETE FROM MapSheetLearnDataGeomEntity g WHERE g.dataUid = :dataUid AND (g.geom IS NULL OR g.geom.isEmpty() = true)")
|
||||
@Query(
|
||||
"DELETE FROM MapSheetLearnDataGeomEntity g WHERE g.dataUid = :dataUid AND (g.geom IS NULL OR g.geom.isEmpty() = true)")
|
||||
@Modifying
|
||||
@Transactional
|
||||
void deleteInvalidGeometryByDataUid(@Param("dataUid") Long dataUid);
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.util.List;
|
||||
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
|
||||
|
||||
public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
|
||||
implements ChangeDetectionRepositoryCustom {
|
||||
implements ChangeDetectionRepositoryCustom {
|
||||
|
||||
private final JPAQueryFactory queryFactory;
|
||||
|
||||
@@ -36,75 +36,75 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
|
||||
@Override
|
||||
public List<String> findPolygonJson() {
|
||||
return queryFactory
|
||||
.select(Expressions.stringTemplate("ST_AsGeoJSON({0})", mapSheetAnalDataGeomEntity.geom))
|
||||
.from(mapSheetAnalDataGeomEntity)
|
||||
.orderBy(mapSheetAnalDataGeomEntity.id.desc())
|
||||
.fetch();
|
||||
.select(Expressions.stringTemplate("ST_AsGeoJSON({0})", mapSheetAnalDataGeomEntity.geom))
|
||||
.from(mapSheetAnalDataGeomEntity)
|
||||
.orderBy(mapSheetAnalDataGeomEntity.id.desc())
|
||||
.fetch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ChangeDetectionDto.CountDto> getChangeDetectionClassCount(Long id) {
|
||||
return queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
ChangeDetectionDto.CountDto.class,
|
||||
mapSheetAnalSttcEntity.classAfterCd.toUpperCase(),
|
||||
null, // TOOD classAfterName 삭제해서 수정 필요
|
||||
mapSheetAnalSttcEntity.classAfterCnt.sum()))
|
||||
.from(mapSheetAnalEntity)
|
||||
.innerJoin(mapSheetAnalDataEntity)
|
||||
.on(mapSheetAnalDataEntity.analUid.eq(mapSheetAnalEntity.id))
|
||||
.innerJoin(mapSheetAnalSttcEntity)
|
||||
.on(mapSheetAnalSttcEntity.dataUid.eq(mapSheetAnalDataEntity.id))
|
||||
.where(mapSheetAnalEntity.id.eq(id))
|
||||
.groupBy(mapSheetAnalSttcEntity.classAfterCd)
|
||||
.fetch();
|
||||
.select(
|
||||
Projections.constructor(
|
||||
ChangeDetectionDto.CountDto.class,
|
||||
mapSheetAnalSttcEntity.classAfterCd.toUpperCase(),
|
||||
null, // TOOD classAfterName 삭제해서 수정 필요
|
||||
mapSheetAnalSttcEntity.classAfterCnt.sum()))
|
||||
.from(mapSheetAnalEntity)
|
||||
.innerJoin(mapSheetAnalDataEntity)
|
||||
.on(mapSheetAnalDataEntity.analUid.eq(mapSheetAnalEntity.id))
|
||||
.innerJoin(mapSheetAnalSttcEntity)
|
||||
.on(mapSheetAnalSttcEntity.dataUid.eq(mapSheetAnalDataEntity.id))
|
||||
.where(mapSheetAnalEntity.id.eq(id))
|
||||
.groupBy(mapSheetAnalSttcEntity.classAfterCd)
|
||||
.fetch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChangeDetectionDto.CogUrlDto getChangeDetectionCogUrl(ChangeDetectionDto.CogUrlReq req) {
|
||||
return queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
ChangeDetectionDto.CogUrlDto.class,
|
||||
makeCogUrl(req.getBeforeYear()).max().as("beforeCogUrl"),
|
||||
makeCogUrl(req.getAfterYear()).max().as("afterCogUrl"),
|
||||
mapInkx5kEntity.geom.as("bbox")))
|
||||
.from(imageryEntity)
|
||||
.innerJoin(mapInkx5kEntity)
|
||||
.on(imageryEntity.scene5k.eq(mapInkx5kEntity.mapidcdNo))
|
||||
.where(
|
||||
imageryEntity
|
||||
.year
|
||||
.eq(req.getBeforeYear())
|
||||
.or(imageryEntity.year.eq(req.getAfterYear())),
|
||||
imageryEntity.scene5k.eq(req.getMapSheetNum()))
|
||||
.groupBy(mapInkx5kEntity.geom)
|
||||
.fetchOne();
|
||||
.select(
|
||||
Projections.constructor(
|
||||
ChangeDetectionDto.CogUrlDto.class,
|
||||
makeCogUrl(req.getBeforeYear()).max().as("beforeCogUrl"),
|
||||
makeCogUrl(req.getAfterYear()).max().as("afterCogUrl"),
|
||||
mapInkx5kEntity.geom.as("bbox")))
|
||||
.from(imageryEntity)
|
||||
.innerJoin(mapInkx5kEntity)
|
||||
.on(imageryEntity.scene5k.eq(mapInkx5kEntity.mapidcdNo))
|
||||
.where(
|
||||
imageryEntity
|
||||
.year
|
||||
.eq(req.getBeforeYear())
|
||||
.or(imageryEntity.year.eq(req.getAfterYear())),
|
||||
imageryEntity.scene5k.eq(req.getMapSheetNum()))
|
||||
.groupBy(mapInkx5kEntity.geom)
|
||||
.fetchOne();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ChangeDetectionDto.AnalYearList> getChangeDetectionYearList() {
|
||||
return queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
ChangeDetectionDto.AnalYearList.class,
|
||||
mapSheetAnalEntity.id,
|
||||
mapSheetAnalEntity.analTitle,
|
||||
mapSheetAnalEntity.compareYyyy.as("beforeYear"),
|
||||
mapSheetAnalEntity.targetYyyy.as("afterYear"),
|
||||
mapSheetAnalEntity.baseMapSheetNum))
|
||||
.from(mapSheetAnalEntity)
|
||||
.orderBy(mapSheetAnalEntity.id.asc())
|
||||
.fetch();
|
||||
.select(
|
||||
Projections.constructor(
|
||||
ChangeDetectionDto.AnalYearList.class,
|
||||
mapSheetAnalEntity.id,
|
||||
mapSheetAnalEntity.analTitle,
|
||||
mapSheetAnalEntity.compareYyyy.as("beforeYear"),
|
||||
mapSheetAnalEntity.targetYyyy.as("afterYear"),
|
||||
mapSheetAnalEntity.baseMapSheetNum))
|
||||
.from(mapSheetAnalEntity)
|
||||
.orderBy(mapSheetAnalEntity.id.asc())
|
||||
.fetch();
|
||||
}
|
||||
|
||||
private StringExpression makeCogUrl(Integer year) {
|
||||
return new CaseBuilder()
|
||||
.when(imageryEntity.year.eq(year))
|
||||
.then(
|
||||
Expressions.stringTemplate(
|
||||
"{0} || {1}", imageryEntity.cogMiddlePath, imageryEntity.cogFilename))
|
||||
.otherwise("");
|
||||
.when(imageryEntity.year.eq(year))
|
||||
.then(
|
||||
Expressions.stringTemplate(
|
||||
"{0} || {1}", imageryEntity.cogMiddlePath, imageryEntity.cogFilename))
|
||||
.otherwise("");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user