build error fix
This commit is contained in:
@@ -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 = "라벨링작업 관리 > 작업 배정")
|
||||
|
||||
@@ -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,9 +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;
|
||||
|
||||
public LabelAllocateService(LabelAllocateCoreService labelAllocateCoreService) {
|
||||
@@ -117,17 +111,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 +125,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();
|
||||
}
|
||||
|
||||
|
||||
@@ -772,7 +772,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
|
||||
@Override
|
||||
public Page<LabelingStatDto> findInspectorDailyStat(
|
||||
searchReq searchReq, String uuid, String userId) {
|
||||
LabelAllocateDto.searchReq searchReq, String uuid, String userId) {
|
||||
// 날짜 포맷
|
||||
Expression<String> workDate =
|
||||
Expressions.stringTemplate(
|
||||
|
||||
Reference in New Issue
Block a user