spotless 적용

This commit is contained in:
2026-01-14 17:25:29 +09:00
parent 986b93c470
commit 05d10e63fe
5 changed files with 467 additions and 452 deletions

View File

@@ -106,7 +106,7 @@ public class InferenceResultCoreService {
mapSheetLearnEntity.setMapSheetCnt(mapSheetName);
mapSheetLearnEntity.setDetectingCnt((long) detectingCnt);
mapSheetLearnEntity.setStage(
mapSheetLearnRepository.getLearnStage(req.getCompareYyyy(), req.getTargetYyyy()));
mapSheetLearnRepository.getLearnStage(req.getCompareYyyy(), req.getTargetYyyy()));
// learn 테이블 저장
MapSheetLearnEntity savedLearn = mapSheetLearnRepository.save(mapSheetLearnEntity);
@@ -168,9 +168,9 @@ public class InferenceResultCoreService {
*/
public InferenceDetailDto.AnalResSummary getInferenceResultSummary(Long id) {
InferenceDetailDto.AnalResSummary summary =
mapSheetAnalDataRepository
.getInferenceResultSummary(id)
.orElseThrow(() -> new EntityNotFoundException("요약정보를 찾을 수 없습니다. " + id));
mapSheetAnalDataRepository
.getInferenceResultSummary(id)
.orElseThrow(() -> new EntityNotFoundException("요약정보를 찾을 수 없습니다. " + id));
return summary;
}
@@ -191,7 +191,7 @@ public class InferenceResultCoreService {
* @return
*/
public Page<InferenceDetailDto.Geom> getInferenceResultGeomList(
Long id, InferenceDetailDto.SearchGeoReq searchGeoReq) {
Long id, InferenceDetailDto.SearchGeoReq searchGeoReq) {
return mapSheetAnalDataRepository.getInferenceGeomList(id, searchGeoReq);
}
@@ -203,16 +203,16 @@ public class InferenceResultCoreService {
*/
@Transactional(readOnly = true)
public Page<InferenceDetailDto.DetailListEntity> listInferenceResultWithGeom(
@NotNull Long analyId, InferenceDetailDto.SearchGeoReq searchReq) {
@NotNull Long analyId, InferenceDetailDto.SearchGeoReq searchReq) {
// 분석 ID 에 해당하는 dataids를 가져온다.
List<Long> dataIds =
mapSheetAnalDataRepository.listAnalyGeom(analyId).stream()
.mapToLong(MapSheetAnalDataInferenceEntity::getId)
.boxed()
.toList();
mapSheetAnalDataRepository.listAnalyGeom(analyId).stream()
.mapToLong(MapSheetAnalDataInferenceEntity::getId)
.boxed()
.toList();
// 해당데이터의 폴리곤데이터를 가져온다
Page<MapSheetAnalDataInferenceGeomEntity> mapSheetAnalDataGeomEntities =
mapSheetAnalDataRepository.listInferenceResultWithGeom(dataIds, searchReq);
mapSheetAnalDataRepository.listInferenceResultWithGeom(dataIds, searchReq);
return mapSheetAnalDataGeomEntities.map(MapSheetAnalDataInferenceGeomEntity::toEntity);
}
@@ -229,14 +229,14 @@ public class InferenceResultCoreService {
@Transactional(readOnly = true)
public List<MapSheet> listGetScenes5k(Long analyId) {
List<String> sceneCodes =
mapSheetAnalDataRepository.listAnalyGeom(analyId).stream()
.mapToLong(MapSheetAnalDataInferenceEntity::getMapSheetNum)
.mapToObj(String::valueOf)
.toList();
mapSheetAnalDataRepository.listAnalyGeom(analyId).stream()
.mapToLong(MapSheetAnalDataInferenceEntity::getMapSheetNum)
.mapToObj(String::valueOf)
.toList();
return mapInkx5kRepository.listGetScenes5k(sceneCodes).stream()
.map(MapInkx5kEntity::toEntity)
.toList();
.map(MapInkx5kEntity::toEntity)
.toList();
}
/**
@@ -246,9 +246,9 @@ public class InferenceResultCoreService {
*/
public void update(SaveInferenceAiDto request) {
MapSheetLearnEntity entity =
mapSheetLearnRepository
.getInferenceResultByUuid(request.getUuid())
.orElseThrow(EntityNotFoundException::new);
mapSheetLearnRepository
.getInferenceResultByUuid(request.getUuid())
.orElseThrow(EntityNotFoundException::new);
// M1/M2/M3 영역 업데이트
if (request.getType() != null) {
@@ -270,46 +270,49 @@ public class InferenceResultCoreService {
private void applyModelUpdate(MapSheetLearnEntity entity, SaveInferenceAiDto request) {
switch (request.getType()) {
case "M1" -> applyModelFields(
request,
entity::setM1ModelBatchId,
entity::setM1ModelStartDttm,
entity::setM1ModelEndDttm,
entity::setM1PendingJobs,
entity::setM1RunningJobs,
entity::setM1CompletedJobs,
entity::setM1FailedJobs);
case "M2" -> applyModelFields(
request,
entity::setM2ModelBatchId,
entity::setM2ModelStartDttm,
entity::setM2ModelEndDttm,
entity::setM2PendingJobs,
entity::setM2RunningJobs,
entity::setM2CompletedJobs,
entity::setM2FailedJobs);
case "M3" -> applyModelFields(
request,
entity::setM3ModelBatchId,
entity::setM3ModelStartDttm,
entity::setM3ModelEndDttm,
entity::setM3PendingJobs,
entity::setM3RunningJobs,
entity::setM3CompletedJobs,
entity::setM3FailedJobs);
case "M1" ->
applyModelFields(
request,
entity::setM1ModelBatchId,
entity::setM1ModelStartDttm,
entity::setM1ModelEndDttm,
entity::setM1PendingJobs,
entity::setM1RunningJobs,
entity::setM1CompletedJobs,
entity::setM1FailedJobs);
case "M2" ->
applyModelFields(
request,
entity::setM2ModelBatchId,
entity::setM2ModelStartDttm,
entity::setM2ModelEndDttm,
entity::setM2PendingJobs,
entity::setM2RunningJobs,
entity::setM2CompletedJobs,
entity::setM2FailedJobs);
case "M3" ->
applyModelFields(
request,
entity::setM3ModelBatchId,
entity::setM3ModelStartDttm,
entity::setM3ModelEndDttm,
entity::setM3PendingJobs,
entity::setM3RunningJobs,
entity::setM3CompletedJobs,
entity::setM3FailedJobs);
default -> throw new IllegalArgumentException("Unknown type: " + request.getType());
}
}
private void applyModelFields(
SaveInferenceAiDto request,
Consumer<Long> setBatchId,
Consumer<ZonedDateTime> setStart,
Consumer<ZonedDateTime> setEnd,
Consumer<Integer> setPending,
Consumer<Integer> setRunning,
Consumer<Integer> setCompleted,
Consumer<Integer> setFailed) {
SaveInferenceAiDto request,
Consumer<Long> setBatchId,
Consumer<ZonedDateTime> setStart,
Consumer<ZonedDateTime> setEnd,
Consumer<Integer> setPending,
Consumer<Integer> setRunning,
Consumer<Integer> setCompleted,
Consumer<Integer> setFailed) {
applyIfNotNull(request.getBatchId(), setBatchId);
applyIfNotNull(request.getModelStartDttm(), setStart);
applyIfNotNull(request.getModelEndDttm(), setEnd);
@@ -336,7 +339,7 @@ public class InferenceResultCoreService {
public InferenceBatchSheet getInferenceResultByStatus(String status) {
MapSheetLearnEntity entity =
mapSheetLearnRepository.getInferenceResultByStatus(status).orElse(null);
mapSheetLearnRepository.getInferenceResultByStatus(status).orElse(null);
if (entity == null) {
return null;
@@ -382,7 +385,7 @@ public class InferenceResultCoreService {
/**
* @param compareYear 비교년도
* @param targetYear 기준년도
* @param targetYear 기준년도
* @return
*/
public Integer getLearnStage(Integer compareYear, Integer targetYear) {

View File

@@ -52,7 +52,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())) {
@@ -66,10 +66,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()))));
}
// 제목
@@ -78,21 +78,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);
}
@@ -100,10 +100,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
@@ -112,41 +112,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;
}
@@ -154,11 +154,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());
}
/**
@@ -177,46 +177,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;
}
@@ -227,30 +227,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;
}
@@ -261,10 +261,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
@@ -274,17 +274,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;
}
@@ -296,28 +296,28 @@ 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();
}
@Override