추론 수정 #112
@@ -145,34 +145,59 @@ public class InferenceResultService {
|
||||
*/
|
||||
public UUID runExcl(InferenceResultDto.RegReq req) {
|
||||
// 기준연도 실행가능 도엽 조회
|
||||
List<MngListDto> mngList =
|
||||
mapSheetMngCoreService.findExecutableSheets(
|
||||
req.getCompareYyyy(),
|
||||
req.getTargetYyyy(),
|
||||
req.getMapSheetScope(),
|
||||
req.getMapSheetNum());
|
||||
List<MngListDto> targetMngList =
|
||||
mapSheetMngCoreService.getMapSheetMngHst(
|
||||
req.getTargetYyyy(), req.getMapSheetScope(), req.getMapSheetNum());
|
||||
|
||||
if (mngList == null || mngList.isEmpty()) {
|
||||
// List<MngListDto> mngList =
|
||||
// mapSheetMngCoreService.findExecutableSheets(
|
||||
// req.getCompareYyyy(),
|
||||
// req.getTargetYyyy(),
|
||||
// req.getMapSheetScope(),
|
||||
// req.getMapSheetNum());
|
||||
|
||||
if (targetMngList == null || targetMngList.isEmpty()) {
|
||||
throw new CustomApiException("NOT_FOUND_MAP_SHEET_NUM", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
// 비교연도 실행가능 도엽 조회
|
||||
List<MngListDto> compareMngList =
|
||||
mapSheetMngCoreService.getMapSheetMngHst(
|
||||
req.getCompareYyyy(), req.getMapSheetScope(), req.getMapSheetNum());
|
||||
|
||||
if (compareMngList == null || compareMngList.isEmpty()) {
|
||||
throw new CustomApiException("NOT_FOUND_COMPARE_YEAR", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
// compare 도엽번호 Set 구성
|
||||
Set<String> compareSet =
|
||||
compareMngList.stream()
|
||||
.map(MngListDto::getMapSheetNum)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// 기준년도 비교년도 동일한 도엽번호만 담기
|
||||
List<MngListDto> intersectionList =
|
||||
targetMngList.stream()
|
||||
.filter(dto -> dto.getMapSheetNum() != null)
|
||||
.filter(dto -> compareSet.contains(dto.getMapSheetNum()))
|
||||
.toList();
|
||||
|
||||
log.info("target size = {}", targetMngList.size());
|
||||
log.info("compare size = {}", compareMngList.size());
|
||||
log.info("intersection size = {}", intersectionList.size());
|
||||
|
||||
// 비교 연도 도엽번호를 꺼내와서 최종 추론 대상 도엽번호를 담기
|
||||
List<String> mapSheetNums =
|
||||
mngList.stream()
|
||||
intersectionList.stream()
|
||||
.map(MngListDto::getMapSheetNum)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
// 기준연도 추론 실행가능 도엽 count
|
||||
int targetTotal =
|
||||
mapSheetMngCoreService.countExecutableSheetsDistinct(
|
||||
req.getTargetYyyy(), req.getMapSheetScope(), mapSheetNums);
|
||||
// 비교연도 추론 실행가능 도엽 count
|
||||
int compareTotal =
|
||||
mapSheetMngCoreService.countExecutableSheetsDistinct(
|
||||
req.getCompareYyyy(), req.getMapSheetScope(), mapSheetNums);
|
||||
int intersection = mapSheetNums.size();
|
||||
int targetTotal = targetMngList.size();
|
||||
int compareTotal = compareMngList.size();
|
||||
int intersection = intersectionList.size();
|
||||
|
||||
// ===== MapSheet Year Comparison =====
|
||||
// target Total : 기준연도 실행가능 전체 도엽 수
|
||||
@@ -227,7 +252,7 @@ public class InferenceResultService {
|
||||
// 추론 실행
|
||||
return executeInference(
|
||||
req,
|
||||
mngList, // 전체 target 목록
|
||||
intersectionList, // 전체 target 목록
|
||||
mapSheetNums, // 최종 추론 대상
|
||||
compareScene, // compare geojson
|
||||
targetScene // target geojson
|
||||
|
||||
@@ -1239,6 +1239,17 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
|
||||
whereBuilder.and(mapSheetMngHstEntity.mngYyyy.eq(year));
|
||||
|
||||
whereBuilder.and(
|
||||
JPAExpressions.selectOne()
|
||||
.from(mapSheetMngFileEntity)
|
||||
.where(
|
||||
mapSheetMngFileEntity
|
||||
.hstUid
|
||||
.eq(mapSheetMngHstEntity.hstUid) // FK 관계에 맞게 유지
|
||||
.and(mapSheetMngFileEntity.fileExt.eq("tif"))
|
||||
.and(mapSheetMngFileEntity.fileState.eq("DONE")))
|
||||
.exists());
|
||||
|
||||
BooleanBuilder likeBuilder = new BooleanBuilder();
|
||||
|
||||
if (MapSheetScope.PART.getId().equals(mapSheetScope)) {
|
||||
|
||||
Reference in New Issue
Block a user