build error fix
# Conflicts: # src/main/java/com/kamco/cd/kamcoback/label/service/LabelAllocateService.java
This commit is contained in:
@@ -9,9 +9,7 @@ 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.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;
|
||||
@@ -23,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) {
|
||||
@@ -35,22 +30,22 @@ public class LabelAllocateService {
|
||||
/**
|
||||
* 도엽 기준 asc sorting 해서 할당 수만큼 배정하는 로직
|
||||
*
|
||||
* @param stage 회차
|
||||
* @param targetUsers 라벨러 목록
|
||||
* @param stage 회차
|
||||
* @param targetUsers 라벨러 목록
|
||||
* @param targetInspectors 검수자 목록
|
||||
*/
|
||||
@Transactional
|
||||
public ApiResponseDto.ResponseObj allocateAsc(
|
||||
Integer stage,
|
||||
List<TargetUser> targetUsers,
|
||||
List<String> targetInspectors,
|
||||
Integer compareYyyy,
|
||||
Integer targetYyyy) {
|
||||
Integer stage,
|
||||
List<TargetUser> targetUsers,
|
||||
List<String> targetInspectors,
|
||||
Integer compareYyyy,
|
||||
Integer targetYyyy) {
|
||||
Long lastId = null;
|
||||
|
||||
// geom 잔여건수 조회
|
||||
Long chargeCnt =
|
||||
labelAllocateCoreService.findLabelUnAssignedCnt(stage, compareYyyy, targetYyyy);
|
||||
labelAllocateCoreService.findLabelUnAssignedCnt(stage, compareYyyy, targetYyyy);
|
||||
if (chargeCnt <= 0) {
|
||||
return new ApiResponseDto.ResponseObj(ApiResponseCode.DUPLICATE_DATA, "이미 배정완료된 회차 입니다.");
|
||||
}
|
||||
@@ -58,15 +53,15 @@ public class LabelAllocateService {
|
||||
Long totalDemand = targetUsers.stream().mapToLong(TargetUser::getDemand).sum();
|
||||
if (!Objects.equals(chargeCnt, totalDemand)) {
|
||||
return new ApiResponseDto.ResponseObj(
|
||||
ApiResponseCode.BAD_REQUEST, "총 잔여건수와 요청 값의 합계가 맞지 않습니다.");
|
||||
ApiResponseCode.BAD_REQUEST, "총 잔여건수와 요청 값의 합계가 맞지 않습니다.");
|
||||
}
|
||||
|
||||
List<AllocateInfoDto> allIds =
|
||||
labelAllocateCoreService.fetchNextIds(lastId, chargeCnt, compareYyyy, targetYyyy, stage);
|
||||
labelAllocateCoreService.fetchNextIds(lastId, chargeCnt, compareYyyy, targetYyyy, stage);
|
||||
|
||||
// MapSheetAnalInferenceEntity analUid 가져오기
|
||||
Long analUid =
|
||||
labelAllocateCoreService.findMapSheetAnalInferenceUid(compareYyyy, targetYyyy, stage);
|
||||
labelAllocateCoreService.findMapSheetAnalInferenceUid(compareYyyy, targetYyyy, stage);
|
||||
|
||||
int index = 0;
|
||||
for (TargetUser target : targetUsers) {
|
||||
@@ -112,16 +107,17 @@ public class LabelAllocateService {
|
||||
/**
|
||||
* 작업자 통계 조회
|
||||
*
|
||||
* @param analUid 분석 ID
|
||||
* @param analUid 분석 ID
|
||||
* @param workerType 작업자 유형 (LABELER/INSPECTOR)
|
||||
* @param search 검색어 (이름 또는 사번)
|
||||
* @param sortType 정렬 조건
|
||||
* @param page 페이지 번호 (0부터 시작)
|
||||
* @param size 페이지 크기
|
||||
* @param search 검색어 (이름 또는 사번)
|
||||
* @param sortType 정렬 조건
|
||||
* @return 작업자 목록 및 통계
|
||||
*/
|
||||
public WorkerListResponse getWorkerStatistics(
|
||||
Long analUid, String workerType, String search, String sortType, Integer page, Integer size) {
|
||||
Long analUid,
|
||||
String workerType,
|
||||
String search,
|
||||
String sortType) {
|
||||
|
||||
// 프로젝트 정보 조회 (analUid가 있을 때만)
|
||||
var projectInfo = labelAllocateCoreService.findProjectInfo(analUid);
|
||||
@@ -129,44 +125,10 @@ 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;
|
||||
}
|
||||
|
||||
// 페이징 처리
|
||||
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();
|
||||
.projectInfo(projectInfo)
|
||||
.progressInfo(progressInfo)
|
||||
.build();
|
||||
}
|
||||
|
||||
public InferenceDetail findInferenceDetail(String uuid) {
|
||||
@@ -174,11 +136,12 @@ public class LabelAllocateService {
|
||||
}
|
||||
|
||||
public ApiResponseDto.ResponseObj allocateMove(
|
||||
Integer stage,
|
||||
List<TargetUser> targetUsers,
|
||||
Integer compareYyyy,
|
||||
Integer targetYyyy,
|
||||
String userId) {
|
||||
String autoType,
|
||||
Integer stage,
|
||||
List<TargetUser> targetUsers,
|
||||
Integer compareYyyy,
|
||||
Integer targetYyyy,
|
||||
String userId) {
|
||||
Long lastId = null;
|
||||
|
||||
Long chargeCnt = targetUsers.stream().mapToLong(TargetUser::getDemand).sum();
|
||||
@@ -188,8 +151,8 @@ public class LabelAllocateService {
|
||||
}
|
||||
|
||||
List<Long> allIds =
|
||||
labelAllocateCoreService.fetchNextMoveIds(
|
||||
lastId, chargeCnt, compareYyyy, targetYyyy, stage, userId);
|
||||
labelAllocateCoreService.fetchNextMoveIds(
|
||||
lastId, chargeCnt, compareYyyy, targetYyyy, stage, userId);
|
||||
int index = 0;
|
||||
for (TargetUser target : targetUsers) {
|
||||
int end = index + target.getDemand();
|
||||
|
||||
Reference in New Issue
Block a user