[KC-108] ai api batch 작업중
This commit is contained in:
@@ -65,11 +65,11 @@ public class InferenceResultCoreService {
|
||||
*/
|
||||
public UUID saveInferenceInfo(InferenceResultDto.RegReq req) {
|
||||
String mapSheetName =
|
||||
req.getMapSheetNum().get(0).getMapSheetName() + " 외 " + req.getMapSheetNum().size() + "건";
|
||||
req.getMapSheetNum().get(0).getMapSheetName() + " 외 " + req.getMapSheetNum().size() + "건";
|
||||
|
||||
if (req.getMapSheetNum().size() == 1) {
|
||||
mapSheetName =
|
||||
req.getMapSheetNum().get(0).getMapSheetName() + " " + req.getMapSheetNum().size() + "건";
|
||||
req.getMapSheetNum().get(0).getMapSheetName() + " " + req.getMapSheetNum().size() + "건";
|
||||
}
|
||||
|
||||
MapSheetLearnEntity mapSheetLearnEntity = new MapSheetLearnEntity();
|
||||
@@ -117,22 +117,22 @@ public class InferenceResultCoreService {
|
||||
|
||||
// 청크 번호 추출 in 조건 만들기
|
||||
List<String> chunkNums =
|
||||
buffer.stream().map(e -> String.valueOf(e.getMapSheetNum())).distinct().toList();
|
||||
buffer.stream().map(e -> String.valueOf(e.getMapSheetNum())).distinct().toList();
|
||||
|
||||
// 추론 제외
|
||||
List<MapInkx5kEntity> usedEntities =
|
||||
mapInkx5kRepository.findByMapSheetNumInAndUseInference(chunkNums, CommonUseStatus.USE);
|
||||
mapInkx5kRepository.findByMapSheetNumInAndUseInference(chunkNums, CommonUseStatus.USE);
|
||||
|
||||
// TODO 추론 제외 했으면 파일 있는지도 확인 해야함
|
||||
// 조회 결과에서 번호만 Set으로
|
||||
Set<String> usedSet =
|
||||
usedEntities.stream()
|
||||
.map(MapInkx5kEntity::getMapidcdNo)
|
||||
.collect(java.util.stream.Collectors.toSet());
|
||||
usedEntities.stream()
|
||||
.map(MapInkx5kEntity::getMapidcdNo)
|
||||
.collect(java.util.stream.Collectors.toSet());
|
||||
|
||||
// 필터 후 저장
|
||||
List<MapSheetLearn5kEntity> toSave =
|
||||
buffer.stream().filter(e -> usedSet.contains(String.valueOf(e.getMapSheetNum()))).toList();
|
||||
buffer.stream().filter(e -> usedSet.contains(String.valueOf(e.getMapSheetNum()))).toList();
|
||||
|
||||
if (!toSave.isEmpty()) {
|
||||
mapSheetLearn5kRepository.saveAll(toSave);
|
||||
@@ -152,9 +152,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;
|
||||
}
|
||||
|
||||
@@ -175,7 +175,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);
|
||||
}
|
||||
|
||||
@@ -187,16 +187,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);
|
||||
}
|
||||
|
||||
@@ -213,21 +213,21 @@ 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();
|
||||
}
|
||||
|
||||
public void update(SaveInferenceAiDto request) {
|
||||
MapSheetLearnEntity entity =
|
||||
mapSheetLearnRepository
|
||||
.getInferenceResultByUuid(request.getUuid())
|
||||
.orElseThrow(() -> new EntityNotFoundException());
|
||||
mapSheetLearnRepository
|
||||
.getInferenceResultByUuid(request.getUuid())
|
||||
.orElseThrow(() -> new EntityNotFoundException());
|
||||
|
||||
if (request.getType().equals("M1")) {
|
||||
entity.setM1ModelBatchId(request.getBatchId());
|
||||
@@ -296,7 +296,6 @@ public class InferenceResultCoreService {
|
||||
}
|
||||
|
||||
entity.setUpdatedDttm(ZonedDateTime.now());
|
||||
|
||||
}
|
||||
|
||||
public List<InferenceServerStatusDto> getInferenceServerStatusList() {
|
||||
@@ -305,9 +304,9 @@ public class InferenceResultCoreService {
|
||||
|
||||
public InferenceBatchSheet getInferenceResultByStatus(String status) {
|
||||
MapSheetLearnEntity entity =
|
||||
mapSheetLearnRepository
|
||||
.getInferenceResultByStatus(status)
|
||||
.orElseThrow(() -> new EntityNotFoundException(status));
|
||||
mapSheetLearnRepository
|
||||
.getInferenceResultByStatus(status)
|
||||
.orElseThrow(() -> new EntityNotFoundException(status));
|
||||
|
||||
InferenceBatchSheet inferenceBatchSheet = new InferenceBatchSheet();
|
||||
inferenceBatchSheet.setId(entity.getId());
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -126,28 +126,33 @@ public class MapSheetLearnEntity {
|
||||
|
||||
@Column(name = "m1_model_start_dttm")
|
||||
private ZonedDateTime m1ModelStartDttm;
|
||||
|
||||
@Column(name = "m2_model_start_dttm")
|
||||
private ZonedDateTime m2ModelStartDttm;
|
||||
|
||||
@Column(name = "m3_model_start_dttm")
|
||||
private ZonedDateTime m3ModelStartDttm;
|
||||
|
||||
@Column(name = "m1_model_end_dttm")
|
||||
private ZonedDateTime m1ModelEndDttm;
|
||||
|
||||
@Column(name = "m2_model_end_dttm")
|
||||
private ZonedDateTime m2ModelEndDttm;
|
||||
|
||||
@Column(name = "m3_model_end_dttm")
|
||||
private ZonedDateTime m3ModelEndDttm;
|
||||
|
||||
public InferenceResultDto.ResultList toDto() {
|
||||
return new InferenceResultDto.ResultList(
|
||||
this.uuid,
|
||||
this.title,
|
||||
this.status,
|
||||
this.mapSheetCnt,
|
||||
this.detectingCnt,
|
||||
this.inferStartDttm,
|
||||
this.inferEndDttm,
|
||||
this.elapsedTime,
|
||||
this.applyYn,
|
||||
this.applyDttm);
|
||||
this.uuid,
|
||||
this.title,
|
||||
this.status,
|
||||
this.mapSheetCnt,
|
||||
this.detectingCnt,
|
||||
this.inferStartDttm,
|
||||
this.inferEndDttm,
|
||||
this.elapsedTime,
|
||||
this.applyYn,
|
||||
this.applyDttm);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +172,6 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
||||
mapSheetLearnEntity.inferEndDttm,
|
||||
mapSheetLearnEntity.detectingCnt,
|
||||
mapSheetLearnEntity.detectEndCnt,
|
||||
|
||||
m1Model.modelVer.as("model1Ver"),
|
||||
m2Model.modelVer.as("model2Ver"),
|
||||
m3Model.modelVer.as("model3Ver")))
|
||||
@@ -195,30 +194,29 @@ 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
|
||||
))
|
||||
.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))
|
||||
.from(mapSheetLearnEntity)
|
||||
.join(model)
|
||||
.on(model.uuid.eq(modelUuid))
|
||||
.where(mapSheetLearnEntity.id.eq(id))
|
||||
.fetchOne();
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user