This commit is contained in:
2026-01-14 15:15:11 +09:00
parent af428423c9
commit 50b8585c76
3 changed files with 226 additions and 239 deletions

View File

@@ -30,22 +30,20 @@ public class InferenceDetailDto {
private String dataName;
private Long mapSheepNum;
private Long detectingCnt;
@JsonFormatDttm
private ZonedDateTime analStrtDttm;
@JsonFormatDttm
private ZonedDateTime analEndDttm;
@JsonFormatDttm private ZonedDateTime analStrtDttm;
@JsonFormatDttm private ZonedDateTime analEndDttm;
private Long analSec;
private String analState;
public Basic(
Long id,
String dataName,
Long mapSheepNum,
Long detectingCnt,
ZonedDateTime analStrtDttm,
ZonedDateTime analEndDttm,
Long analSec,
String analState) {
Long id,
String dataName,
Long mapSheepNum,
Long detectingCnt,
ZonedDateTime analStrtDttm,
ZonedDateTime analEndDttm,
Long analSec,
String analState) {
this.id = id;
this.dataName = dataName;
this.mapSheepNum = mapSheepNum;
@@ -64,10 +62,8 @@ public class InferenceDetailDto {
private Long id;
private String analTitle;
private Long detectingCnt;
@JsonFormatDttm
private ZonedDateTime analStrtDttm;
@JsonFormatDttm
private ZonedDateTime analEndDttm;
@JsonFormatDttm private ZonedDateTime analStrtDttm;
@JsonFormatDttm private ZonedDateTime analEndDttm;
private Long analSec;
private Long analPredSec;
private String analState;
@@ -75,16 +71,16 @@ public class InferenceDetailDto {
private String gukyuinUsed;
public AnalResList(
Long id,
String analTitle,
Long detectingCnt,
ZonedDateTime analStrtDttm,
ZonedDateTime analEndDttm,
Long analSec,
Long analPredSec,
String analState,
String analStateNm,
String gukyuinUsed) {
Long id,
String analTitle,
Long detectingCnt,
ZonedDateTime analStrtDttm,
ZonedDateTime analEndDttm,
Long analSec,
Long analPredSec,
String analState,
String analStateNm,
String gukyuinUsed) {
this.id = id;
this.analTitle = analTitle;
this.detectingCnt = detectingCnt;
@@ -107,10 +103,8 @@ public class InferenceDetailDto {
private String modelInfo;
private Integer targetYyyy;
private Integer compareYyyy;
@JsonFormatDttm
private ZonedDateTime analStrtDttm;
@JsonFormatDttm
private ZonedDateTime analEndDttm;
@JsonFormatDttm private ZonedDateTime analStrtDttm;
@JsonFormatDttm private ZonedDateTime analEndDttm;
private Long analSec;
private Long analPredSec;
private String resultUrl;
@@ -120,20 +114,20 @@ public class InferenceDetailDto {
private String analStateNm;
public AnalResSummary(
Long id,
String analTitle,
String modelInfo,
Integer targetYyyy,
Integer compareYyyy,
ZonedDateTime analStrtDttm,
ZonedDateTime analEndDttm,
Long analSec,
Long analPredSec,
String resultUrl,
Long detectingCnt,
Double accuracy,
String analState,
String analStateNm) {
Long id,
String analTitle,
String modelInfo,
Integer targetYyyy,
Integer compareYyyy,
ZonedDateTime analStrtDttm,
ZonedDateTime analEndDttm,
Long analSec,
Long analPredSec,
String resultUrl,
Long detectingCnt,
Double accuracy,
String analState,
String analStateNm) {
this.id = id;
this.analTitle = analTitle;
this.modelInfo = modelInfo;
@@ -190,17 +184,16 @@ public class InferenceDetailDto {
private Clazzes target;
private MapSheet mapSheet;
private Coordinate center;
@JsonFormatDttm
private ZonedDateTime updatedDttm;
@JsonFormatDttm private ZonedDateTime updatedDttm;
public DetailListEntity(
UUID uuid,
Double detectionScore,
Clazzes compare,
Clazzes target,
MapSheet mapSheet,
Coordinate center,
ZonedDateTime updatedDttm) {
UUID uuid,
Double detectionScore,
Clazzes compare,
Clazzes target,
MapSheet mapSheet,
Coordinate center,
ZonedDateTime updatedDttm) {
this.code = new Uid(uuid);
this.detectionScore = detectionScore;
this.compare = compare;
@@ -241,8 +234,7 @@ public class InferenceDetailDto {
private String code;
private String name;
@JsonIgnore
private Double score;
@JsonIgnore private Double score;
public Clazz(String code, Double score) {
this.code = code;
@@ -309,23 +301,21 @@ public class InferenceDetailDto {
String classAfterName;
Double classAfterProb;
Long mapSheetNum;
@JsonIgnore
String gemoStr;
@JsonIgnore
String geomCenterStr;
@JsonIgnore String gemoStr;
@JsonIgnore String geomCenterStr;
JsonNode gemo;
JsonNode geomCenter;
public Geom(
Integer compareYyyy,
Integer targetYyyy,
String classBeforeCd,
Double classBeforeProb,
String classAfterCd,
Double classAfterProb,
Long mapSheetNum,
String gemoStr,
String geomCenterStr) {
Integer compareYyyy,
Integer targetYyyy,
String classBeforeCd,
Double classBeforeProb,
String classAfterCd,
Double classAfterProb,
Long mapSheetNum,
String gemoStr,
String geomCenterStr) {
this.compareYyyy = compareYyyy;
this.targetYyyy = targetYyyy;
this.classBeforeCd = classBeforeCd;
@@ -396,7 +386,7 @@ public class InferenceDetailDto {
String[] sortParams = sort.split(",");
String property = sortParams[0];
Sort.Direction direction =
sortParams.length > 1 ? Sort.Direction.fromString(sortParams[1]) : Sort.Direction.ASC;
sortParams.length > 1 ? Sort.Direction.fromString(sortParams[1]) : Sort.Direction.ASC;
return PageRequest.of(page, size, Sort.by(direction, property));
}
return PageRequest.of(page, size);
@@ -435,24 +425,22 @@ public class InferenceDetailDto {
private Integer targetYyyy;
private String detectOption;
private String mapSheetScope;
@JsonFormatDttm
private ZonedDateTime inferStartDttm;
@JsonFormatDttm
private ZonedDateTime inferEndDttm;
@JsonFormatDttm private ZonedDateTime inferStartDttm;
@JsonFormatDttm private ZonedDateTime inferEndDttm;
private Duration elapsedDuration;
public AnalResultInfo(String analTitle,
String modelVer1,
String modelVer2,
String modelVer3,
Integer compareYyyy,
Integer targetYyyy,
String detectOption,
String mapSheetScope,
ZonedDateTime inferStartDttm,
ZonedDateTime inferEndDttm
) {
public AnalResultInfo(
String analTitle,
String modelVer1,
String modelVer2,
String modelVer3,
Integer compareYyyy,
Integer targetYyyy,
String detectOption,
String mapSheetScope,
ZonedDateTime inferStartDttm,
ZonedDateTime inferEndDttm) {
this.analTitle = analTitle;
this.modelVer1 = modelVer1;
this.modelVer2 = modelVer2;
@@ -463,9 +451,10 @@ public class InferenceDetailDto {
this.mapSheetScope = mapSheetScope;
this.inferStartDttm = inferStartDttm;
this.inferEndDttm = inferEndDttm;
this.elapsedDuration = (inferStartDttm != null && inferEndDttm != null)
? Duration.between(inferStartDttm, inferEndDttm)
: null;
this.elapsedDuration =
(inferStartDttm != null && inferEndDttm != null)
? Duration.between(inferStartDttm, inferEndDttm)
: null;
}
}
}

View File

@@ -41,7 +41,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())) {
@@ -55,10 +55,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()))));
}
// 제목
@@ -67,21 +67,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);
}
@@ -89,10 +89,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
@@ -101,41 +101,41 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
BooleanBuilder builder = new BooleanBuilder();
List<Integer> latestIds =
queryFactory
.select(systemMetricEntity.id1.max())
.from(systemMetricEntity)
.groupBy(systemMetricEntity.serverName)
.fetch();
queryFactory
.select(systemMetricEntity.id1.max())
.from(systemMetricEntity)
.groupBy(systemMetricEntity.serverName)
.fetch();
List<Integer> latestGpuIds =
queryFactory
.select(gpuMetricEntity.id1.max())
.from(gpuMetricEntity)
.groupBy(gpuMetricEntity.serverName)
.fetch();
queryFactory
.select(gpuMetricEntity.id1.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))
.from(systemMetricEntity)
.leftJoin(gpuMetricEntity)
.on(
gpuMetricEntity
.id1
.in(latestGpuIds)
.and(gpuMetricEntity.serverName.eq(systemMetricEntity.serverName)))
.where(systemMetricEntity.id1.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))
.from(systemMetricEntity)
.leftJoin(gpuMetricEntity)
.on(
gpuMetricEntity
.id1
.in(latestGpuIds)
.and(gpuMetricEntity.serverName.eq(systemMetricEntity.serverName)))
.where(systemMetricEntity.id1.in(latestIds)) // In 절 사용
.orderBy(systemMetricEntity.serverName.asc())
.limit(4)
.fetch();
return foundContent;
}
@@ -143,11 +143,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());
}
@Override
@@ -160,37 +160,37 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
QModelMngEntity m3Model = new QModelMngEntity("m3Model");
InferenceStatusDetailDto foundContent =
queryFactory
.select(
Projections.constructor(
InferenceStatusDetailDto.class,
mapSheetLearnEntity.title,
mapSheetLearnEntity.compareYyyy,
mapSheetLearnEntity.targetYyyy,
mapSheetLearnEntity.detectOption,
mapSheetLearnEntity.mapSheetScope,
mapSheetLearnEntity.inferStartDttm,
mapSheetLearnEntity.inferEndDttm,
mapSheetLearnEntity.detectingCnt,
mapSheetLearnEntity.detectEndCnt,
mapSheetLearnEntity.m1ModelStartDttm,
mapSheetLearnEntity.m1ModelEndDttm,
mapSheetLearnEntity.m2ModelStartDttm,
mapSheetLearnEntity.m2ModelEndDttm,
mapSheetLearnEntity.m3ModelStartDttm,
mapSheetLearnEntity.m3ModelEndDttm,
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.title,
mapSheetLearnEntity.compareYyyy,
mapSheetLearnEntity.targetYyyy,
mapSheetLearnEntity.detectOption,
mapSheetLearnEntity.mapSheetScope,
mapSheetLearnEntity.inferStartDttm,
mapSheetLearnEntity.inferEndDttm,
mapSheetLearnEntity.detectingCnt,
mapSheetLearnEntity.detectEndCnt,
mapSheetLearnEntity.m1ModelStartDttm,
mapSheetLearnEntity.m1ModelEndDttm,
mapSheetLearnEntity.m2ModelStartDttm,
mapSheetLearnEntity.m2ModelEndDttm,
mapSheetLearnEntity.m3ModelStartDttm,
mapSheetLearnEntity.m3ModelEndDttm,
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;
}
@@ -201,30 +201,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;
}
@@ -235,10 +235,10 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
*/
public UUID getProcessing() {
return queryFactory
.select(mapSheetLearnEntity.uuid)
.from(mapSheetLearnEntity)
.where(mapSheetLearnEntity.status.eq("IN_PROGRESS"))
.fetchOne();
.select(mapSheetLearnEntity.uuid)
.from(mapSheetLearnEntity)
.where(mapSheetLearnEntity.status.eq("IN_PROGRESS"))
.fetchOne();
}
@Override
@@ -248,17 +248,17 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
entity.setTargetYyyy(targetYear);
Integer stage =
queryFactory
.select(mapSheetLearnEntity.stage)
.from(mapSheetLearnEntity)
.where(
mapSheetLearnEntity
.compareYyyy
.eq(compareYear)
.and(mapSheetLearnEntity.targetYyyy.eq(targetYear)))
.orderBy(mapSheetLearnEntity.stage.desc())
.limit(1)
.fetchOne();
queryFactory
.select(mapSheetLearnEntity.stage)
.from(mapSheetLearnEntity)
.where(
mapSheetLearnEntity
.compareYyyy
.eq(compareYear)
.and(mapSheetLearnEntity.targetYyyy.eq(targetYear)))
.orderBy(mapSheetLearnEntity.stage.desc())
.limit(1)
.fetchOne();
return stage == null ? 1 : stage + 1;
}
@@ -270,28 +270,27 @@ 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
)
)
.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.fromString(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))
.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.fromString(uuid)))
.fetchOne();
}
}

View File

@@ -34,7 +34,6 @@ import com.querydsl.core.types.dsl.CaseBuilder;
import com.querydsl.core.types.dsl.Expressions;
import com.querydsl.core.types.dsl.NumberExpression;
import com.querydsl.core.types.dsl.StringExpression;
import com.querydsl.jpa.JPAExpressions;
import com.querydsl.jpa.impl.JPAQueryFactory;
import jakarta.persistence.EntityManager;
import jakarta.persistence.EntityNotFoundException;