Merge pull request '라벨링 툴 라벨러 목록에 polygon, cog 추가' (#174) from feat/infer_dev_260107 into develop

Reviewed-on: https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice/pulls/174
This commit is contained in:
2026-01-09 16:58:29 +09:00
2 changed files with 97 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
package com.kamco.cd.kamcoback.postgres.repository.trainingdata;
import static com.kamco.cd.kamcoback.postgres.entity.QImageryEntity.imageryEntity;
import static com.kamco.cd.kamcoback.postgres.entity.QLabelingAssignmentEntity.labelingAssignmentEntity;
import static com.kamco.cd.kamcoback.postgres.entity.QMapInkx5kEntity.mapInkx5kEntity;
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
@@ -8,6 +9,10 @@ import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelingListDto;
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.searchReq;
import com.querydsl.core.types.Projections;
import com.querydsl.core.types.dsl.CaseBuilder;
import com.querydsl.core.types.dsl.Expressions;
import com.querydsl.core.types.dsl.NumberPath;
import com.querydsl.core.types.dsl.StringExpression;
import com.querydsl.jpa.impl.JPAQueryFactory;
import java.util.List;
import org.springframework.data.domain.Page;
@@ -40,7 +45,15 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
labelingAssignmentEntity.workState,
labelingAssignmentEntity.assignGroupId,
mapInkx5kEntity.mapidNm,
mapSheetAnalDataInferenceGeomEntity.pnu))
mapSheetAnalDataInferenceGeomEntity.pnu,
Expressions.stringTemplate(
"ST_AsGeoJSON({0})", mapSheetAnalDataInferenceGeomEntity.geom),
makeCogUrl(mapSheetAnalDataInferenceGeomEntity.compareYyyy)
.max()
.as("beforeCogUrl"),
makeCogUrl(mapSheetAnalDataInferenceGeomEntity.targetYyyy)
.max()
.as("afterCogUrl")))
.from(labelingAssignmentEntity)
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
.on(
@@ -48,7 +61,28 @@ 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))
.groupBy(
labelingAssignmentEntity.assignmentUid,
labelingAssignmentEntity.inferenceGeomUid,
labelingAssignmentEntity.workerUid,
labelingAssignmentEntity.workState,
labelingAssignmentEntity.assignGroupId,
mapInkx5kEntity.mapidNm,
mapSheetAnalDataInferenceGeomEntity.pnu,
mapSheetAnalDataInferenceGeomEntity.geom)
.offset(pageable.getOffset())
.limit(pageable.getPageSize())
.orderBy(
@@ -66,9 +100,31 @@ 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))
.groupBy(labelingAssignmentEntity.assignmentUid)
.fetchOne();
return new PageImpl<>(list, pageable, count);
}
private StringExpression makeCogUrl(NumberPath<Integer> year) {
return new CaseBuilder()
.when(imageryEntity.year.eq(year))
.then(
Expressions.stringTemplate(
"{0} || {1}", imageryEntity.cogMiddlePath, imageryEntity.cogFilename))
.otherwise("");
}
}

View File

@@ -1,5 +1,9 @@
package com.kamco.cd.kamcoback.trainingdata.dto;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.UUID;
import lombok.AllArgsConstructor;
@@ -16,7 +20,6 @@ public class TrainingDataLabelDto {
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class LabelingListDto {
private UUID assignmentUid;
@@ -26,6 +29,42 @@ public class TrainingDataLabelDto {
private String mapSheetNum;
private String mapIdNm;
private Long pnu;
@JsonIgnore private String geom_data; // json string
private JsonNode geom;
private String beforeCogUrl;
private String afterCogUrl;
public LabelingListDto(
UUID assignmentUid,
Long inferenceGeomUid,
String workerUid,
String workState,
String mapSheetNum,
String mapIdNm,
Long pnu,
String geom_data,
String beforeCogUrl,
String afterCogUrl) {
this.assignmentUid = assignmentUid;
this.inferenceGeomUid = inferenceGeomUid;
this.workerUid = workerUid;
this.workState = workState;
this.mapSheetNum = mapSheetNum;
this.mapIdNm = mapIdNm;
this.pnu = pnu;
ObjectMapper mapper = new ObjectMapper();
JsonNode geomJson;
try {
geomJson = mapper.readTree(geom_data);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
this.geom = geomJson;
this.beforeCogUrl = beforeCogUrl;
this.afterCogUrl = afterCogUrl;
}
}
@Schema(name = "searchReq", description = "검색 요청")