주석 추가, 패스워드변경 권한 수정
This commit is contained in:
@@ -453,17 +453,30 @@ public class InferenceResultCoreService {
|
||||
* @return
|
||||
*/
|
||||
public AnalResultInfo getInferenceResultInfo(UUID uuid) {
|
||||
// 추론 결과 정보조회
|
||||
AnalResultInfo resultInfo = mapSheetLearnRepository.getInferenceResultInfo(uuid);
|
||||
// bbox, point 조회
|
||||
BboxPointDto bboxPointDto = mapSheetLearnRepository.getBboxPoint(uuid);
|
||||
resultInfo.setBboxGeom(bboxPointDto.getBboxGeom());
|
||||
resultInfo.setBboxCenterPoint(bboxPointDto.getBboxCenterPoint());
|
||||
return resultInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 분류별 탐지건수 조회
|
||||
*
|
||||
* @param uuid 추론 uuid
|
||||
* @return 분류별 탐지건수 정보
|
||||
*/
|
||||
public List<Dashboard> getInferenceClassCountList(UUID uuid) {
|
||||
return mapSheetLearnRepository.getInferenceClassCountList(uuid);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param uuid 추론 uuid
|
||||
* @param searchGeoReq 추론 결과 상세화면 geom 조회 조건
|
||||
* @return geom 목록 정보
|
||||
*/
|
||||
public Page<Geom> getInferenceGeomList(UUID uuid, SearchGeoReq searchGeoReq) {
|
||||
return mapSheetLearnRepository.getInferenceGeomList(uuid, searchGeoReq);
|
||||
}
|
||||
|
||||
@@ -291,40 +291,6 @@ public class MapSheetMngCoreService {
|
||||
return sceneInference;
|
||||
}
|
||||
|
||||
/**
|
||||
* 변화탐지 실행 가능 기준 년도 조회
|
||||
*
|
||||
* @param compareYear 비교 연도
|
||||
* @param targetYear 기준 연도
|
||||
* @param mapSheetScope 부분실행, 전체실행
|
||||
* @param mapSheetNums 도엽번호 목록
|
||||
* @return 실행가능한 도엽번호 목록
|
||||
*/
|
||||
public List<MngListDto> findExecutableSheets(
|
||||
Integer compareYear, Integer targetYear, String mapSheetScope, List<String> mapSheetNums) {
|
||||
return mapSheetMngRepository.findExecutableSheets(
|
||||
compareYear, targetYear, mapSheetScope, mapSheetNums);
|
||||
}
|
||||
|
||||
public List<MngListDto> fetchBaseWithCompare(
|
||||
Integer compareYear, Integer targetYear, String mapSheetScope, List<String> mapSheetNums) {
|
||||
return mapSheetMngRepository.fetchBaseWithCompare(
|
||||
compareYear, targetYear, mapSheetScope, mapSheetNums);
|
||||
}
|
||||
|
||||
/**
|
||||
* 실행가능 도엽 count
|
||||
*
|
||||
* @param year 연도
|
||||
* @param mapSheetScope 부분, 전체 구분
|
||||
* @param mapSheetNums 도엽 목록
|
||||
* @return count
|
||||
*/
|
||||
public int countExecutableSheetsDistinct(
|
||||
Integer year, String mapSheetScope, List<String> mapSheetNums) {
|
||||
return mapSheetMngRepository.countExecutableSheetsDistinct(year, mapSheetScope, mapSheetNums);
|
||||
}
|
||||
|
||||
public void updateMapSheetMngHstUploadId(Long hstUid, UUID uuid, String uploadId) {
|
||||
mapSheetMngRepository.updateMapSheetMngHstUploadId(hstUid, uuid, uploadId);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,16 @@ public class ModelMngCoreService {
|
||||
|
||||
private final ModelMngRepository modelMngRepository;
|
||||
|
||||
/**
|
||||
* 모델조회
|
||||
*
|
||||
* @param searchReq 페이징
|
||||
* @param startDate 시작날짜
|
||||
* @param endDate 종료날짜
|
||||
* @param modelType 모델 타입 G1, G2, G3
|
||||
* @param searchVal 모델 ver
|
||||
* @return 모델 목록
|
||||
*/
|
||||
public Page<ModelMngDto.ModelList> findModelMgmtList(
|
||||
ModelMngDto.searchReq searchReq,
|
||||
LocalDate startDate,
|
||||
|
||||
@@ -62,40 +62,6 @@ public interface MapSheetMngRepositoryCustom {
|
||||
|
||||
List<MapSheetMngDto.MngFilesDto> findByHstUidMapSheetFileList(Long hstUid);
|
||||
|
||||
/**
|
||||
* 추론 실행 가능 도엽 조회 (추론 제외)
|
||||
*
|
||||
* @param compareYear 비교 연도
|
||||
* @param targetYear 기준 연도
|
||||
* @param mapSheetScope 부분실행, 전체실행
|
||||
* @param mapSheetNums 도엽번호 목록
|
||||
* @return 실행가능한 도엽번호 목록
|
||||
*/
|
||||
List<MngListDto> findExecutableSheets(
|
||||
Integer compareYear, Integer targetYear, String mapSheetScope, List<String> mapSheetNums);
|
||||
|
||||
/**
|
||||
* 추론 실행 가능 도엽 조회 (이전년도 사용가능)
|
||||
*
|
||||
* @param targetYear
|
||||
* @param compareYear
|
||||
* @param mapSheetScope
|
||||
* @param mapSheetNums
|
||||
* @return
|
||||
*/
|
||||
List<MngListDto> fetchBaseWithCompare(
|
||||
Integer targetYear, Integer compareYear, String mapSheetScope, List<String> mapSheetNums);
|
||||
|
||||
/**
|
||||
* 실행가능 도엽 count
|
||||
*
|
||||
* @param year 연도
|
||||
* @param mapSheetScope 부분, 전체 구분
|
||||
* @param mapSheetNums 도엽 목록
|
||||
* @return count
|
||||
*/
|
||||
int countExecutableSheetsDistinct(Integer year, String mapSheetScope, List<String> mapSheetNums);
|
||||
|
||||
MapSheetMngDto.MngFilesDto findByFileUidMapSheetFile(Long fileUid);
|
||||
|
||||
void updateHstFileSizes(Long hstUid, long tifSizeBytes, long tfwSizeBytes, long totalSizeBytes);
|
||||
|
||||
@@ -22,7 +22,6 @@ import com.kamco.cd.kamcoback.postgres.entity.QMapSheetMngHstEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QYearEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.YearEntity;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
import com.querydsl.core.Tuple;
|
||||
import com.querydsl.core.types.Projections;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
import com.querydsl.core.types.dsl.CaseBuilder;
|
||||
@@ -35,11 +34,8 @@ import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.PersistenceContext;
|
||||
import jakarta.validation.Valid;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
@@ -577,204 +573,6 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
return foundContent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MngListDto> findExecutableSheets(
|
||||
Integer compareYear, Integer targetYear, String mapSheetScope, List<String> mapSheetNums) {
|
||||
|
||||
QMapSheetMngHstEntity t = new QMapSheetMngHstEntity("t");
|
||||
QMapSheetMngHstEntity c = new QMapSheetMngHstEntity("c");
|
||||
|
||||
QMapInkx5kEntity ti = new QMapInkx5kEntity("ti");
|
||||
QMapInkx5kEntity ci = new QMapInkx5kEntity("ci");
|
||||
|
||||
QMapSheetMngFileEntity tf = new QMapSheetMngFileEntity("tf");
|
||||
QMapSheetMngFileEntity cf = new QMapSheetMngFileEntity("cf");
|
||||
|
||||
BooleanBuilder whereBuilderere = new BooleanBuilder();
|
||||
whereBuilderere.and(t.dataState.eq("DONE"));
|
||||
whereBuilderere.and(t.syncState.eq("DONE").or(t.syncCheckState.eq("DONE")));
|
||||
whereBuilderere.and(t.useInference.eq("USE"));
|
||||
whereBuilderere.and(t.mngYyyy.eq(targetYear));
|
||||
|
||||
// target: tif + DONE 파일 존재
|
||||
whereBuilderere.and(
|
||||
JPAExpressions.selectOne()
|
||||
.from(tf)
|
||||
.where(tf.hstUid.eq(t.hstUid).and(tf.fileExt.eq("tif")).and(tf.fileState.eq("DONE")))
|
||||
.exists());
|
||||
|
||||
// PART scope면 prefix like 조건 추가
|
||||
BooleanBuilder likeBuilder = new BooleanBuilder();
|
||||
|
||||
if (MapSheetScope.PART.getId().equals(mapSheetScope)) {
|
||||
if (mapSheetNums == null || mapSheetNums.isEmpty()) {
|
||||
return List.of();
|
||||
}
|
||||
for (String prefix : mapSheetNums) {
|
||||
if (prefix == null || prefix.isBlank()) continue;
|
||||
likeBuilder.or(t.mapSheetNum.like(prefix.trim() + "%"));
|
||||
}
|
||||
if (likeBuilder.hasValue()) {
|
||||
whereBuilderere.and(likeBuilder);
|
||||
}
|
||||
}
|
||||
|
||||
// compare 조건은 EXISTS 서브쿼리 안에서 체크
|
||||
BooleanExpression compareExists =
|
||||
JPAExpressions.selectOne()
|
||||
.from(c)
|
||||
.join(ci)
|
||||
.on(ci.mapidcdNo.eq(c.mapSheetNum).and(ci.useInference.eq(CommonUseStatus.USE)))
|
||||
.where(
|
||||
c.mapSheetNum
|
||||
.eq(t.mapSheetNum) // 핵심: 같은 도엽번호
|
||||
.and(c.dataState.eq("DONE"))
|
||||
.and(c.syncState.eq("DONE").or(c.syncCheckState.eq("DONE")))
|
||||
.and(c.useInference.eq("USE"))
|
||||
.and(c.mngYyyy.eq(compareYear))
|
||||
.and(
|
||||
JPAExpressions.selectOne()
|
||||
.from(cf)
|
||||
.where(
|
||||
cf.hstUid
|
||||
.eq(c.hstUid)
|
||||
.and(cf.fileExt.eq("tif"))
|
||||
.and(cf.fileState.eq("DONE")))
|
||||
.exists()))
|
||||
.exists();
|
||||
|
||||
return queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
MngListDto.class,
|
||||
t.mngYyyy, // int mngYyyy
|
||||
t.mapSheetNum, // String mapSheetNum
|
||||
t.mapSheetName, // String mapSheetName
|
||||
Expressions.nullExpression(Integer.class),
|
||||
Expressions.nullExpression(Boolean.class)))
|
||||
.from(t)
|
||||
.join(ti)
|
||||
.on(ti.mapidcdNo.eq(t.mapSheetNum).and(ti.useInference.eq(CommonUseStatus.USE)))
|
||||
.where(whereBuilderere.and(compareExists))
|
||||
.distinct()
|
||||
.fetch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MngListDto> fetchBaseWithCompare(
|
||||
Integer compareYear, // 예: 2024 (비교 상한)
|
||||
Integer targetYear, // 예: 2026 (기준 고정)
|
||||
String mapSheetScope,
|
||||
List<String> mapSheetNums) {
|
||||
|
||||
QMapSheetMngHstEntity h = QMapSheetMngHstEntity.mapSheetMngHstEntity; // base
|
||||
QMapSheetMngHstEntity h2 = new QMapSheetMngHstEntity("h2"); // cmp
|
||||
QMapInkx5kEntity i = QMapInkx5kEntity.mapInkx5kEntity;
|
||||
QMapSheetMngFileEntity f = QMapSheetMngFileEntity.mapSheetMngFileEntity;
|
||||
QMapSheetMngFileEntity f2 = new QMapSheetMngFileEntity("f2");
|
||||
|
||||
// -----------------------
|
||||
// 공통: tif DONE exists
|
||||
// -----------------------
|
||||
BooleanExpression baseTifExists =
|
||||
JPAExpressions.selectOne()
|
||||
.from(f)
|
||||
.where(f.hstUid.eq(h.hstUid), f.fileExt.eq("tif"), f.fileState.eq("DONE"))
|
||||
.exists();
|
||||
|
||||
BooleanExpression cmpTifExists =
|
||||
JPAExpressions.selectOne()
|
||||
.from(f2)
|
||||
.where(f2.hstUid.eq(h2.hstUid), f2.fileExt.eq("tif"), f2.fileState.eq("DONE"))
|
||||
.exists();
|
||||
|
||||
// -----------------------
|
||||
// 1) base 조회 (CTE base)
|
||||
// -----------------------
|
||||
BooleanBuilder baseWhere =
|
||||
new BooleanBuilder()
|
||||
.and(h.mngYyyy.eq(targetYear))
|
||||
.and(h.dataState.eq("DONE"))
|
||||
.and(h.useInference.eq("USE"))
|
||||
.and(h.syncState.eq("DONE").or(h.syncCheckState.eq("DONE")))
|
||||
.and(baseTifExists);
|
||||
|
||||
// PART 조건
|
||||
if (MapSheetScope.PART.getId().equals(mapSheetScope)) {
|
||||
if (mapSheetNums == null || mapSheetNums.isEmpty()) return List.of();
|
||||
|
||||
BooleanBuilder like = new BooleanBuilder();
|
||||
for (String prefix : mapSheetNums) {
|
||||
if (prefix == null || prefix.isBlank()) continue;
|
||||
like.or(h.mapSheetNum.like(prefix.trim() + "%"));
|
||||
}
|
||||
if (!like.hasValue()) return List.of();
|
||||
baseWhere.and(like);
|
||||
}
|
||||
|
||||
// base: distinct map_sheet_num, mng_yyyy, map_sheet_name
|
||||
List<Tuple> baseTuples =
|
||||
queryFactory
|
||||
.select(h.mapSheetNum, h.mngYyyy, h.mapSheetName)
|
||||
.distinct()
|
||||
.from(h)
|
||||
.join(i)
|
||||
.on(i.mapidcdNo.eq(h.mapSheetNum), i.useInference.eq(CommonUseStatus.USE))
|
||||
.where(baseWhere)
|
||||
.fetch();
|
||||
|
||||
if (baseTuples.isEmpty()) return List.of();
|
||||
|
||||
List<String> baseNums = baseTuples.stream().map(t -> t.get(h.mapSheetNum)).toList();
|
||||
|
||||
// -----------------------
|
||||
// 2) cmp 집계 (CTE cmp)
|
||||
// map_sheet_num별 max(mng_yyyy <= 2024)
|
||||
// -----------------------
|
||||
List<Tuple> cmpTuples =
|
||||
queryFactory
|
||||
.select(h2.mapSheetNum, h2.mngYyyy.max())
|
||||
.from(h2)
|
||||
.where(
|
||||
h2.mapSheetNum.in(baseNums),
|
||||
h2.mngYyyy.loe(compareYear),
|
||||
h2.dataState.eq("DONE"),
|
||||
h2.useInference.eq("USE"),
|
||||
h2.syncState.eq("DONE").or(h2.syncCheckState.eq("DONE")),
|
||||
cmpTifExists)
|
||||
.groupBy(h2.mapSheetNum)
|
||||
.fetch();
|
||||
|
||||
Map<String, Integer> beforeYearMap = new HashMap<>(cmpTuples.size());
|
||||
for (Tuple t : cmpTuples) {
|
||||
String num = t.get(h2.mapSheetNum);
|
||||
Integer beforeYear = t.get(h2.mngYyyy.max());
|
||||
beforeYearMap.put(num, beforeYear);
|
||||
}
|
||||
|
||||
// -----------------------
|
||||
// 3) base JOIN cmp (메모리)
|
||||
// - SQL에서 join cmp c on c.map_sheet_num = b.map_sheet_num 동일
|
||||
// -----------------------
|
||||
List<MngListDto> result = new ArrayList<>();
|
||||
for (Tuple bt : baseTuples) {
|
||||
String num = bt.get(h.mapSheetNum);
|
||||
Integer beforeYear = beforeYearMap.get(num);
|
||||
if (beforeYear == null) continue; // SQL의 inner join cmp 효과
|
||||
|
||||
result.add(
|
||||
new MngListDto(
|
||||
bt.get(h.mngYyyy), // 2026
|
||||
num,
|
||||
bt.get(h.mapSheetName),
|
||||
beforeYear, // <=2024 max
|
||||
null // isSuccess
|
||||
));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MapSheetMngDto.MngFilesDto> findHstUidToMapSheetFileList(Long hstUid) {
|
||||
BooleanBuilder whereBuilder = new BooleanBuilder();
|
||||
@@ -1340,57 +1138,4 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
.exists())))
|
||||
.fetch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countExecutableSheetsDistinct(
|
||||
Integer year, String mapSheetScope, List<String> mapSheetNum) {
|
||||
|
||||
QMapSheetMngHstEntity h = QMapSheetMngHstEntity.mapSheetMngHstEntity;
|
||||
QMapInkx5kEntity i = QMapInkx5kEntity.mapInkx5kEntity;
|
||||
QMapSheetMngFileEntity f = QMapSheetMngFileEntity.mapSheetMngFileEntity;
|
||||
|
||||
BooleanBuilder where = new BooleanBuilder();
|
||||
|
||||
// 실행가능 조건
|
||||
where.and(h.dataState.eq("DONE"));
|
||||
where.and(h.syncState.eq("DONE").or(h.syncCheckState.eq("DONE")));
|
||||
where.and(h.useInference.eq("USE"));
|
||||
where.and(h.mngYyyy.eq(year));
|
||||
|
||||
// tif + DONE 파일 존재 조건 AND EXISTS
|
||||
where.and(
|
||||
JPAExpressions.selectOne()
|
||||
.from(f)
|
||||
.where(f.hstUid.eq(h.hstUid).and(f.fileExt.eq("tif")).and(f.fileState.eq("DONE")))
|
||||
.exists());
|
||||
|
||||
// PART scope prefix 조건
|
||||
if (MapSheetScope.PART.getId().equals(mapSheetScope)) {
|
||||
if (mapSheetNum == null || mapSheetNum.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
BooleanBuilder likeBuilder = new BooleanBuilder();
|
||||
for (String prefix : mapSheetNum) {
|
||||
if (prefix == null || prefix.isBlank()) continue;
|
||||
likeBuilder.or(h.mapSheetNum.like(prefix.trim() + "%"));
|
||||
}
|
||||
|
||||
if (likeBuilder.hasValue()) {
|
||||
where.and(likeBuilder);
|
||||
}
|
||||
}
|
||||
|
||||
// DISTINCT mapSheetNum 기준 카운트
|
||||
Long count =
|
||||
queryFactory
|
||||
.select(h.mapSheetNum.countDistinct())
|
||||
.from(h)
|
||||
.join(i)
|
||||
.on(i.mapidcdNo.eq(h.mapSheetNum).and(i.useInference.eq(CommonUseStatus.USE)))
|
||||
.where(where)
|
||||
.fetchOne();
|
||||
|
||||
return count != null ? count.intValue() : 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,16 @@ import org.springframework.data.domain.Page;
|
||||
|
||||
public interface ModelMngRepositoryCustom {
|
||||
|
||||
/**
|
||||
* 모델조회
|
||||
*
|
||||
* @param searchReq 페이징
|
||||
* @param startDate 시작날짜
|
||||
* @param endDate 종료날짜
|
||||
* @param modelType 모델 타입 G1, G2, G3
|
||||
* @param searchVal 모델 ver
|
||||
* @return 모델 목록
|
||||
*/
|
||||
Page<ModelMngDto.ModelList> findModelMgmtList(
|
||||
ModelMngDto.searchReq searchReq,
|
||||
LocalDate startDate,
|
||||
|
||||
Reference in New Issue
Block a user