추론 결과 조회 수정
This commit is contained in:
@@ -25,9 +25,9 @@ public class MapSheetLearnEntity {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "tb_map_sheet_learn_id_gen")
|
||||
@SequenceGenerator(
|
||||
name = "tb_map_sheet_learn_id_gen",
|
||||
sequenceName = "tb_map_sheet_learn_uid",
|
||||
allocationSize = 1)
|
||||
name = "tb_map_sheet_learn_id_gen",
|
||||
sequenceName = "tb_map_sheet_learn_uid",
|
||||
allocationSize = 1)
|
||||
@Column(name = "id", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@@ -191,18 +191,18 @@ public class MapSheetLearnEntity {
|
||||
|
||||
public InferenceResultDto.ResultList toDto() {
|
||||
return new InferenceResultDto.ResultList(
|
||||
this.uuid,
|
||||
this.title,
|
||||
this.stage,
|
||||
this.status,
|
||||
this.mapSheetCnt,
|
||||
this.detectingCnt,
|
||||
this.inferStartDttm,
|
||||
this.inferEndDttm,
|
||||
this.applyYn,
|
||||
this.applyDttm,
|
||||
this.compareYyyy,
|
||||
this.targetYyyy,
|
||||
this.uid);
|
||||
this.uuid,
|
||||
this.title,
|
||||
this.stage,
|
||||
this.status,
|
||||
this.mapSheetCnt,
|
||||
this.detectingCnt,
|
||||
this.inferStartDttm,
|
||||
this.inferEndDttm,
|
||||
this.applyYn,
|
||||
this.applyDttm,
|
||||
this.compareYyyy,
|
||||
this.targetYyyy,
|
||||
this.uid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,5 +47,4 @@ public class PnuEntity {
|
||||
@ColumnDefault("false")
|
||||
@Column(name = "del_yn")
|
||||
private Boolean delYn;
|
||||
|
||||
}
|
||||
|
||||
@@ -56,22 +56,22 @@ public class MapSheetLearn5kRepositoryImpl implements MapSheetLearn5kRepositoryC
|
||||
}
|
||||
|
||||
var learnIdSubQuery =
|
||||
select(mapSheetLearnEntity.id)
|
||||
.from(mapSheetLearnEntity)
|
||||
.where(mapSheetLearnEntity.uuid.eq(uuid));
|
||||
select(mapSheetLearnEntity.id)
|
||||
.from(mapSheetLearnEntity)
|
||||
.where(mapSheetLearnEntity.uuid.eq(uuid));
|
||||
|
||||
queryFactory
|
||||
.update(mapSheetLearn5kEntity)
|
||||
.set(failPath, Boolean.TRUE)
|
||||
.set(jobIdPath, jobDto.getId())
|
||||
.set(errorMsgPath, jobDto.getErrorMessage())
|
||||
.where(
|
||||
mapSheetLearn5kEntity
|
||||
.learn
|
||||
.id
|
||||
.eq(learnIdSubQuery)
|
||||
.and(mapSheetLearn5kEntity.mapSheetNum.eq(Long.valueOf(jobDto.getSceneId()))))
|
||||
.execute();
|
||||
.update(mapSheetLearn5kEntity)
|
||||
.set(failPath, Boolean.TRUE)
|
||||
.set(jobIdPath, jobDto.getId())
|
||||
.set(errorMsgPath, jobDto.getErrorMessage())
|
||||
.where(
|
||||
mapSheetLearn5kEntity
|
||||
.learn
|
||||
.id
|
||||
.eq(learnIdSubQuery)
|
||||
.and(mapSheetLearn5kEntity.mapSheetNum.eq(Long.valueOf(jobDto.getSceneId()))))
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -103,21 +103,21 @@ public class MapSheetLearn5kRepositoryImpl implements MapSheetLearn5kRepositoryC
|
||||
}
|
||||
|
||||
var learnIdSubQuery =
|
||||
select(mapSheetLearnEntity.id)
|
||||
.from(mapSheetLearnEntity)
|
||||
.where(mapSheetLearnEntity.uuid.eq(uuid));
|
||||
select(mapSheetLearnEntity.id)
|
||||
.from(mapSheetLearnEntity)
|
||||
.where(mapSheetLearnEntity.uuid.eq(uuid));
|
||||
|
||||
queryFactory
|
||||
.update(mapSheetLearn5kEntity)
|
||||
.set(failPath, Boolean.FALSE)
|
||||
.set(jobIdPath, jobDto.getId())
|
||||
.where(
|
||||
mapSheetLearn5kEntity
|
||||
.learn
|
||||
.id
|
||||
.eq(learnIdSubQuery)
|
||||
.and(mapSheetLearn5kEntity.mapSheetNum.eq(Long.valueOf(jobDto.getSceneId()))))
|
||||
.execute();
|
||||
.update(mapSheetLearn5kEntity)
|
||||
.set(failPath, Boolean.FALSE)
|
||||
.set(jobIdPath, jobDto.getId())
|
||||
.where(
|
||||
mapSheetLearn5kEntity
|
||||
.learn
|
||||
.id
|
||||
.eq(learnIdSubQuery)
|
||||
.and(mapSheetLearn5kEntity.mapSheetNum.eq(Long.valueOf(jobDto.getSceneId()))))
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -153,16 +153,16 @@ public class MapSheetLearn5kRepositoryImpl implements MapSheetLearn5kRepositoryC
|
||||
}
|
||||
|
||||
return queryFactory
|
||||
.select(jobIdPath)
|
||||
.from(mapSheetLearn5kEntity)
|
||||
.join(mapSheetLearn5kEntity.learn, mapSheetLearnEntity)
|
||||
.where(
|
||||
mapSheetLearnEntity
|
||||
.uuid
|
||||
.eq(uuid)
|
||||
.and(failPath.isFalse().or(failPath.isNull()))
|
||||
.and(jobIdPath.in(failIds)))
|
||||
.fetch();
|
||||
.select(jobIdPath)
|
||||
.from(mapSheetLearn5kEntity)
|
||||
.join(mapSheetLearn5kEntity.learn, mapSheetLearnEntity)
|
||||
.where(
|
||||
mapSheetLearnEntity
|
||||
.uuid
|
||||
.eq(uuid)
|
||||
.and(failPath.isFalse().or(failPath.isNull()))
|
||||
.and(jobIdPath.in(failIds)))
|
||||
.fetch();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -195,11 +195,11 @@ public class MapSheetLearn5kRepositoryImpl implements MapSheetLearn5kRepositoryC
|
||||
}
|
||||
|
||||
return queryFactory
|
||||
.select(jobIdPath)
|
||||
.from(mapSheetLearn5kEntity)
|
||||
.join(mapSheetLearn5kEntity.learn, mapSheetLearnEntity)
|
||||
.where(mapSheetLearnEntity.uuid.eq(uuid).and(jobIdPath.in(completedIds)))
|
||||
.fetch();
|
||||
.select(jobIdPath)
|
||||
.from(mapSheetLearn5kEntity)
|
||||
.join(mapSheetLearn5kEntity.learn, mapSheetLearnEntity)
|
||||
.where(mapSheetLearnEntity.uuid.eq(uuid).and(jobIdPath.in(completedIds)))
|
||||
.fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -211,21 +211,21 @@ public class MapSheetLearn5kRepositoryImpl implements MapSheetLearn5kRepositoryC
|
||||
@Override
|
||||
public List<String> getInferenceRunMapId(UUID uuid) {
|
||||
return queryFactory
|
||||
.select(mapInkx50kEntity.mapidNm.concat(mapInkx50kEntity.mapidcdNo))
|
||||
.from(mapInkx50kEntity)
|
||||
.join(mapInkx5kEntity).on(mapInkx5kEntity.mapInkx50k.fid.eq(mapInkx50kEntity.fid))
|
||||
.where(
|
||||
mapInkx5kEntity.mapidcdNo.in(
|
||||
select(
|
||||
Expressions.stringTemplate("CAST({0} AS text)", mapSheetLearn5kEntity.mapSheetNum)
|
||||
)
|
||||
.from(mapSheetLearnEntity)
|
||||
.join(mapSheetLearn5kEntity).on(mapSheetLearn5kEntity.learn.id.eq(mapSheetLearnEntity.id))
|
||||
.where(mapSheetLearnEntity.uuid.eq(uuid))
|
||||
)
|
||||
)
|
||||
.groupBy(mapInkx50kEntity.mapidcdNo, mapInkx50kEntity.mapidNm)
|
||||
.orderBy(mapInkx50kEntity.mapidNm.asc())
|
||||
.fetch();
|
||||
.select(mapInkx50kEntity.mapidNm.concat(mapInkx50kEntity.mapidcdNo))
|
||||
.from(mapInkx50kEntity)
|
||||
.join(mapInkx5kEntity)
|
||||
.on(mapInkx5kEntity.mapInkx50k.fid.eq(mapInkx50kEntity.fid))
|
||||
.where(
|
||||
mapInkx5kEntity.mapidcdNo.in(
|
||||
select(
|
||||
Expressions.stringTemplate(
|
||||
"CAST({0} AS text)", mapSheetLearn5kEntity.mapSheetNum))
|
||||
.from(mapSheetLearnEntity)
|
||||
.join(mapSheetLearn5kEntity)
|
||||
.on(mapSheetLearn5kEntity.learn.id.eq(mapSheetLearnEntity.id))
|
||||
.where(mapSheetLearnEntity.uuid.eq(uuid))))
|
||||
.groupBy(mapInkx50kEntity.mapidcdNo, mapInkx50kEntity.mapidNm)
|
||||
.orderBy(mapInkx50kEntity.mapidNm.asc())
|
||||
.fetch();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
||||
BooleanBuilder builder = new BooleanBuilder();
|
||||
|
||||
NumberExpression<Integer> statusOrder =
|
||||
new CaseBuilder().when(mapSheetLearnEntity.status.eq("Y")).then(0).otherwise(1);
|
||||
new CaseBuilder().when(mapSheetLearnEntity.status.eq("Y")).then(0).otherwise(1);
|
||||
|
||||
// 국유인 반영 여부
|
||||
if (StringUtils.isNotBlank(req.getApplyYn())) {
|
||||
@@ -72,10 +72,10 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
||||
// 국유인 반영일
|
||||
if (req.getStrtDttm() != null && req.getEndDttm() != null) {
|
||||
builder.and(
|
||||
mapSheetLearnEntity
|
||||
.applyDttm
|
||||
.goe(DateRange.start(req.getStrtDttm()))
|
||||
.and(mapSheetLearnEntity.applyDttm.lt(DateRange.end(req.getEndDttm()))));
|
||||
mapSheetLearnEntity
|
||||
.applyDttm
|
||||
.goe(DateRange.start(req.getStrtDttm()))
|
||||
.and(mapSheetLearnEntity.applyDttm.lt(DateRange.end(req.getEndDttm()))));
|
||||
}
|
||||
|
||||
// 제목
|
||||
@@ -84,21 +84,21 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
||||
}
|
||||
|
||||
List<MapSheetLearnEntity> content =
|
||||
queryFactory
|
||||
.select(mapSheetLearnEntity)
|
||||
.from(mapSheetLearnEntity)
|
||||
.where(builder)
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.orderBy(mapSheetLearnEntity.id.desc())
|
||||
.fetch();
|
||||
queryFactory
|
||||
.select(mapSheetLearnEntity)
|
||||
.from(mapSheetLearnEntity)
|
||||
.where(builder)
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.orderBy(mapSheetLearnEntity.id.desc())
|
||||
.fetch();
|
||||
|
||||
Long total =
|
||||
queryFactory
|
||||
.select(mapSheetLearnEntity.count())
|
||||
.from(mapSheetLearnEntity)
|
||||
.where(builder)
|
||||
.fetchOne();
|
||||
queryFactory
|
||||
.select(mapSheetLearnEntity.count())
|
||||
.from(mapSheetLearnEntity)
|
||||
.where(builder)
|
||||
.fetchOne();
|
||||
|
||||
return new PageImpl<>(content, pageable, total == null ? 0L : total);
|
||||
}
|
||||
@@ -106,10 +106,10 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
||||
@Override
|
||||
public Optional<MapSheetLearnEntity> getInferenceResultByUuid(UUID uuid) {
|
||||
return Optional.ofNullable(
|
||||
queryFactory
|
||||
.selectFrom(mapSheetLearnEntity)
|
||||
.where(mapSheetLearnEntity.uuid.eq(uuid))
|
||||
.fetchOne());
|
||||
queryFactory
|
||||
.selectFrom(mapSheetLearnEntity)
|
||||
.where(mapSheetLearnEntity.uuid.eq(uuid))
|
||||
.fetchOne());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -118,44 +118,44 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
||||
BooleanBuilder builder = new BooleanBuilder();
|
||||
|
||||
List<OffsetDateTime> latestIds =
|
||||
queryFactory
|
||||
.select(systemMetricEntity.timestamp.max())
|
||||
.from(systemMetricEntity)
|
||||
.groupBy(systemMetricEntity.serverName)
|
||||
.fetch();
|
||||
queryFactory
|
||||
.select(systemMetricEntity.timestamp.max())
|
||||
.from(systemMetricEntity)
|
||||
.groupBy(systemMetricEntity.serverName)
|
||||
.fetch();
|
||||
|
||||
List<OffsetDateTime> latestGpuIds =
|
||||
queryFactory
|
||||
.select(gpuMetricEntity.timestamp.max())
|
||||
.from(gpuMetricEntity)
|
||||
.groupBy(gpuMetricEntity.serverName)
|
||||
.fetch();
|
||||
queryFactory
|
||||
.select(gpuMetricEntity.timestamp.max())
|
||||
.from(gpuMetricEntity)
|
||||
.groupBy(gpuMetricEntity.serverName)
|
||||
.fetch();
|
||||
|
||||
List<InferenceServerStatusDto> foundContent =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
InferenceServerStatusDto.class,
|
||||
systemMetricEntity.serverName,
|
||||
systemMetricEntity.cpuUser,
|
||||
systemMetricEntity.cpuSystem,
|
||||
systemMetricEntity.memused,
|
||||
systemMetricEntity.kbmemused,
|
||||
gpuMetricEntity.gpuUtil
|
||||
// gpuMetricEntity.gpuMemUsed,
|
||||
// gpuMetricEntity.gpuMemTotal
|
||||
))
|
||||
.from(systemMetricEntity)
|
||||
.leftJoin(gpuMetricEntity)
|
||||
.on(
|
||||
gpuMetricEntity
|
||||
.timestamp
|
||||
.in(latestGpuIds)
|
||||
.and(gpuMetricEntity.serverName.eq(systemMetricEntity.serverName)))
|
||||
.where(systemMetricEntity.timestamp.in(latestIds)) // In 절 사용
|
||||
.orderBy(systemMetricEntity.serverName.asc())
|
||||
.limit(4)
|
||||
.fetch();
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
InferenceServerStatusDto.class,
|
||||
systemMetricEntity.serverName,
|
||||
systemMetricEntity.cpuUser,
|
||||
systemMetricEntity.cpuSystem,
|
||||
systemMetricEntity.memused,
|
||||
systemMetricEntity.kbmemused,
|
||||
gpuMetricEntity.gpuUtil
|
||||
// gpuMetricEntity.gpuMemUsed,
|
||||
// gpuMetricEntity.gpuMemTotal
|
||||
))
|
||||
.from(systemMetricEntity)
|
||||
.leftJoin(gpuMetricEntity)
|
||||
.on(
|
||||
gpuMetricEntity
|
||||
.timestamp
|
||||
.in(latestGpuIds)
|
||||
.and(gpuMetricEntity.serverName.eq(systemMetricEntity.serverName)))
|
||||
.where(systemMetricEntity.timestamp.in(latestIds)) // In 절 사용
|
||||
.orderBy(systemMetricEntity.serverName.asc())
|
||||
.limit(4)
|
||||
.fetch();
|
||||
|
||||
return foundContent;
|
||||
}
|
||||
@@ -163,11 +163,11 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
||||
@Override
|
||||
public Optional<MapSheetLearnEntity> getInferenceResultByStatus(String status) {
|
||||
return Optional.ofNullable(
|
||||
queryFactory
|
||||
.selectFrom(mapSheetLearnEntity)
|
||||
.where(mapSheetLearnEntity.status.eq(status))
|
||||
.limit(1)
|
||||
.fetchOne());
|
||||
queryFactory
|
||||
.selectFrom(mapSheetLearnEntity)
|
||||
.where(mapSheetLearnEntity.status.eq(status))
|
||||
.limit(1)
|
||||
.fetchOne());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -186,46 +186,46 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
||||
QModelMngEntity m3Model = new QModelMngEntity("m3Model");
|
||||
|
||||
InferenceStatusDetailDto foundContent =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
InferenceStatusDetailDto.class,
|
||||
mapSheetLearnEntity.detectingCnt,
|
||||
mapSheetLearnEntity.m1PendingJobs,
|
||||
mapSheetLearnEntity.m2PendingJobs,
|
||||
mapSheetLearnEntity.m3PendingJobs,
|
||||
mapSheetLearnEntity.m1CompletedJobs,
|
||||
mapSheetLearnEntity.m2CompletedJobs,
|
||||
mapSheetLearnEntity.m3CompletedJobs,
|
||||
mapSheetLearnEntity.m1FailedJobs,
|
||||
mapSheetLearnEntity.m2FailedJobs,
|
||||
mapSheetLearnEntity.m3FailedJobs,
|
||||
mapSheetLearnEntity.m1ModelStartDttm,
|
||||
mapSheetLearnEntity.m2ModelStartDttm,
|
||||
mapSheetLearnEntity.m3ModelStartDttm,
|
||||
mapSheetLearnEntity.m1ModelEndDttm,
|
||||
mapSheetLearnEntity.m2ModelEndDttm,
|
||||
mapSheetLearnEntity.m3ModelEndDttm,
|
||||
mapSheetLearnEntity.title,
|
||||
mapSheetLearnEntity.compareYyyy,
|
||||
mapSheetLearnEntity.targetYyyy,
|
||||
mapSheetLearnEntity.stage,
|
||||
mapSheetLearnEntity.inferStartDttm,
|
||||
mapSheetLearnEntity.inferEndDttm,
|
||||
mapSheetLearnEntity.detectOption,
|
||||
mapSheetLearnEntity.mapSheetScope,
|
||||
m1Model.modelVer.as("model1Ver"),
|
||||
m2Model.modelVer.as("model2Ver"),
|
||||
m3Model.modelVer.as("model3Ver")))
|
||||
.from(mapSheetLearnEntity)
|
||||
.leftJoin(m1Model)
|
||||
.on(m1Model.uuid.eq(mapSheetLearnEntity.m1ModelUuid))
|
||||
.leftJoin(m2Model)
|
||||
.on(m2Model.uuid.eq(mapSheetLearnEntity.m2ModelUuid))
|
||||
.leftJoin(m3Model)
|
||||
.on(m3Model.uuid.eq(mapSheetLearnEntity.m3ModelUuid))
|
||||
.where(mapSheetLearnEntity.uuid.eq(uuid))
|
||||
.fetchOne();
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
InferenceStatusDetailDto.class,
|
||||
mapSheetLearnEntity.detectingCnt,
|
||||
mapSheetLearnEntity.m1PendingJobs,
|
||||
mapSheetLearnEntity.m2PendingJobs,
|
||||
mapSheetLearnEntity.m3PendingJobs,
|
||||
mapSheetLearnEntity.m1CompletedJobs,
|
||||
mapSheetLearnEntity.m2CompletedJobs,
|
||||
mapSheetLearnEntity.m3CompletedJobs,
|
||||
mapSheetLearnEntity.m1FailedJobs,
|
||||
mapSheetLearnEntity.m2FailedJobs,
|
||||
mapSheetLearnEntity.m3FailedJobs,
|
||||
mapSheetLearnEntity.m1ModelStartDttm,
|
||||
mapSheetLearnEntity.m2ModelStartDttm,
|
||||
mapSheetLearnEntity.m3ModelStartDttm,
|
||||
mapSheetLearnEntity.m1ModelEndDttm,
|
||||
mapSheetLearnEntity.m2ModelEndDttm,
|
||||
mapSheetLearnEntity.m3ModelEndDttm,
|
||||
mapSheetLearnEntity.title,
|
||||
mapSheetLearnEntity.compareYyyy,
|
||||
mapSheetLearnEntity.targetYyyy,
|
||||
mapSheetLearnEntity.stage,
|
||||
mapSheetLearnEntity.inferStartDttm,
|
||||
mapSheetLearnEntity.inferEndDttm,
|
||||
mapSheetLearnEntity.detectOption,
|
||||
mapSheetLearnEntity.mapSheetScope,
|
||||
m1Model.modelVer.as("model1Ver"),
|
||||
m2Model.modelVer.as("model2Ver"),
|
||||
m3Model.modelVer.as("model3Ver")))
|
||||
.from(mapSheetLearnEntity)
|
||||
.leftJoin(m1Model)
|
||||
.on(m1Model.uuid.eq(mapSheetLearnEntity.m1ModelUuid))
|
||||
.leftJoin(m2Model)
|
||||
.on(m2Model.uuid.eq(mapSheetLearnEntity.m2ModelUuid))
|
||||
.leftJoin(m3Model)
|
||||
.on(m3Model.uuid.eq(mapSheetLearnEntity.m3ModelUuid))
|
||||
.where(mapSheetLearnEntity.uuid.eq(uuid))
|
||||
.fetchOne();
|
||||
|
||||
return foundContent;
|
||||
}
|
||||
@@ -236,30 +236,30 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
||||
QModelMngEntity model = new QModelMngEntity("model");
|
||||
|
||||
InferenceProgressDto dto =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
InferenceProgressDto.class,
|
||||
Projections.constructor(
|
||||
InferenceProgressDto.pred_requests_areas.class,
|
||||
mapSheetLearnEntity.compareYyyy,
|
||||
mapSheetLearnEntity.targetYyyy,
|
||||
mapSheetLearnEntity.modelComparePath,
|
||||
mapSheetLearnEntity.modelTargetPath),
|
||||
model.modelVer.as("modelVer"),
|
||||
model.cdModelPath.as("cdModelPath"),
|
||||
model.cdModelFileName.as("cdModelFileName"),
|
||||
model.cdModelConfigPath.as("cdModelConfigPath"),
|
||||
model.cdModelConfigFileName.as("cdModelConfigFileName"),
|
||||
model.clsModelPath,
|
||||
model.clsModelFileName,
|
||||
model.clsModelVersion,
|
||||
model.priority))
|
||||
.from(mapSheetLearnEntity)
|
||||
.join(model)
|
||||
.on(model.uuid.eq(modelUuid))
|
||||
.where(mapSheetLearnEntity.id.eq(id))
|
||||
.fetchOne();
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
InferenceProgressDto.class,
|
||||
Projections.constructor(
|
||||
InferenceProgressDto.pred_requests_areas.class,
|
||||
mapSheetLearnEntity.compareYyyy,
|
||||
mapSheetLearnEntity.targetYyyy,
|
||||
mapSheetLearnEntity.modelComparePath,
|
||||
mapSheetLearnEntity.modelTargetPath),
|
||||
model.modelVer.as("modelVer"),
|
||||
model.cdModelPath.as("cdModelPath"),
|
||||
model.cdModelFileName.as("cdModelFileName"),
|
||||
model.cdModelConfigPath.as("cdModelConfigPath"),
|
||||
model.cdModelConfigFileName.as("cdModelConfigFileName"),
|
||||
model.clsModelPath,
|
||||
model.clsModelFileName,
|
||||
model.clsModelVersion,
|
||||
model.priority))
|
||||
.from(mapSheetLearnEntity)
|
||||
.join(model)
|
||||
.on(model.uuid.eq(modelUuid))
|
||||
.where(mapSheetLearnEntity.id.eq(id))
|
||||
.fetchOne();
|
||||
return dto;
|
||||
}
|
||||
|
||||
@@ -270,26 +270,26 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
||||
*/
|
||||
public MapSheetLearnEntity getProcessing() {
|
||||
return queryFactory
|
||||
.select(mapSheetLearnEntity)
|
||||
.from(mapSheetLearnEntity)
|
||||
.where(mapSheetLearnEntity.status.eq("IN_PROGRESS"))
|
||||
.fetchOne();
|
||||
.select(mapSheetLearnEntity)
|
||||
.from(mapSheetLearnEntity)
|
||||
.where(mapSheetLearnEntity.status.eq("IN_PROGRESS"))
|
||||
.fetchOne();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getLearnStage(Integer compareYear, Integer targetYear) {
|
||||
Integer stage =
|
||||
queryFactory
|
||||
.select(mapSheetLearnEntity.stage)
|
||||
.from(mapSheetLearnEntity)
|
||||
.where(
|
||||
mapSheetLearnEntity
|
||||
.compareYyyy
|
||||
.eq(compareYear)
|
||||
.and(mapSheetLearnEntity.targetYyyy.eq(targetYear)))
|
||||
.orderBy(mapSheetLearnEntity.id.desc())
|
||||
.limit(1)
|
||||
.fetchOne();
|
||||
queryFactory
|
||||
.select(mapSheetLearnEntity.stage)
|
||||
.from(mapSheetLearnEntity)
|
||||
.where(
|
||||
mapSheetLearnEntity
|
||||
.compareYyyy
|
||||
.eq(compareYear)
|
||||
.and(mapSheetLearnEntity.targetYyyy.eq(targetYear)))
|
||||
.orderBy(mapSheetLearnEntity.id.desc())
|
||||
.limit(1)
|
||||
.fetchOne();
|
||||
|
||||
return stage == null ? 1 : stage + 1;
|
||||
}
|
||||
@@ -301,30 +301,30 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
||||
QModelMngEntity m3 = new QModelMngEntity("m3");
|
||||
|
||||
return queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
AnalResultInfo.class,
|
||||
mapSheetLearnEntity.title,
|
||||
m1.modelVer,
|
||||
m2.modelVer,
|
||||
m3.modelVer,
|
||||
mapSheetLearnEntity.compareYyyy,
|
||||
mapSheetLearnEntity.targetYyyy,
|
||||
mapSheetLearnEntity.detectOption,
|
||||
mapSheetLearnEntity.mapSheetScope,
|
||||
mapSheetLearnEntity.inferStartDttm,
|
||||
mapSheetLearnEntity.inferEndDttm,
|
||||
mapSheetLearnEntity.stage,
|
||||
Expressions.stringTemplate("substring({0} from 1 for 8)", mapSheetLearnEntity.uid)))
|
||||
.from(mapSheetLearnEntity)
|
||||
.leftJoin(m1)
|
||||
.on(mapSheetLearnEntity.m1ModelUuid.eq(m1.uuid))
|
||||
.leftJoin(m2)
|
||||
.on(mapSheetLearnEntity.m2ModelUuid.eq(m2.uuid))
|
||||
.leftJoin(m3)
|
||||
.on(mapSheetLearnEntity.m3ModelUuid.eq(m3.uuid))
|
||||
.where(mapSheetLearnEntity.uuid.eq(uuid))
|
||||
.fetchOne();
|
||||
.select(
|
||||
Projections.constructor(
|
||||
AnalResultInfo.class,
|
||||
mapSheetLearnEntity.title,
|
||||
m1.modelVer,
|
||||
m2.modelVer,
|
||||
m3.modelVer,
|
||||
mapSheetLearnEntity.compareYyyy,
|
||||
mapSheetLearnEntity.targetYyyy,
|
||||
mapSheetLearnEntity.detectOption,
|
||||
mapSheetLearnEntity.mapSheetScope,
|
||||
mapSheetLearnEntity.inferStartDttm,
|
||||
mapSheetLearnEntity.inferEndDttm,
|
||||
mapSheetLearnEntity.stage,
|
||||
Expressions.stringTemplate("substring({0} from 1 for 8)", mapSheetLearnEntity.uid)))
|
||||
.from(mapSheetLearnEntity)
|
||||
.leftJoin(m1)
|
||||
.on(mapSheetLearnEntity.m1ModelUuid.eq(m1.uuid))
|
||||
.leftJoin(m2)
|
||||
.on(mapSheetLearnEntity.m2ModelUuid.eq(m2.uuid))
|
||||
.leftJoin(m3)
|
||||
.on(mapSheetLearnEntity.m3ModelUuid.eq(m3.uuid))
|
||||
.where(mapSheetLearnEntity.uuid.eq(uuid))
|
||||
.fetchOne();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -332,28 +332,28 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
||||
|
||||
// analUid로 분석 정보 조회
|
||||
MapSheetLearnEntity learnEntity =
|
||||
queryFactory
|
||||
.selectFrom(mapSheetLearnEntity)
|
||||
.where(mapSheetLearnEntity.uuid.eq(uuid))
|
||||
.fetchOne();
|
||||
queryFactory
|
||||
.selectFrom(mapSheetLearnEntity)
|
||||
.where(mapSheetLearnEntity.uuid.eq(uuid))
|
||||
.fetchOne();
|
||||
|
||||
if (Objects.isNull(learnEntity)) {
|
||||
throw new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
return queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
Dashboard.class,
|
||||
mapSheetAnalSttcEntity.id.classAfterCd.toUpperCase(),
|
||||
mapSheetAnalSttcEntity.classAfterCnt.sum()))
|
||||
.from(mapSheetAnalInferenceEntity)
|
||||
.innerJoin(mapSheetAnalSttcEntity)
|
||||
.on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalSttcEntity.id.analUid))
|
||||
.where(mapSheetAnalInferenceEntity.learnId.eq(learnEntity.getId()))
|
||||
.groupBy(mapSheetAnalSttcEntity.id.classAfterCd)
|
||||
.orderBy(mapSheetAnalSttcEntity.id.classAfterCd.asc())
|
||||
.fetch();
|
||||
.select(
|
||||
Projections.constructor(
|
||||
Dashboard.class,
|
||||
mapSheetAnalSttcEntity.id.classAfterCd.toUpperCase(),
|
||||
mapSheetAnalSttcEntity.classAfterCnt.sum()))
|
||||
.from(mapSheetAnalInferenceEntity)
|
||||
.innerJoin(mapSheetAnalSttcEntity)
|
||||
.on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalSttcEntity.id.analUid))
|
||||
.where(mapSheetAnalInferenceEntity.learnId.eq(learnEntity.getId()))
|
||||
.groupBy(mapSheetAnalSttcEntity.id.classAfterCd)
|
||||
.orderBy(mapSheetAnalSttcEntity.id.classAfterCd.asc())
|
||||
.fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -369,10 +369,10 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
||||
|
||||
// 1) 분석 엔티티 조회
|
||||
MapSheetLearnEntity analEntity =
|
||||
queryFactory
|
||||
.selectFrom(mapSheetLearnEntity)
|
||||
.where(mapSheetLearnEntity.uuid.eq(uuid))
|
||||
.fetchOne();
|
||||
queryFactory
|
||||
.selectFrom(mapSheetLearnEntity)
|
||||
.where(mapSheetLearnEntity.uuid.eq(uuid))
|
||||
.fetchOne();
|
||||
|
||||
if (analEntity == null) {
|
||||
throw new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND);
|
||||
@@ -383,22 +383,22 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
||||
|
||||
if (searchGeoReq.getTargetClass() != null && !searchGeoReq.getTargetClass().isBlank()) {
|
||||
where.and(
|
||||
mapSheetAnalDataInferenceGeomEntity.classAfterCd.eq(
|
||||
searchGeoReq.getTargetClass().toLowerCase()));
|
||||
mapSheetAnalDataInferenceGeomEntity.classAfterCd.eq(
|
||||
searchGeoReq.getTargetClass().toLowerCase()));
|
||||
}
|
||||
|
||||
if (searchGeoReq.getCompareClass() != null && !searchGeoReq.getCompareClass().isBlank()) {
|
||||
where.and(
|
||||
mapSheetAnalDataInferenceGeomEntity.classBeforeCd.eq(
|
||||
searchGeoReq.getCompareClass().toLowerCase()));
|
||||
mapSheetAnalDataInferenceGeomEntity.classBeforeCd.eq(
|
||||
searchGeoReq.getCompareClass().toLowerCase()));
|
||||
}
|
||||
|
||||
if (searchGeoReq.getMapSheetNum() != null) {
|
||||
//
|
||||
// where.and(mapSheetAnalDataInferenceGeomEntity.mapSheetNum.eq(searchGeoReq.getMapSheetNum()));
|
||||
where.and(
|
||||
mapSheetAnalDataInferenceGeomEntity.mapSheetNum.like(
|
||||
"%" + searchGeoReq.getMapSheetNum() + "%"));
|
||||
mapSheetAnalDataInferenceGeomEntity.mapSheetNum.like(
|
||||
"%" + searchGeoReq.getMapSheetNum() + "%"));
|
||||
}
|
||||
|
||||
where.and(mapSheetAnalDataInferenceGeomEntity.classAfterCd.isNotNull());
|
||||
@@ -408,66 +408,64 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
||||
|
||||
// 3) inkx 조인 조건: JPQL/HQL에서 '~' 불가 → function('regexp_match', ...) 사용
|
||||
BooleanExpression inkxIsNumeric =
|
||||
Expressions.booleanTemplate(
|
||||
"function('regexp_match', {0}, '^[0-9]+$') is not null", mapInkx5kEntity.mapidcdNo);
|
||||
Expressions.booleanTemplate(
|
||||
"function('regexp_match', {0}, '^[0-9]+$') is not null", mapInkx5kEntity.mapidcdNo);
|
||||
|
||||
NumberExpression<Long> inkxNoAsLong =
|
||||
Expressions.numberTemplate(Long.class, "cast({0} as long)", mapInkx5kEntity.mapidcdNo);
|
||||
Expressions.numberTemplate(Long.class, "cast({0} as long)", mapInkx5kEntity.mapidcdNo);
|
||||
|
||||
StringExpression pnu =
|
||||
Expressions.stringTemplate(
|
||||
"coalesce(({0}), '')",
|
||||
JPAExpressions
|
||||
.select(Expressions.stringTemplate("string_agg({0}, ',')", pnuEntity.pnu))
|
||||
.from(pnuEntity)
|
||||
.where(pnuEntity.geo.geoUid.eq(mapSheetAnalDataInferenceGeomEntity.geoUid))
|
||||
);
|
||||
Expressions.stringTemplate(
|
||||
"coalesce(({0}), '')",
|
||||
JPAExpressions.select(Expressions.stringTemplate("string_agg({0}, ',')", pnuEntity.pnu))
|
||||
.from(pnuEntity)
|
||||
.where(pnuEntity.geo.geoUid.eq(mapSheetAnalDataInferenceGeomEntity.geoUid)));
|
||||
|
||||
// 4) content
|
||||
List<Geom> content =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
Geom.class,
|
||||
mapSheetAnalDataInferenceGeomEntity.uuid,
|
||||
mapSheetAnalDataInferenceGeomEntity.resultUid,
|
||||
mapSheetAnalDataInferenceGeomEntity.compareYyyy,
|
||||
mapSheetAnalDataInferenceGeomEntity.targetYyyy,
|
||||
mapSheetAnalDataInferenceGeomEntity.cdProb,
|
||||
mapSheetAnalDataInferenceGeomEntity.classBeforeCd,
|
||||
mapSheetAnalDataInferenceGeomEntity.classBeforeProb,
|
||||
mapSheetAnalDataInferenceGeomEntity.classAfterCd,
|
||||
mapSheetAnalDataInferenceGeomEntity.classAfterProb,
|
||||
mapSheetAnalDataInferenceGeomEntity.mapSheetNum,
|
||||
mapInkx5kEntity.mapidNm,
|
||||
Expressions.stringTemplate(
|
||||
"substring({0} from 1 for 8)",
|
||||
mapSheetAnalDataInferenceGeomEntity.resultUid
|
||||
), pnu))
|
||||
.from(mapSheetAnalInferenceEntity)
|
||||
.join(mapSheetAnalDataInferenceEntity)
|
||||
.on(mapSheetAnalDataInferenceEntity.analUid.eq(mapSheetAnalInferenceEntity.id))
|
||||
.join(mapSheetAnalDataInferenceGeomEntity)
|
||||
.on(mapSheetAnalDataInferenceGeomEntity.dataUid.eq(mapSheetAnalDataInferenceEntity.id))
|
||||
.join(mapInkx5kEntity)
|
||||
.on(inkxIsNumeric.and(mapSheetAnalDataInferenceGeomEntity.mapSheetNum.eq(inkxNoAsLong)))
|
||||
.where(where)
|
||||
.orderBy(mapSheetAnalDataInferenceGeomEntity.geoUid.desc())
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.fetch();
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
Geom.class,
|
||||
mapSheetAnalDataInferenceGeomEntity.uuid,
|
||||
mapSheetAnalDataInferenceGeomEntity.resultUid,
|
||||
mapSheetAnalDataInferenceGeomEntity.compareYyyy,
|
||||
mapSheetAnalDataInferenceGeomEntity.targetYyyy,
|
||||
mapSheetAnalDataInferenceGeomEntity.cdProb,
|
||||
mapSheetAnalDataInferenceGeomEntity.classBeforeCd,
|
||||
mapSheetAnalDataInferenceGeomEntity.classBeforeProb,
|
||||
mapSheetAnalDataInferenceGeomEntity.classAfterCd,
|
||||
mapSheetAnalDataInferenceGeomEntity.classAfterProb,
|
||||
mapSheetAnalDataInferenceGeomEntity.mapSheetNum,
|
||||
mapInkx5kEntity.mapidNm,
|
||||
Expressions.stringTemplate(
|
||||
"substring({0} from 1 for 8)",
|
||||
mapSheetAnalDataInferenceGeomEntity.resultUid),
|
||||
pnu))
|
||||
.from(mapSheetAnalInferenceEntity)
|
||||
.join(mapSheetAnalDataInferenceEntity)
|
||||
.on(mapSheetAnalDataInferenceEntity.analUid.eq(mapSheetAnalInferenceEntity.id))
|
||||
.join(mapSheetAnalDataInferenceGeomEntity)
|
||||
.on(mapSheetAnalDataInferenceGeomEntity.dataUid.eq(mapSheetAnalDataInferenceEntity.id))
|
||||
.join(mapInkx5kEntity)
|
||||
.on(inkxIsNumeric.and(mapSheetAnalDataInferenceGeomEntity.mapSheetNum.eq(inkxNoAsLong)))
|
||||
.where(where)
|
||||
.orderBy(mapSheetAnalDataInferenceGeomEntity.geoUid.desc())
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.fetch();
|
||||
|
||||
// 5) total (조인 최소화 유지)
|
||||
Long total =
|
||||
queryFactory
|
||||
.select(mapSheetAnalDataInferenceGeomEntity.geoUid.count())
|
||||
.from(mapSheetAnalInferenceEntity)
|
||||
.join(mapSheetAnalDataInferenceEntity)
|
||||
.on(mapSheetAnalDataInferenceEntity.analUid.eq(mapSheetAnalInferenceEntity.id))
|
||||
.join(mapSheetAnalDataInferenceGeomEntity)
|
||||
.on(mapSheetAnalDataInferenceGeomEntity.dataUid.eq(mapSheetAnalDataInferenceEntity.id))
|
||||
.where(where)
|
||||
.fetchOne();
|
||||
queryFactory
|
||||
.select(mapSheetAnalDataInferenceGeomEntity.geoUid.count())
|
||||
.from(mapSheetAnalInferenceEntity)
|
||||
.join(mapSheetAnalDataInferenceEntity)
|
||||
.on(mapSheetAnalDataInferenceEntity.analUid.eq(mapSheetAnalInferenceEntity.id))
|
||||
.join(mapSheetAnalDataInferenceGeomEntity)
|
||||
.on(mapSheetAnalDataInferenceGeomEntity.dataUid.eq(mapSheetAnalDataInferenceEntity.id))
|
||||
.where(where)
|
||||
.fetchOne();
|
||||
|
||||
return new PageImpl<>(content, pageable, total == null ? 0L : total);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user