파라미터 yyyy기준으로 변경

This commit is contained in:
2026-01-02 22:17:42 +09:00
parent c85dc1a070
commit a7b04d0be8
6 changed files with 608 additions and 551 deletions

View File

@@ -34,23 +34,24 @@ public class LabelAllocateService {
/**
* 도엽 기준 asc sorting 해서 할당 수만큼 배정하는 로직
*
* @param autoType 자동/수동 배정 타입
* @param stage 회차
* @param targetUsers 라벨러 목록
* @param autoType 자동/수동 배정 타입
* @param stage 회차
* @param targetUsers 라벨러 목록
* @param targetInspectors 검수자 목록
* @param analUid 분석 ID
*/
@Transactional
public void allocateAsc(
String autoType,
Integer stage,
List<TargetUser> targetUsers,
List<TargetInspector> targetInspectors,
Long analUid) {
String autoType,
Integer stage,
List<TargetUser> targetUsers,
List<TargetInspector> targetInspectors,
Integer compareYyyy,
Integer targetYyyy
) {
Long lastId = null;
// geom 잔여건수 조회
Long chargeCnt = labelAllocateCoreService.findLabelUnAssignedCnt(analUid, stage);
Long chargeCnt = labelAllocateCoreService.findLabelUnAssignedCnt(stage, compareYyyy, targetYyyy);
// Long totalDemand = targetUsers.stream().mapToLong(TargetUser::getDemand).sum();
// if (!Objects.equals(chargeCnt, totalDemand)) {
// log.info("chargeCnt != totalDemand");
@@ -61,18 +62,18 @@ public class LabelAllocateService {
return;
}
List<Long> allIds = labelAllocateCoreService.fetchNextIds(lastId, chargeCnt, analUid);
List<Long> allIds = labelAllocateCoreService.fetchNextIds(lastId, chargeCnt, compareYyyy, targetYyyy, stage);
int index = 0;
for (TargetUser target : targetUsers) {
int end = index + target.getDemand();
List<Long> sub = allIds.subList(index, end);
labelAllocateCoreService.assignOwner(sub, target.getUserId(), analUid);
labelAllocateCoreService.assignOwner(sub, target.getUserId(), compareYyyy, targetYyyy, stage);
index = end;
}
// 검수자에게 userCount명 만큼 할당
List<LabelAllocateDto.Basic> list = labelAllocateCoreService.findAssignedLabelerList(analUid);
List<LabelAllocateDto.Basic> list = labelAllocateCoreService.findAssignedLabelerList(compareYyyy, targetYyyy, stage);
int from = 0;
for (TargetInspector inspector : targetInspectors) {
@@ -83,7 +84,7 @@ public class LabelAllocateService {
}
List<UUID> assignmentUids =
list.subList(from, to).stream().map(LabelAllocateDto.Basic::getAssignmentUid).toList();
list.subList(from, to).stream().map(LabelAllocateDto.Basic::getAssignmentUid).toList();
labelAllocateCoreService.assignInspectorBulk(assignmentUids, inspector.getInspectorUid());
@@ -98,50 +99,50 @@ public class LabelAllocateService {
/**
* 작업자 목록 및 3일치 통계 조회
*
* @param analUid 분석 ID
* @param workerType 작업자 유형 (LABELER/INSPECTOR)
* @param searchName 이름 검색
* @param analUid 분석 ID
* @param workerType 작업자 유형 (LABELER/INSPECTOR)
* @param searchName 이름 검색
* @param searchEmployeeNo 사번 검색
* @param sortType 정렬 조건
* @param sortType 정렬 조건
* @return 작업자 목록 및 통계
*/
public WorkerListResponse getWorkerStatistics(
Long analUid,
String workerType,
String searchName,
String searchEmployeeNo,
String sortType) {
Long analUid,
String workerType,
String searchName,
String searchEmployeeNo,
String sortType) {
// 작업 진행 현황 조회
var progressInfo = labelAllocateCoreService.findWorkProgressInfo(analUid);
// 작업자 통계 조회
List<WorkerStatistics> workers =
labelAllocateCoreService.findWorkerStatistics(
analUid, workerType, searchName, searchEmployeeNo, sortType);
labelAllocateCoreService.findWorkerStatistics(
analUid, workerType, searchName, searchEmployeeNo, sortType);
// 각 작업자별 3일치 처리량 조회
LocalDate today = LocalDate.now();
for (WorkerStatistics worker : workers) {
Long day1Count =
labelAllocateCoreService.findDailyProcessedCount(
worker.getWorkerId(), workerType, today.minusDays(1), analUid);
labelAllocateCoreService.findDailyProcessedCount(
worker.getWorkerId(), workerType, today.minusDays(1), analUid);
Long day2Count =
labelAllocateCoreService.findDailyProcessedCount(
worker.getWorkerId(), workerType, today.minusDays(2), analUid);
labelAllocateCoreService.findDailyProcessedCount(
worker.getWorkerId(), workerType, today.minusDays(2), analUid);
Long day3Count =
labelAllocateCoreService.findDailyProcessedCount(
worker.getWorkerId(), workerType, today.minusDays(3), analUid);
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();
DailyHistory.builder()
.day1Ago(day1Count)
.day2Ago(day2Count)
.day3Ago(day3Count)
.average(average)
.build();
worker.setHistory(history);
@@ -154,11 +155,12 @@ public class LabelAllocateService {
return WorkerListResponse.builder().progressInfo(progressInfo).workers(workers).build();
}
public InferenceDetail findInferenceDetail(Long analUid) {
return labelAllocateCoreService.findInferenceDetail(analUid);
public InferenceDetail findInferenceDetail(Integer compareYyyy, Integer targetYyyy, Integer stage) {
return labelAllocateCoreService.findInferenceDetail(compareYyyy, targetYyyy, stage);
}
public void allocateMove(String autoType, Integer stage, List<TargetUser> targetUsers) {
public void allocateMove(String autoType, Integer stage, List<TargetUser> targetUsers, Integer compareYyyy,
Integer targetYyyy) {
Long lastId = null;
Long chargeCnt = targetUsers.stream().mapToLong(TargetUser::getDemand).sum();
@@ -167,7 +169,7 @@ public class LabelAllocateService {
return;
}
List<Long> allIds = labelAllocateCoreService.fetchNextMoveIds(lastId, chargeCnt);
List<Long> allIds = labelAllocateCoreService.fetchNextMoveIds(lastId, chargeCnt, compareYyyy, targetYyyy, stage);
int index = 0;
for (TargetUser target : targetUsers) {
int end = index + target.getDemand();
@@ -178,7 +180,7 @@ public class LabelAllocateService {
}
}
public LabelerDetail findLabelerDetail(String userId, Long analUid) {
return labelAllocateCoreService.findLabelerDetail(userId, analUid);
public LabelerDetail findLabelerDetail(String userId, Integer compareYyyy, Integer targetYyyy, Integer stage) {
return labelAllocateCoreService.findLabelerDetail(userId, compareYyyy, targetYyyy, stage);
}
}