Merge branch 'feat/dev_251201' of https://10.100.0.10:3210/dabeeo/kamco-dabeeo-backoffice into feat/dev_251201

This commit is contained in:
2026-01-05 14:46:48 +09:00
13 changed files with 410 additions and 27 deletions

View File

@@ -6,15 +6,15 @@ import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.AllocateInfoDto;
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.LabelingStatDto;
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.TargetUser;
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.UserList;
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerListResponse;
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerStatistics;
import com.kamco.cd.kamcoback.postgres.core.LabelAllocateCoreService;
import java.time.LocalDate;
import java.util.List;
import java.util.Objects;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -23,6 +23,9 @@ import org.springframework.transaction.annotation.Transactional;
@Transactional
public class LabelAllocateService {
private static final int STAGNATION_THRESHOLD = 10; // 정체 판단 기준 (3일 평균 처리량)
private static final int BATCH_SIZE = 100; // 배정 배치 크기
private final LabelAllocateCoreService labelAllocateCoreService;
public LabelAllocateService(LabelAllocateCoreService labelAllocateCoreService) {
@@ -113,10 +116,12 @@ public class LabelAllocateService {
* @param workerType 작업자 유형 (LABELER/INSPECTOR)
* @param search 검색어 (이름 또는 사번)
* @param sortType 정렬 조건
* @param page 페이지 번호 (0부터 시작)
* @param size 페이지 크기
* @return 작업자 목록 및 통계
*/
public WorkerListResponse getWorkerStatistics(
Long analUid, String workerType, String search, String sortType) {
Long analUid, String workerType, String search, String sortType, Integer page, Integer size) {
// 프로젝트 정보 조회 (analUid가 있을 때만)
var projectInfo = labelAllocateCoreService.findProjectInfo(analUid);
@@ -124,7 +129,44 @@ public class LabelAllocateService {
// 작업 진행 현황 조회
var progressInfo = labelAllocateCoreService.findWorkProgressInfo(analUid);
return WorkerListResponse.builder().projectInfo(projectInfo).progressInfo(progressInfo).build();
// 작업자 통계 조회
List<WorkerStatistics> workers =
labelAllocateCoreService.findWorkerStatistics(analUid, workerType, search, sortType);
// 각 작업자별 3일치 처리량 조회
LocalDate today = LocalDate.now();
for (WorkerStatistics worker : workers) {
Long day1Count =
labelAllocateCoreService.findDailyProcessedCount(
worker.getWorkerId(), workerType, today.minusDays(1), analUid);
Long day2Count =
labelAllocateCoreService.findDailyProcessedCount(
worker.getWorkerId(), workerType, today.minusDays(2), analUid);
Long day3Count =
labelAllocateCoreService.findDailyProcessedCount(
worker.getWorkerId(), workerType, today.minusDays(3), analUid);
long average = (day1Count + day2Count + day3Count) / 3;
}
// 페이징 처리
long totalElements = workers.size();
int totalPages = (int) Math.ceil((double) totalElements / size);
int fromIndex = page * size;
int toIndex = Math.min(fromIndex + size, workers.size());
List<WorkerStatistics> pagedWorkers =
(fromIndex < workers.size()) ? workers.subList(fromIndex, toIndex) : List.of();
return WorkerListResponse.builder()
.projectInfo(projectInfo)
.progressInfo(progressInfo)
.workers(pagedWorkers)
.currentPage(page)
.pageSize(size)
.totalElements(totalElements)
.totalPages(totalPages)
.build();
}
public InferenceDetail findInferenceDetail(String uuid) {
@@ -160,20 +202,7 @@ public class LabelAllocateService {
return new ApiResponseDto.ResponseObj(ApiResponseCode.OK, "이관을 완료하였습니다.");
}
public LabelerDetail findUserDetail(String userId, String uuid, String type) {
if (type.equals("LABELER")) {
return labelAllocateCoreService.findLabelerDetail(userId, uuid);
} else {
return labelAllocateCoreService.findInspectorDetail(userId, uuid);
}
}
public Page<LabelingStatDto> findDaliyList(
LabelAllocateDto.searchReq searchReq, String uuid, String userId, String type) {
if (type.equals("LABELER")) {
return labelAllocateCoreService.findLabelerDailyStat(searchReq, uuid, userId);
} else {
return labelAllocateCoreService.findInspectorDailyStat(searchReq, uuid, userId);
}
public LabelerDetail findLabelerDetail(String userId, String uuid) {
return labelAllocateCoreService.findLabelerDetail(userId, uuid);
}
}

View File

@@ -4,6 +4,7 @@ import com.kamco.cd.kamcoback.label.dto.LabelWorkDto;
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.ChangeDetectYear;
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMng;
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMngDetail;
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.WorkerState;
import com.kamco.cd.kamcoback.postgres.core.LabelWorkCoreService;
import java.util.List;
import java.util.UUID;
@@ -49,4 +50,9 @@ public class LabelWorkService {
public List<ChangeDetectYear> getChangeDetectYear() {
return labelWorkCoreService.getChangeDetectYear();
}
public Page<WorkerState> findlabelWorkStateList(LabelWorkDto.WorkerStateSearchReq searchReq) {
return labelWorkCoreService.findlabelWorkStateList(searchReq);
}
}