Merge branch 'feat/dev_251201' of https://10.100.0.10:3210/dabeeo/kamco-dabeeo-backoffice into feat/dev_251201
# Conflicts: # src/main/java/com/kamco/cd/kamcoback/label/LabelAllocateApiController.java # src/main/java/com/kamco/cd/kamcoback/label/service/LabelAllocateService.java # src/main/java/com/kamco/cd/kamcoback/postgres/core/LabelAllocateCoreService.java # src/main/java/com/kamco/cd/kamcoback/postgres/repository/label/LabelAllocateRepositoryImpl.java
This commit is contained in:
@@ -5,7 +5,6 @@ import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
|||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InferenceDetail;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InferenceDetail;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelerDetail;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelerDetail;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelingStatDto;
|
|
||||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerListResponse;
|
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerListResponse;
|
||||||
import com.kamco.cd.kamcoback.label.service.LabelAllocateService;
|
import com.kamco.cd.kamcoback.label.service.LabelAllocateService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
@@ -19,7 +18,6 @@ import jakarta.validation.Valid;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
@@ -65,8 +63,8 @@ public class LabelAllocateApiController {
|
|||||||
})
|
})
|
||||||
@GetMapping("/admin/workers")
|
@GetMapping("/admin/workers")
|
||||||
public ApiResponseDto<WorkerListResponse> getWorkerStatistics(
|
public ApiResponseDto<WorkerListResponse> getWorkerStatistics(
|
||||||
@Parameter(description = "분석 ID (선택)", example = "3") @RequestParam(required = false)
|
// @Parameter(description = "분석 ID (선택)", example = "3") @RequestParam(required = false)
|
||||||
Long analUid,
|
// Long analUid,
|
||||||
@Parameter(
|
@Parameter(
|
||||||
description = "작업자 유형 (선택) - 미입력 시 LABELER로 조회",
|
description = "작업자 유형 (선택) - 미입력 시 LABELER로 조회",
|
||||||
example = "LABELER",
|
example = "LABELER",
|
||||||
@@ -87,6 +85,8 @@ public class LabelAllocateApiController {
|
|||||||
allowableValues = {
|
allowableValues = {
|
||||||
"REMAINING_DESC",
|
"REMAINING_DESC",
|
||||||
"REMAINING_ASC",
|
"REMAINING_ASC",
|
||||||
|
"COMPLETED_DESC",
|
||||||
|
"COMPLETED_ASC",
|
||||||
"NAME_ASC",
|
"NAME_ASC",
|
||||||
"NAME_DESC"
|
"NAME_DESC"
|
||||||
},
|
},
|
||||||
@@ -105,7 +105,7 @@ public class LabelAllocateApiController {
|
|||||||
|
|
||||||
return ApiResponseDto.ok(
|
return ApiResponseDto.ok(
|
||||||
labelAllocateService.getWorkerStatistics(
|
labelAllocateService.getWorkerStatistics(
|
||||||
analUid, workerType, search, sort, page, size));
|
null, workerType, search, sort, page, size));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "라벨링작업 관리 > 작업 배정", description = "라벨링작업 관리 > 작업 배정")
|
@Operation(summary = "라벨링작업 관리 > 작업 배정", description = "라벨링작업 관리 > 작업 배정")
|
||||||
|
|||||||
@@ -10,6 +10,27 @@ import lombok.Setter;
|
|||||||
|
|
||||||
public class WorkerStatsDto {
|
public class WorkerStatsDto {
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Schema(description = "프로젝트 기본 정보 (상단 표시용)")
|
||||||
|
public static class ProjectInfo {
|
||||||
|
|
||||||
|
@Schema(description = "변화탐지년도 (예: 2026-2025)")
|
||||||
|
private String detectionYear;
|
||||||
|
|
||||||
|
@Schema(description = "회차 (예: 8)")
|
||||||
|
private String round;
|
||||||
|
|
||||||
|
@Schema(description = "국유인 반영일 (예: 2026-03-31)")
|
||||||
|
private String reflectionDate;
|
||||||
|
|
||||||
|
@Schema(description = "작업 시작일 (예: 2026-04-06)")
|
||||||
|
private String startDate;
|
||||||
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@Builder
|
@Builder
|
||||||
@@ -44,6 +65,25 @@ public class WorkerStatsDto {
|
|||||||
|
|
||||||
@Schema(description = "작업 정체 여부 (3일간 실적이 저조하면 true)")
|
@Schema(description = "작업 정체 여부 (3일간 실적이 저조하면 true)")
|
||||||
private Boolean isStagnated;
|
private Boolean isStagnated;
|
||||||
|
|
||||||
|
// 레거시 필드 (기존 호환성 유지)
|
||||||
|
@Deprecated
|
||||||
|
private Long doneCnt; // completed로 대체
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
private Long skipCnt; // skipped로 대체
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
private Long remainingCnt; // remaining으로 대체
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
private Long day3AgoDoneCnt; // history.day3Ago로 대체
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
private Long day2AgoDoneCnt; // history.day2Ago로 대체
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
private Long day1AgoDoneCnt; // history.day1Ago로 대체
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -67,6 +107,7 @@ public class WorkerStatsDto {
|
|||||||
private Long average;
|
private Long average;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@Builder
|
@Builder
|
||||||
@@ -75,29 +116,74 @@ public class WorkerStatsDto {
|
|||||||
@Schema(description = "작업 진행 현황 정보")
|
@Schema(description = "작업 진행 현황 정보")
|
||||||
public static class WorkProgressInfo {
|
public static class WorkProgressInfo {
|
||||||
|
|
||||||
|
// === 라벨링 관련 ===
|
||||||
@Schema(description = "라벨링 진행률 (완료건+스킵건)/배정건")
|
@Schema(description = "라벨링 진행률 (완료건+스킵건)/배정건")
|
||||||
private Double labelingProgressRate;
|
private Double labelingProgressRate;
|
||||||
|
|
||||||
@Schema(description = "작업 상태 (진행중/종료)")
|
@Schema(description = "라벨링 작업 상태 (진행중/완료)")
|
||||||
private String workStatus;
|
private String labelingStatus;
|
||||||
|
|
||||||
@Schema(description = "진행률 수치 (완료+스킵)")
|
@Schema(description = "라벨링 전체 배정 건수")
|
||||||
private Long completedCount;
|
private Long labelingTotalCount;
|
||||||
|
|
||||||
@Schema(description = "전체 배정 건수")
|
@Schema(description = "라벨링 완료 건수 (LABEL_FIN + TEST_ING + DONE)")
|
||||||
private Long totalAssignedCount;
|
private Long labelingCompletedCount;
|
||||||
|
|
||||||
|
@Schema(description = "라벨링 스킵 건수 (SKIP)")
|
||||||
|
private Long labelingSkipCount;
|
||||||
|
|
||||||
|
@Schema(description = "라벨링 남은 작업 건수")
|
||||||
|
private Long labelingRemainingCount;
|
||||||
|
|
||||||
@Schema(description = "투입된 라벨러 수")
|
@Schema(description = "투입된 라벨러 수")
|
||||||
private Long labelerCount;
|
private Long labelerCount;
|
||||||
|
|
||||||
@Schema(description = "남은 라벨링 작업 데이터 수")
|
// === 검수(Inspection) 관련 (신규 추가) ===
|
||||||
private Long remainingLabelCount;
|
@Schema(description = "검수 진행률 (완료건/대상건)")
|
||||||
|
private Double inspectionProgressRate;
|
||||||
|
|
||||||
|
@Schema(description = "검수 작업 상태 (진행중/완료)")
|
||||||
|
private String inspectionStatus;
|
||||||
|
|
||||||
|
@Schema(description = "검수 전체 대상 건수")
|
||||||
|
private Long inspectionTotalCount;
|
||||||
|
|
||||||
|
@Schema(description = "검수 완료 건수 (DONE)")
|
||||||
|
private Long inspectionCompletedCount;
|
||||||
|
|
||||||
|
@Schema(description = "검수 제외 건수 (라벨링 스킵과 동일)")
|
||||||
|
private Long inspectionSkipCount;
|
||||||
|
|
||||||
|
@Schema(description = "검수 남은 작업 건수")
|
||||||
|
private Long inspectionRemainingCount;
|
||||||
|
|
||||||
@Schema(description = "투입된 검수자 수")
|
@Schema(description = "투입된 검수자 수")
|
||||||
private Long inspectorCount;
|
private Long inspectorCount;
|
||||||
|
|
||||||
@Schema(description = "남은 검수 작업 데이터 수")
|
// === 레거시 호환 필드 (Deprecated) ===
|
||||||
|
@Deprecated
|
||||||
|
@Schema(description = "[Deprecated] labelingProgressRate 사용 권장")
|
||||||
|
private Double progressRate;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@Schema(description = "[Deprecated] labelingTotalCount 사용 권장")
|
||||||
|
private Long totalAssignedCount;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@Schema(description = "[Deprecated] labelingCompletedCount 사용 권장")
|
||||||
|
private Long completedCount;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@Schema(description = "[Deprecated] labelingRemainingCount 사용 권장")
|
||||||
|
private Long remainingLabelCount;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@Schema(description = "[Deprecated] inspectionRemainingCount 사용 권장")
|
||||||
private Long remainingInspectCount;
|
private Long remainingInspectCount;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@Schema(description = "[Deprecated] labelingStatus/inspectionStatus 사용 권장")
|
||||||
|
private String workStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -108,6 +194,9 @@ public class WorkerStatsDto {
|
|||||||
@Schema(description = "작업자 목록 응답 (작업 정보 포함)")
|
@Schema(description = "작업자 목록 응답 (작업 정보 포함)")
|
||||||
public static class WorkerListResponse {
|
public static class WorkerListResponse {
|
||||||
|
|
||||||
|
@Schema(description = "프로젝트 기본 정보 (상단 표시용)")
|
||||||
|
private ProjectInfo projectInfo;
|
||||||
|
|
||||||
@Schema(description = "작업 진행 현황 정보")
|
@Schema(description = "작업 진행 현황 정보")
|
||||||
private WorkProgressInfo progressInfo;
|
private WorkProgressInfo progressInfo;
|
||||||
|
|
||||||
|
|||||||
@@ -131,6 +131,9 @@ public class LabelAllocateService {
|
|||||||
Integer page,
|
Integer page,
|
||||||
Integer size) {
|
Integer size) {
|
||||||
|
|
||||||
|
// 프로젝트 정보 조회 (analUid가 있을 때만)
|
||||||
|
var projectInfo = labelAllocateCoreService.findProjectInfo(analUid);
|
||||||
|
|
||||||
// 작업 진행 현황 조회
|
// 작업 진행 현황 조회
|
||||||
var progressInfo = labelAllocateCoreService.findWorkProgressInfo(analUid);
|
var progressInfo = labelAllocateCoreService.findWorkProgressInfo(analUid);
|
||||||
|
|
||||||
@@ -180,6 +183,7 @@ public class LabelAllocateService {
|
|||||||
(fromIndex < workers.size()) ? workers.subList(fromIndex, toIndex) : List.of();
|
(fromIndex < workers.size()) ? workers.subList(fromIndex, toIndex) : List.of();
|
||||||
|
|
||||||
return WorkerListResponse.builder()
|
return WorkerListResponse.builder()
|
||||||
|
.projectInfo(projectInfo)
|
||||||
.progressInfo(progressInfo)
|
.progressInfo(progressInfo)
|
||||||
.workers(pagedWorkers)
|
.workers(pagedWorkers)
|
||||||
.currentPage(page)
|
.currentPage(page)
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelerDetail;
|
|||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelingStatDto;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelingStatDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.UserList;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.UserList;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.searchReq;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.searchReq;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.ProjectInfo;
|
||||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkProgressInfo;
|
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkProgressInfo;
|
||||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerStatistics;
|
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerStatistics;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
||||||
@@ -51,6 +52,10 @@ public class LabelAllocateCoreService {
|
|||||||
return labelAllocateRepository.availUserList(role);
|
return labelAllocateRepository.availUserList(role);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ProjectInfo findProjectInfo(Long analUid) {
|
||||||
|
return labelAllocateRepository.findProjectInfo(analUid);
|
||||||
|
}
|
||||||
|
|
||||||
public List<WorkerStatistics> findWorkerStatistics(
|
public List<WorkerStatistics> findWorkerStatistics(
|
||||||
Long analUid,
|
Long analUid,
|
||||||
String workerType,
|
String workerType,
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InferenceDetail;
|
|||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelerDetail;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelerDetail;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelingStatDto;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelingStatDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.UserList;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.UserList;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.ProjectInfo;
|
||||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkProgressInfo;
|
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkProgressInfo;
|
||||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerStatistics;
|
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerStatistics;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
||||||
@@ -29,6 +30,9 @@ public interface LabelAllocateRepositoryCustom {
|
|||||||
|
|
||||||
List<UserList> availUserList(String role);
|
List<UserList> availUserList(String role);
|
||||||
|
|
||||||
|
// 프로젝트 정보 조회
|
||||||
|
ProjectInfo findProjectInfo(Long analUid);
|
||||||
|
|
||||||
// 작업자 통계 조회
|
// 작업자 통계 조회
|
||||||
List<WorkerStatistics> findWorkerStatistics(
|
List<WorkerStatistics> findWorkerStatistics(
|
||||||
Long analUid, String workerType, String search, String sortType);
|
Long analUid, String workerType, String search, String sortType);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelState;
|
|||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelerDetail;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelerDetail;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelingStatDto;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelingStatDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.UserList;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.UserList;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.searchReq;
|
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.ProjectInfo;
|
||||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkProgressInfo;
|
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkProgressInfo;
|
||||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerStatistics;
|
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerStatistics;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
||||||
@@ -37,9 +37,12 @@ import java.time.LocalDate;
|
|||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
@@ -54,8 +57,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
|
|
||||||
private final JPAQueryFactory queryFactory;
|
private final JPAQueryFactory queryFactory;
|
||||||
|
|
||||||
@PersistenceContext
|
@PersistenceContext private EntityManager em;
|
||||||
private EntityManager em;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AllocateInfoDto> fetchNextIds(
|
public List<AllocateInfoDto> fetchNextIds(
|
||||||
@@ -275,6 +277,12 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
case "REMAINING_ASC":
|
case "REMAINING_ASC":
|
||||||
baseQuery.orderBy(remainingSum.asc());
|
baseQuery.orderBy(remainingSum.asc());
|
||||||
break;
|
break;
|
||||||
|
case "COMPLETED_DESC":
|
||||||
|
baseQuery.orderBy(completedSum.desc());
|
||||||
|
break;
|
||||||
|
case "COMPLETED_ASC":
|
||||||
|
baseQuery.orderBy(completedSum.asc());
|
||||||
|
break;
|
||||||
case "NAME_ASC":
|
case "NAME_ASC":
|
||||||
baseQuery.orderBy(memberEntity.name.asc());
|
baseQuery.orderBy(memberEntity.name.asc());
|
||||||
break;
|
break;
|
||||||
@@ -320,17 +328,28 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
.where(analUidCondition)
|
.where(analUidCondition)
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
// 완료 + 스킵 건수
|
// === 라벨링 통계 ===
|
||||||
Long completedCount =
|
// 라벨링 완료: LABEL_FIN, TEST_ING, DONE (검수 포함)
|
||||||
|
Long labelingCompleted =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(labelingAssignmentEntity.count())
|
.select(labelingAssignmentEntity.count())
|
||||||
.from(labelingAssignmentEntity)
|
.from(labelingAssignmentEntity)
|
||||||
.where(
|
.where(
|
||||||
analUidCondition,
|
analUidCondition,
|
||||||
labelingAssignmentEntity.workState.in("DONE", "SKIP"))
|
labelingAssignmentEntity.workState.in("LABEL_FIN", "TEST_ING", "DONE"))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
// 투입된 라벨러 수 (고유한 worker_uid 수)
|
// 스킵 건수
|
||||||
|
Long skipCount =
|
||||||
|
queryFactory
|
||||||
|
.select(labelingAssignmentEntity.count())
|
||||||
|
.from(labelingAssignmentEntity)
|
||||||
|
.where(
|
||||||
|
analUidCondition,
|
||||||
|
labelingAssignmentEntity.workState.eq("SKIP"))
|
||||||
|
.fetchOne();
|
||||||
|
|
||||||
|
// 투입된 라벨러 수
|
||||||
Long labelerCount =
|
Long labelerCount =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(labelingAssignmentEntity.workerUid.countDistinct())
|
.select(labelingAssignmentEntity.workerUid.countDistinct())
|
||||||
@@ -340,18 +359,18 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
labelingAssignmentEntity.workerUid.isNotNull())
|
labelingAssignmentEntity.workerUid.isNotNull())
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
// 남은 라벨링 작업 데이터 수
|
// === 검수 통계 ===
|
||||||
Long remainingLabelCount =
|
// 검수 완료: DONE만
|
||||||
|
Long inspectionCompleted =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(labelingAssignmentEntity.count())
|
.select(labelingAssignmentEntity.count())
|
||||||
.from(labelingAssignmentEntity)
|
.from(labelingAssignmentEntity)
|
||||||
.where(
|
.where(
|
||||||
analUidCondition,
|
analUidCondition,
|
||||||
labelingAssignmentEntity.workerUid.isNotNull(),
|
labelingAssignmentEntity.workState.eq("DONE"))
|
||||||
labelingAssignmentEntity.workState.notIn("DONE", "SKIP"))
|
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
// 투입된 검수자 수 (고유한 inspector_uid 수)
|
// 투입된 검수자 수
|
||||||
Long inspectorCount =
|
Long inspectorCount =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(labelingAssignmentEntity.inspectorUid.countDistinct())
|
.select(labelingAssignmentEntity.inspectorUid.countDistinct())
|
||||||
@@ -361,36 +380,47 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
labelingAssignmentEntity.inspectorUid.isNotNull())
|
labelingAssignmentEntity.inspectorUid.isNotNull())
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
// 남은 검수 작업 데이터 수
|
// 남은 작업 건수 계산
|
||||||
Long remainingInspectCount =
|
long total = totalAssigned != null ? totalAssigned : 0L;
|
||||||
queryFactory
|
long labelCompleted = labelingCompleted != null ? labelingCompleted : 0L;
|
||||||
.select(labelingAssignmentEntity.count())
|
long inspectCompleted = inspectionCompleted != null ? inspectionCompleted : 0L;
|
||||||
.from(labelingAssignmentEntity)
|
long skipped = skipCount != null ? skipCount : 0L;
|
||||||
.where(
|
|
||||||
analUidCondition,
|
long labelingRemaining = total - labelCompleted - skipped;
|
||||||
labelingAssignmentEntity.inspectorUid.isNotNull(),
|
long inspectionRemaining = total - inspectCompleted - skipped;
|
||||||
labelingAssignmentEntity.workState.notIn("DONE"))
|
|
||||||
.fetchOne();
|
|
||||||
|
|
||||||
// 진행률 계산
|
// 진행률 계산
|
||||||
double progressRate = 0.0;
|
double labelingRate = total > 0 ? (double) labelCompleted / total * 100 : 0.0;
|
||||||
if (totalAssigned != null && totalAssigned > 0) {
|
double inspectionRate = total > 0 ? (double) inspectCompleted / total * 100 : 0.0;
|
||||||
progressRate =
|
|
||||||
(completedCount != null ? completedCount.doubleValue() : 0.0) / totalAssigned * 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 작업 상태 판단 (간단하게 진행률 100%면 종료, 아니면 진행중)
|
// 상태 판단
|
||||||
String workStatus = (progressRate >= 100.0) ? "종료" : "진행중";
|
String labelingStatus = labelingRemaining > 0 ? "진행중" : "완료";
|
||||||
|
String inspectionStatus = inspectionRemaining > 0 ? "진행중" : "완료";
|
||||||
|
|
||||||
return WorkProgressInfo.builder()
|
return WorkProgressInfo.builder()
|
||||||
.labelingProgressRate(progressRate)
|
// 라벨링
|
||||||
.workStatus(workStatus)
|
.labelingProgressRate(labelingRate)
|
||||||
.completedCount(completedCount != null ? completedCount : 0L)
|
.labelingStatus(labelingStatus)
|
||||||
.totalAssignedCount(totalAssigned != null ? totalAssigned : 0L)
|
.labelingTotalCount(total)
|
||||||
|
.labelingCompletedCount(labelCompleted)
|
||||||
|
.labelingSkipCount(skipped)
|
||||||
|
.labelingRemainingCount(labelingRemaining)
|
||||||
.labelerCount(labelerCount != null ? labelerCount : 0L)
|
.labelerCount(labelerCount != null ? labelerCount : 0L)
|
||||||
.remainingLabelCount(remainingLabelCount != null ? remainingLabelCount : 0L)
|
// 검수
|
||||||
|
.inspectionProgressRate(inspectionRate)
|
||||||
|
.inspectionStatus(inspectionStatus)
|
||||||
|
.inspectionTotalCount(total)
|
||||||
|
.inspectionCompletedCount(inspectCompleted)
|
||||||
|
.inspectionSkipCount(skipped)
|
||||||
|
.inspectionRemainingCount(inspectionRemaining)
|
||||||
.inspectorCount(inspectorCount != null ? inspectorCount : 0L)
|
.inspectorCount(inspectorCount != null ? inspectorCount : 0L)
|
||||||
.remainingInspectCount(remainingInspectCount != null ? remainingInspectCount : 0L)
|
// 레거시 호환 필드 (Deprecated)
|
||||||
|
.progressRate(labelingRate)
|
||||||
|
.totalAssignedCount(total)
|
||||||
|
.completedCount(labelCompleted)
|
||||||
|
.remainingLabelCount(labelingRemaining)
|
||||||
|
.remainingInspectCount(inspectionRemaining)
|
||||||
|
.workStatus(labelingStatus)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -602,6 +632,75 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
em.clear();
|
em.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ProjectInfo findProjectInfo(Long analUid) {
|
||||||
|
if (analUid == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = queryFactory
|
||||||
|
.select(
|
||||||
|
mapSheetAnalEntity.compareYyyy,
|
||||||
|
mapSheetAnalEntity.targetYyyy,
|
||||||
|
mapSheetAnalEntity.analTitle,
|
||||||
|
mapSheetAnalEntity.gukyuinApplyDttm,
|
||||||
|
mapSheetAnalEntity.analStrtDttm
|
||||||
|
)
|
||||||
|
.from(mapSheetAnalEntity)
|
||||||
|
.where(mapSheetAnalEntity.id.eq(analUid))
|
||||||
|
.fetchOne();
|
||||||
|
|
||||||
|
if (result == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer compareYyyy = result.get(mapSheetAnalEntity.compareYyyy);
|
||||||
|
Integer targetYyyy = result.get(mapSheetAnalEntity.targetYyyy);
|
||||||
|
String analTitle = result.get(mapSheetAnalEntity.analTitle);
|
||||||
|
ZonedDateTime gukyuinApplyDttm = result.get(mapSheetAnalEntity.gukyuinApplyDttm);
|
||||||
|
ZonedDateTime analStrtDttm = result.get(mapSheetAnalEntity.analStrtDttm);
|
||||||
|
|
||||||
|
// 변화탐지년도 생성
|
||||||
|
String detectionYear = (compareYyyy != null && targetYyyy != null)
|
||||||
|
? compareYyyy + "-" + targetYyyy
|
||||||
|
: null;
|
||||||
|
|
||||||
|
// 회차 추출 (예: "8회차" → "8")
|
||||||
|
String round = extractRoundFromTitle(analTitle);
|
||||||
|
|
||||||
|
return ProjectInfo.builder()
|
||||||
|
.detectionYear(detectionYear)
|
||||||
|
.round(round)
|
||||||
|
.reflectionDate(formatDate(gukyuinApplyDttm))
|
||||||
|
.startDate(formatDate(analStrtDttm))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 제목에서 회차 숫자 추출
|
||||||
|
* 예: "8회차", "제8회차" → "8"
|
||||||
|
*/
|
||||||
|
private String extractRoundFromTitle(String title) {
|
||||||
|
if (title == null || title.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Pattern pattern = Pattern.compile("(\\d+)회차");
|
||||||
|
Matcher matcher = pattern.matcher(title);
|
||||||
|
|
||||||
|
return matcher.find() ? matcher.group(1) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ZonedDateTime을 "yyyy-MM-dd" 형식으로 변환
|
||||||
|
*/
|
||||||
|
private String formatDate(ZonedDateTime dateTime) {
|
||||||
|
if (dateTime == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return dateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<LabelingStatDto> findLabelerDailyStat(LabelAllocateDto.searchReq searchReq, String uuid, String userId) {
|
public Page<LabelingStatDto> findLabelerDailyStat(LabelAllocateDto.searchReq searchReq, String uuid, String userId) {
|
||||||
// 날짜 포맷
|
// 날짜 포맷
|
||||||
|
|||||||
Reference in New Issue
Block a user