[KC-168] 라벨링 툴 - 목록, 상세 API 나누기
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.kamco.cd.kamcoback.postgres.core;
|
||||
|
||||
import com.kamco.cd.kamcoback.postgres.repository.trainingdata.TrainingDataLabelRepository;
|
||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelingGeometryInfo;
|
||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelingListDto;
|
||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.searchReq;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -17,4 +18,8 @@ public class TrainingDataLabelCoreService {
|
||||
searchReq searchReq, String userId, String status) {
|
||||
return trainingDataLabelRepository.findLabelingAssignedList(searchReq, userId, status);
|
||||
}
|
||||
|
||||
public LabelingGeometryInfo findLabelingAssignedGeom(String assignmentUid) {
|
||||
return trainingDataLabelRepository.findLabelingAssignedGeom(assignmentUid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.trainingdata;
|
||||
|
||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelingGeometryInfo;
|
||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelingListDto;
|
||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.searchReq;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -7,4 +8,6 @@ import org.springframework.data.domain.Page;
|
||||
public interface TrainingDataLabelRepositoryCustom {
|
||||
|
||||
Page<LabelingListDto> findLabelingAssignedList(searchReq searchReq, String userId, String status);
|
||||
|
||||
LabelingGeometryInfo findLabelingAssignedGeom(String assignmentUid);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import static com.kamco.cd.kamcoback.postgres.entity.QMapInkx5kEntity.mapInkx5kE
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
||||
|
||||
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelingGeometryInfo;
|
||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelingListDto;
|
||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.searchReq;
|
||||
import com.querydsl.core.types.Projections;
|
||||
@@ -18,6 +19,7 @@ import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
@@ -49,15 +51,7 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
|
||||
labelingAssignmentEntity.workState,
|
||||
labelingAssignmentEntity.assignGroupId,
|
||||
mapInkx5kEntity.mapidNm,
|
||||
mapSheetAnalDataInferenceGeomEntity.pnu,
|
||||
Expressions.stringTemplate(
|
||||
"ST_AsGeoJSON({0})", mapSheetAnalDataInferenceGeomEntity.geom),
|
||||
makeCogUrl(mapSheetAnalDataInferenceGeomEntity.compareYyyy)
|
||||
.max()
|
||||
.as("beforeCogUrl"),
|
||||
makeCogUrl(mapSheetAnalDataInferenceGeomEntity.targetYyyy)
|
||||
.max()
|
||||
.as("afterCogUrl")))
|
||||
mapSheetAnalDataInferenceGeomEntity.pnu))
|
||||
.from(labelingAssignmentEntity)
|
||||
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||
.on(
|
||||
@@ -65,28 +59,7 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
|
||||
mapSheetAnalDataInferenceGeomEntity.geoUid))
|
||||
.innerJoin(mapInkx5kEntity)
|
||||
.on(labelingAssignmentEntity.assignGroupId.eq(mapInkx5kEntity.mapidcdNo))
|
||||
.leftJoin(imageryEntity)
|
||||
.on(
|
||||
imageryEntity
|
||||
.scene5k
|
||||
.eq(labelingAssignmentEntity.assignGroupId)
|
||||
.and(
|
||||
imageryEntity
|
||||
.year
|
||||
.eq(mapSheetAnalDataInferenceGeomEntity.compareYyyy)
|
||||
.or(
|
||||
imageryEntity.year.eq(
|
||||
mapSheetAnalDataInferenceGeomEntity.targetYyyy))))
|
||||
.where(labelingAssignmentEntity.workerUid.eq(userId), statusInLabelState(status))
|
||||
.groupBy(
|
||||
labelingAssignmentEntity.assignmentUid,
|
||||
labelingAssignmentEntity.inferenceGeomUid,
|
||||
labelingAssignmentEntity.workerUid,
|
||||
labelingAssignmentEntity.workState,
|
||||
labelingAssignmentEntity.assignGroupId,
|
||||
mapInkx5kEntity.mapidNm,
|
||||
mapSheetAnalDataInferenceGeomEntity.pnu,
|
||||
mapSheetAnalDataInferenceGeomEntity.geom)
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.orderBy(
|
||||
@@ -105,27 +78,60 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
|
||||
mapSheetAnalDataInferenceGeomEntity.geoUid))
|
||||
.innerJoin(mapInkx5kEntity)
|
||||
.on(labelingAssignmentEntity.assignGroupId.eq(mapInkx5kEntity.mapidcdNo))
|
||||
.leftJoin(imageryEntity)
|
||||
.on(
|
||||
imageryEntity
|
||||
.scene5k
|
||||
.eq(labelingAssignmentEntity.assignGroupId)
|
||||
.and(
|
||||
imageryEntity
|
||||
.year
|
||||
.eq(mapSheetAnalDataInferenceGeomEntity.compareYyyy)
|
||||
.or(
|
||||
imageryEntity.year.eq(
|
||||
mapSheetAnalDataInferenceGeomEntity.targetYyyy))))
|
||||
.where(
|
||||
labelingAssignmentEntity.workerUid.eq(userId), statusInLabelState(status))
|
||||
.groupBy(labelingAssignmentEntity.assignmentUid)
|
||||
.fetchOne())
|
||||
.orElse(0L);
|
||||
|
||||
return new PageImpl<>(list, pageable, count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LabelingGeometryInfo findLabelingAssignedGeom(String assignmentUid) {
|
||||
return queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
LabelingGeometryInfo.class,
|
||||
labelingAssignmentEntity.assignmentUid,
|
||||
labelingAssignmentEntity.inferenceGeomUid,
|
||||
Expressions.stringTemplate(
|
||||
"ST_AsGeoJSON({0})", mapSheetAnalDataInferenceGeomEntity.geom),
|
||||
makeCogUrl(mapSheetAnalDataInferenceGeomEntity.compareYyyy)
|
||||
.max()
|
||||
.as("beforeCogUrl"),
|
||||
makeCogUrl(mapSheetAnalDataInferenceGeomEntity.targetYyyy).max().as("afterCogUrl"),
|
||||
Expressions.stringTemplate("ST_AsGeoJSON({0})", mapInkx5kEntity.geom)))
|
||||
.from(labelingAssignmentEntity)
|
||||
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||
.on(
|
||||
labelingAssignmentEntity.inferenceGeomUid.eq(
|
||||
mapSheetAnalDataInferenceGeomEntity.geoUid))
|
||||
.innerJoin(mapInkx5kEntity)
|
||||
.on(labelingAssignmentEntity.assignGroupId.eq(mapInkx5kEntity.mapidcdNo))
|
||||
.leftJoin(imageryEntity)
|
||||
.on(
|
||||
imageryEntity
|
||||
.scene5k
|
||||
.eq(labelingAssignmentEntity.assignGroupId)
|
||||
.and(
|
||||
imageryEntity
|
||||
.year
|
||||
.eq(mapSheetAnalDataInferenceGeomEntity.compareYyyy)
|
||||
.or(imageryEntity.year.eq(mapSheetAnalDataInferenceGeomEntity.targetYyyy))))
|
||||
.where(labelingAssignmentEntity.assignmentUid.eq(UUID.fromString(assignmentUid)))
|
||||
.groupBy(
|
||||
labelingAssignmentEntity.assignmentUid,
|
||||
labelingAssignmentEntity.inferenceGeomUid,
|
||||
labelingAssignmentEntity.workerUid,
|
||||
labelingAssignmentEntity.workState,
|
||||
labelingAssignmentEntity.assignGroupId,
|
||||
mapInkx5kEntity.mapidNm,
|
||||
mapSheetAnalDataInferenceGeomEntity.pnu,
|
||||
mapSheetAnalDataInferenceGeomEntity.geom,
|
||||
mapInkx5kEntity.geom)
|
||||
.fetchOne();
|
||||
}
|
||||
|
||||
private StringExpression makeCogUrl(NumberPath<Integer> year) {
|
||||
return new CaseBuilder()
|
||||
.when(imageryEntity.year.eq(year))
|
||||
|
||||
Reference in New Issue
Block a user