할당 가능한 라벨러, 검수자 목록 API
This commit is contained in:
@@ -3,6 +3,7 @@ package com.kamco.cd.kamcoback.label.service;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.TargetInspector;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.TargetUser;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.UserList;
|
||||
import com.kamco.cd.kamcoback.postgres.core.LabelAllocateCoreService;
|
||||
import jakarta.transaction.Transactional;
|
||||
import java.util.List;
|
||||
@@ -29,15 +30,15 @@ public class LabelAllocateService {
|
||||
public void allocateAsc(List<TargetUser> targetUsers, List<TargetInspector> targetInspectors) {
|
||||
Long lastId = null;
|
||||
|
||||
//geom 잔여건수 != 프론트에서 넘어 온 총 건수 -> return
|
||||
Long chargeCnt = labelAllocateCoreService.findLabelUnAssignedCnt(3L); //TODO
|
||||
// geom 잔여건수 != 프론트에서 넘어 온 총 건수 -> return
|
||||
Long chargeCnt = labelAllocateCoreService.findLabelUnAssignedCnt(3L); // TODO
|
||||
Long totalDemand = targetUsers.stream().mapToLong(TargetUser::getDemand).sum();
|
||||
if (!Objects.equals(chargeCnt, totalDemand)) {
|
||||
log.info("chargeCnt != totalDemand");
|
||||
return;
|
||||
}
|
||||
|
||||
//라벨러에게 건수만큼 할당
|
||||
// 라벨러에게 건수만큼 할당
|
||||
for (TargetUser target : targetUsers) {
|
||||
int remaining = target.getDemand();
|
||||
|
||||
@@ -50,15 +51,14 @@ public class LabelAllocateService {
|
||||
return; // 더이상 할당할 데이터가 없으면 return
|
||||
}
|
||||
|
||||
labelAllocateCoreService.assignOwner(
|
||||
ids, target.getUserId());
|
||||
labelAllocateCoreService.assignOwner(ids, target.getUserId());
|
||||
|
||||
remaining -= ids.size();
|
||||
lastId = ids.get(ids.size() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
//검수자에게 userCount명 만큼 할당
|
||||
// 검수자에게 userCount명 만큼 할당
|
||||
List<LabelAllocateDto.Basic> list = labelAllocateCoreService.findAssignedLabelerList(3L);
|
||||
int reviewerIndex = 0;
|
||||
int count = 0;
|
||||
@@ -66,7 +66,8 @@ public class LabelAllocateService {
|
||||
|
||||
for (LabelAllocateDto.Basic labeler : list) {
|
||||
TargetInspector inspector = targetInspectors.get(reviewerIndex);
|
||||
labelAllocateCoreService.assignInspector(labeler.getAssignmentUid(), inspector.getInspectorUid());
|
||||
labelAllocateCoreService.assignInspector(
|
||||
labeler.getAssignmentUid(), inspector.getInspectorUid());
|
||||
count++;
|
||||
|
||||
if (count == inspector.getUserCount()) {
|
||||
@@ -74,6 +75,9 @@ public class LabelAllocateService {
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<UserList> availUserList(String role) {
|
||||
return labelAllocateCoreService.availUserList(role);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user