spotless + 학습데이터 geojson 생성 커밋
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package com.kamco.cd.kamcoback.postgres.core;
|
||||
|
||||
import com.kamco.cd.kamcoback.postgres.repository.scheduler.TrainingDataReviewJobRepository;
|
||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalCntInfo;
|
||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalMapSheetList;
|
||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.CompleteLabelData;
|
||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.InspectorPendingDto;
|
||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.Tasks;
|
||||
import java.util.List;
|
||||
@@ -41,4 +44,21 @@ public class TrainingDataReviewJobCoreService {
|
||||
public void updateGeomUidTestState(List<Long> geomUids) {
|
||||
trainingDataReviewJobRepository.updateGeomUidTestState(geomUids);
|
||||
}
|
||||
|
||||
public List<CompleteLabelData> findCompletedYesterdayLabelingList(
|
||||
Long analUid, String mapSheetNum) {
|
||||
return trainingDataReviewJobRepository.findCompletedYesterdayLabelingList(analUid, mapSheetNum);
|
||||
}
|
||||
|
||||
public List<AnalMapSheetList> findCompletedAnalMapSheetList(Long analUid) {
|
||||
return trainingDataReviewJobRepository.findCompletedAnalMapSheetList(analUid);
|
||||
}
|
||||
|
||||
public List<AnalCntInfo> findAnalCntInfoList() {
|
||||
return trainingDataReviewJobRepository.findAnalCntInfoList();
|
||||
}
|
||||
|
||||
public void updateLearnDataGeomFileCreateYn(List<Long> geoUids) {
|
||||
trainingDataReviewJobRepository.updateLearnDataGeomFileCreateYn(geoUids);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,4 +40,7 @@ public class MapSheetLearnDataGeomEntity extends CommonDateEntity {
|
||||
|
||||
@Column(name = "geom")
|
||||
private Geometry geom;
|
||||
|
||||
@Column(name = "file_create_yn")
|
||||
private Boolean fileCreateYn;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.scheduler;
|
||||
|
||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalCntInfo;
|
||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalMapSheetList;
|
||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.CompleteLabelData;
|
||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.InspectorPendingDto;
|
||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.Tasks;
|
||||
import java.util.List;
|
||||
@@ -18,4 +21,12 @@ public interface TrainingDataReviewJobRepositoryCustom {
|
||||
Tasks findAssignmentTask(String assignmentUid);
|
||||
|
||||
void updateGeomUidTestState(List<Long> geomUids);
|
||||
|
||||
List<CompleteLabelData> findCompletedYesterdayLabelingList(Long analUid, String mapSheetNum);
|
||||
|
||||
List<AnalMapSheetList> findCompletedAnalMapSheetList(Long analUid);
|
||||
|
||||
List<AnalCntInfo> findAnalCntInfoList();
|
||||
|
||||
void updateLearnDataGeomFileCreateYn(List<Long> geoUids);
|
||||
}
|
||||
|
||||
@@ -3,17 +3,29 @@ package com.kamco.cd.kamcoback.postgres.repository.scheduler;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QLabelingAssignmentEntity.labelingAssignmentEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QLabelingInspectorEntity.labelingInspectorEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnDataGeomEntity.mapSheetLearnDataGeomEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapSheetLearnEntity;
|
||||
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InspectState;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelMngState;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelState;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalCntInfo;
|
||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalMapSheetList;
|
||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.CompleteLabelData;
|
||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.CompleteLabelData.Properties;
|
||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.InspectorPendingDto;
|
||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.Tasks;
|
||||
import com.querydsl.core.types.Projections;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
import com.querydsl.core.types.dsl.CaseBuilder;
|
||||
import com.querydsl.core.types.dsl.Expressions;
|
||||
import com.querydsl.core.types.dsl.NumberExpression;
|
||||
import com.querydsl.core.types.dsl.StringExpression;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import jakarta.transaction.Transactional;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.List;
|
||||
@@ -145,4 +157,132 @@ public class TrainingDataReviewJobRepositoryImpl extends QuerydslRepositorySuppo
|
||||
.where(mapSheetAnalDataInferenceGeomEntity.geoUid.in(geomUids))
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CompleteLabelData> findCompletedYesterdayLabelingList(
|
||||
Long analUid, String mapSheetNum) {
|
||||
ZoneId zoneId = ZoneId.of("Asia/Seoul");
|
||||
|
||||
// 오늘 날짜 (시간 없음)
|
||||
LocalDate today = LocalDate.now(zoneId);
|
||||
ZonedDateTime end = today.atStartOfDay(zoneId); // 오늘 00:00
|
||||
|
||||
return queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
CompleteLabelData.class,
|
||||
mapSheetLearnDataGeomEntity.geoUid,
|
||||
Expressions.stringTemplate("{0}", "Feature").as("type"),
|
||||
Expressions.stringTemplate("ST_AsGeoJSON({0})", mapSheetLearnDataGeomEntity.geom),
|
||||
Projections.constructor(
|
||||
Properties.class,
|
||||
new CaseBuilder()
|
||||
.when(mapSheetLearnDataGeomEntity.classAfterCd.in("building", "container"))
|
||||
.then("M1")
|
||||
.when(mapSheetLearnDataGeomEntity.classAfterCd.eq("waste"))
|
||||
.then("M2")
|
||||
.otherwise("M3"),
|
||||
mapSheetLearnDataGeomEntity.classBeforeCd,
|
||||
mapSheetLearnDataGeomEntity.classAfterCd)))
|
||||
.from(labelingAssignmentEntity)
|
||||
.leftJoin(mapSheetLearnDataGeomEntity)
|
||||
.on(labelingAssignmentEntity.inferenceGeomUid.eq(mapSheetLearnDataGeomEntity.geoUid))
|
||||
.where(
|
||||
labelingAssignmentEntity.analUid.eq(analUid),
|
||||
labelingAssignmentEntity.assignGroupId.eq(mapSheetNum),
|
||||
labelingAssignmentEntity.inspectState.eq(InspectState.COMPLETE.getId()),
|
||||
labelingAssignmentEntity.inspectStatDttm.lt(end))
|
||||
.fetch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AnalMapSheetList> findCompletedAnalMapSheetList(Long analUid) {
|
||||
ZoneId zoneId = ZoneId.of("Asia/Seoul");
|
||||
LocalDate today = LocalDate.now(zoneId);
|
||||
ZonedDateTime end = today.atStartOfDay(zoneId); // 오늘 00:00
|
||||
|
||||
return queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
AnalMapSheetList.class,
|
||||
mapSheetAnalInferenceEntity.compareYyyy,
|
||||
mapSheetAnalInferenceEntity.targetYyyy,
|
||||
labelingAssignmentEntity.assignGroupId))
|
||||
.from(labelingAssignmentEntity)
|
||||
.innerJoin(mapSheetAnalInferenceEntity)
|
||||
.on(labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id))
|
||||
.where(
|
||||
labelingAssignmentEntity.analUid.eq(analUid),
|
||||
labelingAssignmentEntity.inspectState.eq(InspectState.COMPLETE.getId()),
|
||||
labelingAssignmentEntity.inspectStatDttm.lt(end))
|
||||
.groupBy(
|
||||
mapSheetAnalInferenceEntity.compareYyyy,
|
||||
mapSheetAnalInferenceEntity.targetYyyy,
|
||||
labelingAssignmentEntity.assignGroupId)
|
||||
.fetch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AnalCntInfo> findAnalCntInfoList() {
|
||||
// 검수 제외(EXCEPT)를 뺀 나머지 cnt
|
||||
NumberExpression<Long> allCnt =
|
||||
new CaseBuilder()
|
||||
.when(
|
||||
labelingAssignmentEntity
|
||||
.inspectState
|
||||
.eq(InspectState.UNCONFIRM.getId())
|
||||
.or(labelingAssignmentEntity.inspectState.eq(InspectState.COMPLETE.getId()))
|
||||
.or(labelingAssignmentEntity.inspectState.isNull()))
|
||||
.then(1L)
|
||||
.otherwise(0L)
|
||||
.sum();
|
||||
|
||||
// file_cnt
|
||||
NumberExpression<Long> fileCnt =
|
||||
new CaseBuilder()
|
||||
.when(mapSheetLearnDataGeomEntity.fileCreateYn.isTrue())
|
||||
.then(1L)
|
||||
.otherwise(0L)
|
||||
.sum();
|
||||
|
||||
NumberExpression<Long> completeCnt =
|
||||
new CaseBuilder()
|
||||
.when(labelingAssignmentEntity.inspectState.eq(InspectState.COMPLETE.getId()))
|
||||
.then(1L)
|
||||
.otherwise(0L)
|
||||
.sum();
|
||||
|
||||
return queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
AnalCntInfo.class,
|
||||
labelingAssignmentEntity.analUid,
|
||||
mapSheetLearnEntity.uid,
|
||||
allCnt,
|
||||
completeCnt,
|
||||
fileCnt))
|
||||
.from(labelingAssignmentEntity)
|
||||
.innerJoin(mapSheetAnalInferenceEntity)
|
||||
.on(
|
||||
labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id),
|
||||
mapSheetAnalInferenceEntity.analState.eq(LabelMngState.ING.getId()))
|
||||
.leftJoin(mapSheetLearnEntity)
|
||||
.on(mapSheetAnalInferenceEntity.learnId.eq(mapSheetLearnEntity.id))
|
||||
.leftJoin(mapSheetLearnDataGeomEntity)
|
||||
.on(labelingAssignmentEntity.inferenceGeomUid.eq(mapSheetLearnDataGeomEntity.geoUid))
|
||||
.groupBy(labelingAssignmentEntity.analUid, mapSheetLearnEntity.uid)
|
||||
.having(completeCnt.gt(0L))
|
||||
.fetch();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateLearnDataGeomFileCreateYn(List<Long> geoUids) {
|
||||
queryFactory
|
||||
.update(mapSheetLearnDataGeomEntity)
|
||||
.set(mapSheetLearnDataGeomEntity.fileCreateYn, true)
|
||||
.set(mapSheetLearnDataGeomEntity.modifiedDate, ZonedDateTime.now())
|
||||
.where(mapSheetLearnDataGeomEntity.geoUid.in(geoUids))
|
||||
.execute();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user