projectinfo uuid조회 추가
This commit is contained in:
@@ -61,6 +61,10 @@ public class LabelAllocateCoreService {
|
||||
return labelAllocateRepository.findLatestProjectInfo();
|
||||
}
|
||||
|
||||
public ProjectInfo findProjectInfoByUuid(String uuid) {
|
||||
return labelAllocateRepository.findProjectInfoByUuid(uuid);
|
||||
}
|
||||
|
||||
public UUID findLastLabelWorkState() {
|
||||
return labelAllocateRepository.findLastLabelWorkState();
|
||||
}
|
||||
@@ -74,6 +78,10 @@ public class LabelAllocateCoreService {
|
||||
return labelAllocateRepository.findWorkProgressInfo(analUid);
|
||||
}
|
||||
|
||||
public WorkProgressInfo findWorkProgressInfoByUuid(String uuid) {
|
||||
return labelAllocateRepository.findWorkProgressInfoByUuid(uuid);
|
||||
}
|
||||
|
||||
public Long findDailyProcessedCount(
|
||||
String workerId, String workerType, LocalDate date, Long analUid) {
|
||||
return labelAllocateRepository.findDailyProcessedCount(workerId, workerType, date, analUid);
|
||||
|
||||
@@ -37,6 +37,9 @@ public interface LabelAllocateRepositoryCustom {
|
||||
// 최신 프로젝트 정보 조회 (analUid 없이)
|
||||
ProjectInfo findLatestProjectInfo();
|
||||
|
||||
// UUID로 프로젝트 정보 조회
|
||||
ProjectInfo findProjectInfoByUuid(String uuid);
|
||||
|
||||
// 최신 작업 상태의 UUID 조회
|
||||
UUID findLastLabelWorkState();
|
||||
|
||||
@@ -47,6 +50,9 @@ public interface LabelAllocateRepositoryCustom {
|
||||
// 작업 진행 현황 조회
|
||||
WorkProgressInfo findWorkProgressInfo(Long analUid);
|
||||
|
||||
// UUID로 작업 진행 현황 조회
|
||||
WorkProgressInfo findWorkProgressInfoByUuid(String uuid);
|
||||
|
||||
// 작업자별 일일 처리량 조회
|
||||
Long findDailyProcessedCount(String workerId, String workerType, LocalDate date, Long analUid);
|
||||
|
||||
|
||||
@@ -496,6 +496,154 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorkProgressInfo findWorkProgressInfoByUuid(String uuid) {
|
||||
if (uuid == null || uuid.isBlank()) {
|
||||
return findWorkProgressInfo(null);
|
||||
}
|
||||
|
||||
UUID targetUuid = UUID.fromString(uuid);
|
||||
|
||||
// UUID로 analUid 조회
|
||||
Long effectiveAnalUid =
|
||||
queryFactory
|
||||
.select(mapSheetAnalInferenceEntity.id)
|
||||
.from(mapSheetAnalInferenceEntity)
|
||||
.where(mapSheetAnalInferenceEntity.uuid.eq(targetUuid))
|
||||
.fetchOne();
|
||||
|
||||
if (effectiveAnalUid == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
BooleanExpression analUidCondition = labelingAssignmentEntity.analUid.eq(effectiveAnalUid);
|
||||
|
||||
// analUid로 분석 정보(compareYyyy, targetYyyy, stage) 조회
|
||||
MapSheetAnalInferenceEntity analEntity =
|
||||
queryFactory
|
||||
.selectFrom(mapSheetAnalInferenceEntity)
|
||||
.where(mapSheetAnalInferenceEntity.id.eq(effectiveAnalUid))
|
||||
.fetchOne();
|
||||
|
||||
// 라벨링 대상 건수: tb_map_sheet_anal_data_inference_geom에서 pnu > 0 AND pass_yn = false(부적합)인 건수
|
||||
Long labelingTargetCount = 0L;
|
||||
if (analEntity != null) {
|
||||
labelingTargetCount =
|
||||
queryFactory
|
||||
.select(mapSheetAnalDataInferenceGeomEntity.geoUid.count())
|
||||
.from(mapSheetAnalDataInferenceGeomEntity)
|
||||
.where(
|
||||
mapSheetAnalDataInferenceGeomEntity.compareYyyy.eq(analEntity.getCompareYyyy()),
|
||||
mapSheetAnalDataInferenceGeomEntity.targetYyyy.eq(analEntity.getTargetYyyy()),
|
||||
mapSheetAnalDataInferenceGeomEntity.stage.eq(analEntity.getStage()),
|
||||
mapSheetAnalDataInferenceGeomEntity.pnu.gt(0L),
|
||||
mapSheetAnalDataInferenceGeomEntity.passYn.isFalse())
|
||||
.fetchOne();
|
||||
}
|
||||
|
||||
// 전체 배정 건수 (tb_labeling_assignment 기준)
|
||||
Long totalAssigned =
|
||||
queryFactory
|
||||
.select(labelingAssignmentEntity.count())
|
||||
.from(labelingAssignmentEntity)
|
||||
.where(analUidCondition)
|
||||
.fetchOne();
|
||||
|
||||
// === 라벨링 통계 ===
|
||||
Long labelingCompleted =
|
||||
queryFactory
|
||||
.select(labelingAssignmentEntity.count())
|
||||
.from(labelingAssignmentEntity)
|
||||
.where(
|
||||
analUidCondition,
|
||||
labelingAssignmentEntity.workState.in("LABEL_FIN", "TEST_ING", "DONE"))
|
||||
.fetchOne();
|
||||
|
||||
Long skipCount =
|
||||
queryFactory
|
||||
.select(labelingAssignmentEntity.count())
|
||||
.from(labelingAssignmentEntity)
|
||||
.where(analUidCondition, labelingAssignmentEntity.workState.eq("SKIP"))
|
||||
.fetchOne();
|
||||
|
||||
Long labelerCount =
|
||||
queryFactory
|
||||
.select(labelingAssignmentEntity.workerUid.countDistinct())
|
||||
.from(labelingAssignmentEntity)
|
||||
.where(analUidCondition, labelingAssignmentEntity.workerUid.isNotNull())
|
||||
.fetchOne();
|
||||
|
||||
// === 검수 통계 ===
|
||||
Long inspectionCompleted =
|
||||
queryFactory
|
||||
.select(labelingAssignmentEntity.count())
|
||||
.from(labelingAssignmentEntity)
|
||||
.where(analUidCondition, labelingAssignmentEntity.workState.eq("DONE"))
|
||||
.fetchOne();
|
||||
|
||||
Long inspectorCount =
|
||||
queryFactory
|
||||
.select(labelingAssignmentEntity.inspectorUid.countDistinct())
|
||||
.from(labelingAssignmentEntity)
|
||||
.where(analUidCondition, labelingAssignmentEntity.inspectorUid.isNotNull())
|
||||
.fetchOne();
|
||||
|
||||
// 계산
|
||||
long labelingTotal = labelingTargetCount != null ? labelingTargetCount : 0L;
|
||||
long labelCompleted = labelingCompleted != null ? labelingCompleted : 0L;
|
||||
long inspectCompleted = inspectionCompleted != null ? inspectionCompleted : 0L;
|
||||
long skipped = skipCount != null ? skipCount : 0L;
|
||||
|
||||
long labelingRemaining = labelingTotal - labelCompleted - skipped;
|
||||
if (labelingRemaining < 0) labelingRemaining = 0;
|
||||
|
||||
long inspectionTotal = labelingTotal;
|
||||
long inspectionRemaining = inspectionTotal - inspectCompleted - skipped;
|
||||
if (inspectionRemaining < 0) inspectionRemaining = 0;
|
||||
|
||||
double labelingRate = labelingTotal > 0 ? (double) labelCompleted / labelingTotal * 100 : 0.0;
|
||||
double inspectionRate =
|
||||
inspectionTotal > 0 ? (double) inspectCompleted / inspectionTotal * 100 : 0.0;
|
||||
|
||||
// 상태 판단
|
||||
String labelingStatus;
|
||||
String inspectionStatus;
|
||||
|
||||
if (analEntity != null && "Y".equals(analEntity.getLabelingClosedYn())) {
|
||||
labelingStatus = "종료";
|
||||
} else {
|
||||
labelingStatus = labelingRemaining > 0 ? "진행중" : "완료";
|
||||
}
|
||||
|
||||
if (analEntity != null && "Y".equals(analEntity.getInspectionClosedYn())) {
|
||||
inspectionStatus = "종료";
|
||||
} else {
|
||||
inspectionStatus = inspectionRemaining > 0 ? "진행중" : "완료";
|
||||
}
|
||||
|
||||
return WorkProgressInfo.builder()
|
||||
.labelingProgressRate(labelingRate)
|
||||
.labelingStatus(labelingStatus)
|
||||
.labelingTotalCount(labelingTotal)
|
||||
.labelingCompletedCount(labelCompleted)
|
||||
.labelingSkipCount(skipped)
|
||||
.labelingRemainingCount(labelingRemaining)
|
||||
.labelerCount(labelerCount != null ? labelerCount : 0L)
|
||||
.inspectionProgressRate(inspectionRate)
|
||||
.inspectionStatus(inspectionStatus)
|
||||
.inspectionTotalCount(inspectionTotal)
|
||||
.inspectionCompletedCount(inspectCompleted)
|
||||
.inspectionSkipCount(skipped)
|
||||
.inspectionRemainingCount(inspectionRemaining)
|
||||
.inspectorCount(inspectorCount != null ? inspectorCount : 0L)
|
||||
.progressRate(labelingRate)
|
||||
.totalAssignedCount(labelingTotal)
|
||||
.completedCount(labelCompleted)
|
||||
.remainingLabelCount(labelingRemaining)
|
||||
.remainingInspectCount(inspectionRemaining)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long findDailyProcessedCount(
|
||||
String workerId, String workerType, LocalDate date, Long analUid) {
|
||||
@@ -832,6 +980,56 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProjectInfo findProjectInfoByUuid(String uuid) {
|
||||
if (uuid == null || uuid.isBlank()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
UUID targetUuid = UUID.fromString(uuid);
|
||||
|
||||
var result =
|
||||
queryFactory
|
||||
.select(
|
||||
mapSheetAnalInferenceEntity.compareYyyy,
|
||||
mapSheetAnalInferenceEntity.targetYyyy,
|
||||
mapSheetAnalInferenceEntity.stage,
|
||||
mapSheetAnalInferenceEntity.gukyuinApplyDttm,
|
||||
mapSheetAnalInferenceEntity.createdDttm,
|
||||
mapSheetAnalInferenceEntity.uuid,
|
||||
mapSheetAnalInferenceEntity.labelingClosedYn,
|
||||
mapSheetAnalInferenceEntity.inspectionClosedYn)
|
||||
.from(mapSheetAnalInferenceEntity)
|
||||
.where(mapSheetAnalInferenceEntity.uuid.eq(targetUuid))
|
||||
.fetchOne();
|
||||
|
||||
if (result == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Integer compareYyyy = result.get(mapSheetAnalInferenceEntity.compareYyyy);
|
||||
Integer targetYyyy = result.get(mapSheetAnalInferenceEntity.targetYyyy);
|
||||
Integer stage = result.get(mapSheetAnalInferenceEntity.stage);
|
||||
ZonedDateTime gukyuinApplyDttm = result.get(mapSheetAnalInferenceEntity.gukyuinApplyDttm);
|
||||
ZonedDateTime createdDttm = result.get(mapSheetAnalInferenceEntity.createdDttm);
|
||||
String labelingClosedYn = result.get(mapSheetAnalInferenceEntity.labelingClosedYn);
|
||||
String inspectionClosedYn = result.get(mapSheetAnalInferenceEntity.inspectionClosedYn);
|
||||
|
||||
String detectionYear =
|
||||
(compareYyyy != null && targetYyyy != null) ? compareYyyy + "-" + targetYyyy : null;
|
||||
String round = stage != null ? String.valueOf(stage) : null;
|
||||
|
||||
return ProjectInfo.builder()
|
||||
.detectionYear(detectionYear)
|
||||
.stage(round)
|
||||
.gukyuinApplyDttm(gukyuinApplyDttm)
|
||||
.startDttm(createdDttm)
|
||||
.uuid(uuid)
|
||||
.labelingClosedYn(labelingClosedYn)
|
||||
.inspectionClosedYn(inspectionClosedYn)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID findLastLabelWorkState() {
|
||||
BooleanBuilder whereBuilder = new BooleanBuilder();
|
||||
|
||||
Reference in New Issue
Block a user