개선작업

This commit is contained in:
DanielLee
2026-01-02 21:20:46 +09:00
parent 3a458225c9
commit 358d932e96
13 changed files with 95 additions and 146 deletions

View File

@@ -37,17 +37,19 @@ public class LabelAllocateService {
* @param stage 회차
* @param targetUsers 라벨러 목록
* @param targetInspectors 검수자 목록
* @param analUid 분석 ID
*/
@Transactional
public void allocateAsc(
String autoType,
Integer stage,
List<TargetUser> targetUsers,
List<TargetInspector> targetInspectors) {
List<TargetInspector> targetInspectors,
Long analUid) {
Long lastId = null;
// geom 잔여건수 != 프론트에서 넘어 온 총 건수 -> return
Long chargeCnt = labelAllocateCoreService.findLabelUnAssignedCnt(3L); // TODO
// geom 잔여건수 조회
Long chargeCnt = labelAllocateCoreService.findLabelUnAssignedCnt(analUid, stage);
// Long totalDemand = targetUsers.stream().mapToLong(TargetUser::getDemand).sum();
// if (!Objects.equals(chargeCnt, totalDemand)) {
// log.info("chargeCnt != totalDemand");
@@ -58,18 +60,18 @@ public class LabelAllocateService {
return;
}
List<Long> allIds = labelAllocateCoreService.fetchNextIds(lastId, chargeCnt);
List<Long> allIds = labelAllocateCoreService.fetchNextIds(lastId, chargeCnt, analUid);
int index = 0;
for (TargetUser target : targetUsers) {
int end = index + target.getDemand();
List<Long> sub = allIds.subList(index, end);
labelAllocateCoreService.assignOwner(sub, target.getUserId());
labelAllocateCoreService.assignOwner(sub, target.getUserId(), analUid);
index = end;
}
// 검수자에게 userCount명 만큼 할당
List<LabelAllocateDto.Basic> list = labelAllocateCoreService.findAssignedLabelerList(3L);
List<LabelAllocateDto.Basic> list = labelAllocateCoreService.findAssignedLabelerList(analUid);
int from = 0;
for (TargetInspector inspector : targetInspectors) {

View File

@@ -1,16 +1,8 @@
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.label.dto.LabelWorkDto;
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMng;
import com.kamco.cd.kamcoback.postgres.core.LabelAllocateCoreService;
import com.kamco.cd.kamcoback.postgres.core.LabelWorkCoreService;
import jakarta.transaction.Transactional;
import java.util.List;
import java.util.Objects;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
@@ -25,8 +17,6 @@ public class LabelWorkService {
this.labelWorkCoreService = labelWorkCoreService;
}
public Page<LabelWorkMng> labelWorkMngList(LabelWorkDto.LabelWorkMngSearchReq searchReq) {
return labelWorkCoreService.labelWorkMngList(searchReq);