Merge pull request '추론결과 목록조회 수정' (#347) from feat/infer_dev_260107 into develop
Reviewed-on: https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice/pulls/347
This commit is contained in:
@@ -5,7 +5,10 @@ import com.kamco.cd.kamcoback.inference.dto.InferenceResultShpDto;
|
||||
import com.kamco.cd.kamcoback.postgres.core.InferenceResultCoreService;
|
||||
import com.kamco.cd.kamcoback.postgres.core.InferenceResultShpCoreService;
|
||||
import com.kamco.cd.kamcoback.scheduler.service.ShpPipelineService;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -46,10 +49,12 @@ public class InferenceResultShpService {
|
||||
if (dto == null) {
|
||||
return;
|
||||
}
|
||||
Long m1BatchId = dto.getM1ModelBatchId();
|
||||
Long m2BatchId = dto.getM2ModelBatchId();
|
||||
Long m3BatchId = dto.getM3ModelBatchId();
|
||||
String batchId = m1BatchId + "," + m2BatchId + "," + m3BatchId;
|
||||
|
||||
String batchId =
|
||||
Stream.of(dto.getM1ModelBatchId(), dto.getM2ModelBatchId(), dto.getM3ModelBatchId())
|
||||
.filter(Objects::nonNull)
|
||||
.map(String::valueOf)
|
||||
.collect(Collectors.joining(","));
|
||||
|
||||
// shp 파일 비동기 생성
|
||||
shpPipelineService.runPipeline(jarPath, datasetDir, batchId, dto.getUid());
|
||||
|
||||
@@ -69,8 +69,8 @@ public class InferenceResultCoreService {
|
||||
* @return
|
||||
*/
|
||||
public Page<ResultList> getInferenceResultList(InferenceResultDto.SearchListReq req) {
|
||||
Page<MapSheetLearnEntity> list = mapSheetLearnRepository.getInferenceMgnResultList(req);
|
||||
return list.map(MapSheetLearnEntity::toDto);
|
||||
Page<ResultList> list = mapSheetLearnRepository.getInferenceMgnResultList(req);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -110,8 +110,7 @@ public class InferenceResultCoreService {
|
||||
mapSheetLearnEntity.setDetectOption(req.getDetectOption());
|
||||
mapSheetLearnEntity.setCreatedUid(userUtil.getId());
|
||||
mapSheetLearnEntity.setMapSheetCnt(mapSheetName);
|
||||
// 도엽건수가 아니라 실제 탐지건수(polygon), 추론 1분 배치에서 업데이트
|
||||
mapSheetLearnEntity.setDetectingCnt(0L);
|
||||
mapSheetLearnEntity.setDetectingCnt((long) detectingCnt);
|
||||
// 회차는 국유인 반영할때 update로 변경됨
|
||||
// mapSheetLearnEntity.setStage(
|
||||
// mapSheetLearnRepository.getLearnStage(req.getCompareYyyy(), req.getTargetYyyy()));
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.kamco.cd.kamcoback.inference.dto.InferenceProgressDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.InferenceServerStatusDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.InferenceStatusDetailDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.ResultList;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetLearnEntity;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@@ -18,7 +19,7 @@ import org.springframework.data.domain.Page;
|
||||
|
||||
public interface MapSheetLearnRepositoryCustom {
|
||||
|
||||
Page<MapSheetLearnEntity> getInferenceMgnResultList(InferenceResultDto.SearchListReq req);
|
||||
Page<ResultList> getInferenceMgnResultList(InferenceResultDto.SearchListReq req);
|
||||
|
||||
Optional<MapSheetLearnEntity> getInferenceResultByUuid(UUID uuid);
|
||||
|
||||
|
||||
@@ -24,8 +24,10 @@ import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.InferenceServerStatusDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.InferenceStatusDetailDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.MapSheetScope;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.ResultList;
|
||||
import com.kamco.cd.kamcoback.model.service.ModelMngService;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetLearnEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QInferenceResultsTestingEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QModelMngEntity;
|
||||
@@ -60,7 +62,7 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
||||
private final ModelMngService modelMngService;
|
||||
|
||||
@Override
|
||||
public Page<MapSheetLearnEntity> getInferenceMgnResultList(InferenceResultDto.SearchListReq req) {
|
||||
public Page<ResultList> getInferenceMgnResultList(InferenceResultDto.SearchListReq req) {
|
||||
Pageable pageable = req.toPageable();
|
||||
BooleanBuilder builder = new BooleanBuilder();
|
||||
|
||||
@@ -90,24 +92,75 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
||||
builder.and(mapSheetLearnEntity.title.containsIgnoreCase(req.getTitle()));
|
||||
}
|
||||
|
||||
List<MapSheetLearnEntity> content =
|
||||
QInferenceResultsTestingEntity irt =
|
||||
QInferenceResultsTestingEntity.inferenceResultsTestingEntity;
|
||||
BooleanExpression joinCond =
|
||||
mapSheetLearnEntity
|
||||
.m1ModelBatchId
|
||||
.isNotNull()
|
||||
.and(irt.batchId.eq(mapSheetLearnEntity.m1ModelBatchId))
|
||||
.or(
|
||||
mapSheetLearnEntity
|
||||
.m2ModelBatchId
|
||||
.isNotNull()
|
||||
.and(irt.batchId.eq(mapSheetLearnEntity.m2ModelBatchId)))
|
||||
.or(
|
||||
mapSheetLearnEntity
|
||||
.m3ModelBatchId
|
||||
.isNotNull()
|
||||
.and(irt.batchId.eq(mapSheetLearnEntity.m3ModelBatchId)));
|
||||
|
||||
List<ResultList> content =
|
||||
queryFactory
|
||||
.select(mapSheetLearnEntity)
|
||||
.select(
|
||||
Projections.constructor(
|
||||
ResultList.class,
|
||||
mapSheetLearnEntity.uuid,
|
||||
mapSheetLearnEntity.title,
|
||||
mapSheetLearnEntity.stage,
|
||||
mapSheetLearnEntity.status,
|
||||
mapSheetLearnEntity.mapSheetCnt,
|
||||
irt.seq.count(),
|
||||
mapSheetLearnEntity.inferStartDttm,
|
||||
mapSheetLearnEntity.inferEndDttm,
|
||||
mapSheetLearnEntity.applyYn,
|
||||
mapSheetLearnEntity.applyDttm,
|
||||
mapSheetLearnEntity.compareYyyy,
|
||||
mapSheetLearnEntity.targetYyyy,
|
||||
mapSheetLearnEntity.uid))
|
||||
.from(mapSheetLearnEntity)
|
||||
.leftJoin(irt)
|
||||
.on(joinCond)
|
||||
.where(builder)
|
||||
.groupBy(
|
||||
mapSheetLearnEntity.id,
|
||||
mapSheetLearnEntity.uuid,
|
||||
mapSheetLearnEntity.title,
|
||||
mapSheetLearnEntity.stage,
|
||||
mapSheetLearnEntity.status,
|
||||
mapSheetLearnEntity.mapSheetCnt,
|
||||
mapSheetLearnEntity.inferStartDttm,
|
||||
mapSheetLearnEntity.inferEndDttm,
|
||||
mapSheetLearnEntity.applyYn,
|
||||
mapSheetLearnEntity.applyDttm,
|
||||
mapSheetLearnEntity.compareYyyy,
|
||||
mapSheetLearnEntity.targetYyyy,
|
||||
mapSheetLearnEntity.uid)
|
||||
.orderBy(mapSheetLearnEntity.id.desc())
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.orderBy(mapSheetLearnEntity.id.desc())
|
||||
.fetch();
|
||||
|
||||
Long total =
|
||||
queryFactory
|
||||
.select(mapSheetLearnEntity.count())
|
||||
.from(mapSheetLearnEntity)
|
||||
.where(builder)
|
||||
.fetchOne();
|
||||
Optional.ofNullable(
|
||||
queryFactory
|
||||
.select(mapSheetLearnEntity.count())
|
||||
.from(mapSheetLearnEntity)
|
||||
.where(builder)
|
||||
.fetchOne())
|
||||
.orElse(0L);
|
||||
|
||||
return new PageImpl<>(content, pageable, total == null ? 0L : total);
|
||||
return new PageImpl<>(content, pageable, total);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user