worklist delete

This commit is contained in:
DanielLee
2026-01-05 13:37:30 +09:00
parent 877de7f17e
commit 462cdc0241
3 changed files with 4 additions and 83 deletions

View File

@@ -92,20 +92,13 @@ public class LabelAllocateApiController {
},
defaultValue = "NAME_ASC"))
@RequestParam(required = false)
String sort,
@Parameter(description = "페이지 번호 (0부터 시작)", example = "0")
@RequestParam(defaultValue = "0")
Integer page,
@Parameter(description = "페이지 크기", example = "20")
@RequestParam(defaultValue = "20")
Integer size) {
String sort) {
// type이 null이면 기본값으로 LABELER 설정
String workerType = (type == null || type.isEmpty()) ? RoleType.LABELER.name() : type;
return ApiResponseDto.ok(
labelAllocateService.getWorkerStatistics(
null, workerType, search, sort, page, size));
labelAllocateService.getWorkerStatistics(null, workerType, search, sort));
}
@Operation(summary = "라벨링작업 관리 > 작업 배정", description = "라벨링작업 관리 > 작업 배정")

View File

@@ -200,19 +200,6 @@ public class WorkerStatsDto {
@Schema(description = "작업 진행 현황 정보")
private WorkProgressInfo progressInfo;
@Schema(description = "작업자 목록")
private List<WorkerStatistics> workers;
@Schema(description = "현재 페이지 번호 (0부터 시작)")
private Integer currentPage;
@Schema(description = "페이지 크기")
private Integer pageSize;
@Schema(description = "전체 데이터 수")
private Long totalElements;
@Schema(description = "전체 페이지 수")
private Integer totalPages;
// workers 필드는 제거되었습니다 (프로젝트 정보와 진행현황만 반환)
}
}

View File

@@ -8,11 +8,8 @@ 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.TargetUser;
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.UserList;
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.DailyHistory;
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;
@@ -24,8 +21,6 @@ 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;
@@ -117,17 +112,13 @@ 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,
Integer page,
Integer size) {
String sortType) {
// 프로젝트 정보 조회 (analUid가 있을 때만)
var projectInfo = labelAllocateCoreService.findProjectInfo(analUid);
@@ -135,59 +126,9 @@ public class LabelAllocateService {
// 작업 진행 현황 조회
var progressInfo = labelAllocateCoreService.findWorkProgressInfo(analUid);
// 작업자 통계 조회
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;
DailyHistory history =
DailyHistory.builder()
.day1Ago(day1Count)
.day2Ago(day2Count)
.day3Ago(day3Count)
.average(average)
.build();
worker.setHistory(history);
// 정체 여부 판단 (3일 평균이 STAGNATION_THRESHOLD 미만일 때)
if (average < STAGNATION_THRESHOLD) {
worker.setIsStagnated(true);
}
}
// 페이징 처리
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();
}