Merge branch 'feat/dev_251201' of https://10.100.0.10:3210/dabeeo/kamco-dabeeo-backoffice into feat/dev_251201
# Conflicts: # src/main/java/com/kamco/cd/kamcoback/label/LabelAllocateApiController.java # src/main/java/com/kamco/cd/kamcoback/label/service/LabelAllocateService.java # src/main/java/com/kamco/cd/kamcoback/postgres/core/LabelAllocateCoreService.java # src/main/java/com/kamco/cd/kamcoback/postgres/repository/label/LabelAllocateRepositoryImpl.java
This commit is contained in:
@@ -5,7 +5,6 @@ import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
||||
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.LabelingStatDto;
|
||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerListResponse;
|
||||
import com.kamco.cd.kamcoback.label.service.LabelAllocateService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -19,7 +18,6 @@ import jakarta.validation.Valid;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -38,118 +36,120 @@ public class LabelAllocateApiController {
|
||||
|
||||
@Operation(summary = "배정 가능한 사용자 목록 조회", description = "라벨링 작업 배정을 위한 활성 상태의 사용자 목록을 조회합니다.")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(responseCode = "200", description = "조회 성공"),
|
||||
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음"),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류")
|
||||
})
|
||||
value = {
|
||||
@ApiResponse(responseCode = "200", description = "조회 성공"),
|
||||
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음"),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류")
|
||||
})
|
||||
@GetMapping("/avail-user")
|
||||
public ApiResponseDto<List<LabelAllocateDto.UserList>> availUserList(
|
||||
@Parameter(
|
||||
description = "사용자 역할",
|
||||
example = "LABELER",
|
||||
schema = @Schema(allowableValues = {"LABELER", "REVIEWER"}))
|
||||
@RequestParam
|
||||
String role) {
|
||||
@Parameter(
|
||||
description = "사용자 역할",
|
||||
example = "LABELER",
|
||||
schema = @Schema(allowableValues = {"LABELER", "REVIEWER"}))
|
||||
@RequestParam
|
||||
String role) {
|
||||
return ApiResponseDto.ok(labelAllocateService.availUserList(role));
|
||||
}
|
||||
|
||||
@Operation(
|
||||
summary = "작업현황 관리 (라벨링, 검수 진행률 요약정보, 작업자 목록)",
|
||||
description = "작업현황 관리 (라벨링, 검수 진행률 요약정보, 작업자 목록)")
|
||||
summary = "작업현황 관리 (라벨링, 검수 진행률 요약정보, 작업자 목록)",
|
||||
description = "작업현황 관리 (라벨링, 검수 진행률 요약정보, 작업자 목록)")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(responseCode = "200", description = "조회 성공"),
|
||||
@ApiResponse(responseCode = "404", description = "데이터를 찾을 수 없음"),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류")
|
||||
})
|
||||
value = {
|
||||
@ApiResponse(responseCode = "200", description = "조회 성공"),
|
||||
@ApiResponse(responseCode = "404", description = "데이터를 찾을 수 없음"),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류")
|
||||
})
|
||||
@GetMapping("/admin/workers")
|
||||
public ApiResponseDto<WorkerListResponse> getWorkerStatistics(
|
||||
@Parameter(description = "분석 ID (선택)", example = "3") @RequestParam(required = false)
|
||||
Long analUid,
|
||||
@Parameter(
|
||||
description = "작업자 유형 (선택) - 미입력 시 LABELER로 조회",
|
||||
example = "LABELER",
|
||||
schema =
|
||||
@Schema(
|
||||
allowableValues = {"LABELER", "REVIEWER"},
|
||||
defaultValue = "LABELER"))
|
||||
@RequestParam(required = false)
|
||||
String type,
|
||||
@Parameter(description = "검색어 (작업자 이름 또는 사번으로 검색, 부분 일치)", example = "김라벨")
|
||||
@RequestParam(required = false)
|
||||
String search,
|
||||
@Parameter(
|
||||
description = "정렬 조건 (선택) - 미입력 시 이름 오름차순",
|
||||
example = "REMAINING_DESC",
|
||||
schema =
|
||||
@Schema(
|
||||
allowableValues = {
|
||||
"REMAINING_DESC",
|
||||
"REMAINING_ASC",
|
||||
"NAME_ASC",
|
||||
"NAME_DESC"
|
||||
},
|
||||
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) {
|
||||
// @Parameter(description = "분석 ID (선택)", example = "3") @RequestParam(required = false)
|
||||
// Long analUid,
|
||||
@Parameter(
|
||||
description = "작업자 유형 (선택) - 미입력 시 LABELER로 조회",
|
||||
example = "LABELER",
|
||||
schema =
|
||||
@Schema(
|
||||
allowableValues = {"LABELER", "REVIEWER"},
|
||||
defaultValue = "LABELER"))
|
||||
@RequestParam(required = false)
|
||||
String type,
|
||||
@Parameter(description = "검색어 (작업자 이름 또는 사번으로 검색, 부분 일치)", example = "김라벨")
|
||||
@RequestParam(required = false)
|
||||
String search,
|
||||
@Parameter(
|
||||
description = "정렬 조건 (선택) - 미입력 시 이름 오름차순",
|
||||
example = "REMAINING_DESC",
|
||||
schema =
|
||||
@Schema(
|
||||
allowableValues = {
|
||||
"REMAINING_DESC",
|
||||
"REMAINING_ASC",
|
||||
"COMPLETED_DESC",
|
||||
"COMPLETED_ASC",
|
||||
"NAME_ASC",
|
||||
"NAME_DESC"
|
||||
},
|
||||
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) {
|
||||
|
||||
// type이 null이면 기본값으로 LABELER 설정
|
||||
String workerType = (type == null || type.isEmpty()) ? RoleType.LABELER.name() : type;
|
||||
|
||||
return ApiResponseDto.ok(
|
||||
labelAllocateService.getWorkerStatistics(
|
||||
analUid, workerType, search, sort, page, size));
|
||||
labelAllocateService.getWorkerStatistics(
|
||||
null, workerType, search, sort, page, size));
|
||||
}
|
||||
|
||||
@Operation(summary = "라벨링작업 관리 > 작업 배정", description = "라벨링작업 관리 > 작업 배정")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
responseCode = "201",
|
||||
description = "등록 성공",
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = Long.class))),
|
||||
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
|
||||
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
})
|
||||
value = {
|
||||
@ApiResponse(
|
||||
responseCode = "201",
|
||||
description = "등록 성공",
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = Long.class))),
|
||||
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
|
||||
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
})
|
||||
@PostMapping("/allocate")
|
||||
public ApiResponseDto<ApiResponseDto.ResponseObj> labelAllocate(
|
||||
@RequestBody @Valid LabelAllocateDto.AllocateDto dto) {
|
||||
@RequestBody @Valid LabelAllocateDto.AllocateDto dto) {
|
||||
|
||||
return ApiResponseDto.okObject(
|
||||
labelAllocateService.allocateAsc(
|
||||
dto.getStage(),
|
||||
dto.getLabelers(),
|
||||
dto.getInspectors(),
|
||||
dto.getCompareYyyy(),
|
||||
dto.getTargetYyyy()));
|
||||
labelAllocateService.allocateAsc(
|
||||
dto.getStage(),
|
||||
dto.getLabelers(),
|
||||
dto.getInspectors(),
|
||||
dto.getCompareYyyy(),
|
||||
dto.getTargetYyyy()));
|
||||
}
|
||||
|
||||
@Operation(summary = "작업현황 관리 > 변화탐지 회차 정보", description = "작업현황 관리 > 변화탐지 회차 정보")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(responseCode = "200", description = "조회 성공"),
|
||||
@ApiResponse(responseCode = "404", description = "데이터를 찾을 수 없음"),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류")
|
||||
})
|
||||
value = {
|
||||
@ApiResponse(responseCode = "200", description = "조회 성공"),
|
||||
@ApiResponse(responseCode = "404", description = "데이터를 찾을 수 없음"),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류")
|
||||
})
|
||||
@GetMapping("/stage-detail")
|
||||
public ApiResponseDto<InferenceDetail> findInferenceDetail(
|
||||
@Parameter(
|
||||
description = "회차 마스터 key",
|
||||
required = true,
|
||||
example = "8584e8d4-53b3-4582-bde2-28a81495a626")
|
||||
@RequestParam
|
||||
String uuid) {
|
||||
@Parameter(
|
||||
description = "회차 마스터 key",
|
||||
required = true,
|
||||
example = "8584e8d4-53b3-4582-bde2-28a81495a626")
|
||||
@RequestParam
|
||||
String uuid) {
|
||||
return ApiResponseDto.ok(labelAllocateService.findInferenceDetail(uuid));
|
||||
}
|
||||
|
||||
@@ -177,37 +177,37 @@ public class LabelAllocateApiController {
|
||||
|
||||
@Operation(summary = "작업현황 관리 > 상세 > 작업 이관", description = "작업현황 관리 > 상세 > 작업 이관")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
responseCode = "201",
|
||||
description = "등록 성공",
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = Long.class))),
|
||||
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
|
||||
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
})
|
||||
value = {
|
||||
@ApiResponse(
|
||||
responseCode = "201",
|
||||
description = "등록 성공",
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = Long.class))),
|
||||
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
|
||||
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
})
|
||||
@PostMapping("/allocate-move")
|
||||
public ApiResponseDto<ApiResponseDto.ResponseObj> labelAllocateMove(
|
||||
@io.swagger.v3.oas.annotations.parameters.RequestBody(
|
||||
description = "라벨링 이관",
|
||||
required = true,
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = LabelAllocateDto.AllocateMoveDto.class)))
|
||||
@RequestBody
|
||||
LabelAllocateDto.AllocateMoveDto dto) {
|
||||
@io.swagger.v3.oas.annotations.parameters.RequestBody(
|
||||
description = "라벨링 이관",
|
||||
required = true,
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = LabelAllocateDto.AllocateMoveDto.class)))
|
||||
@RequestBody
|
||||
LabelAllocateDto.AllocateMoveDto dto) {
|
||||
|
||||
return ApiResponseDto.okObject(
|
||||
labelAllocateService.allocateMove(
|
||||
dto.getAutoType(),
|
||||
dto.getStage(),
|
||||
dto.getLabelers(),
|
||||
dto.getCompareYyyy(),
|
||||
dto.getTargetYyyy()));
|
||||
labelAllocateService.allocateMove(
|
||||
dto.getAutoType(),
|
||||
dto.getStage(),
|
||||
dto.getLabelers(),
|
||||
dto.getCompareYyyy(),
|
||||
dto.getTargetYyyy()));
|
||||
}
|
||||
|
||||
@Operation(
|
||||
|
||||
@@ -10,6 +10,27 @@ import lombok.Setter;
|
||||
|
||||
public class WorkerStatsDto {
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(description = "프로젝트 기본 정보 (상단 표시용)")
|
||||
public static class ProjectInfo {
|
||||
|
||||
@Schema(description = "변화탐지년도 (예: 2026-2025)")
|
||||
private String detectionYear;
|
||||
|
||||
@Schema(description = "회차 (예: 8)")
|
||||
private String round;
|
||||
|
||||
@Schema(description = "국유인 반영일 (예: 2026-03-31)")
|
||||
private String reflectionDate;
|
||||
|
||||
@Schema(description = "작업 시작일 (예: 2026-04-06)")
|
||||
private String startDate;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@@ -44,6 +65,25 @@ public class WorkerStatsDto {
|
||||
|
||||
@Schema(description = "작업 정체 여부 (3일간 실적이 저조하면 true)")
|
||||
private Boolean isStagnated;
|
||||
|
||||
// 레거시 필드 (기존 호환성 유지)
|
||||
@Deprecated
|
||||
private Long doneCnt; // completed로 대체
|
||||
|
||||
@Deprecated
|
||||
private Long skipCnt; // skipped로 대체
|
||||
|
||||
@Deprecated
|
||||
private Long remainingCnt; // remaining으로 대체
|
||||
|
||||
@Deprecated
|
||||
private Long day3AgoDoneCnt; // history.day3Ago로 대체
|
||||
|
||||
@Deprecated
|
||||
private Long day2AgoDoneCnt; // history.day2Ago로 대체
|
||||
|
||||
@Deprecated
|
||||
private Long day1AgoDoneCnt; // history.day1Ago로 대체
|
||||
}
|
||||
|
||||
@Getter
|
||||
@@ -67,6 +107,7 @@ public class WorkerStatsDto {
|
||||
private Long average;
|
||||
}
|
||||
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@@ -75,29 +116,74 @@ public class WorkerStatsDto {
|
||||
@Schema(description = "작업 진행 현황 정보")
|
||||
public static class WorkProgressInfo {
|
||||
|
||||
// === 라벨링 관련 ===
|
||||
@Schema(description = "라벨링 진행률 (완료건+스킵건)/배정건")
|
||||
private Double labelingProgressRate;
|
||||
|
||||
@Schema(description = "작업 상태 (진행중/종료)")
|
||||
private String workStatus;
|
||||
@Schema(description = "라벨링 작업 상태 (진행중/완료)")
|
||||
private String labelingStatus;
|
||||
|
||||
@Schema(description = "진행률 수치 (완료+스킵)")
|
||||
private Long completedCount;
|
||||
@Schema(description = "라벨링 전체 배정 건수")
|
||||
private Long labelingTotalCount;
|
||||
|
||||
@Schema(description = "전체 배정 건수")
|
||||
private Long totalAssignedCount;
|
||||
@Schema(description = "라벨링 완료 건수 (LABEL_FIN + TEST_ING + DONE)")
|
||||
private Long labelingCompletedCount;
|
||||
|
||||
@Schema(description = "라벨링 스킵 건수 (SKIP)")
|
||||
private Long labelingSkipCount;
|
||||
|
||||
@Schema(description = "라벨링 남은 작업 건수")
|
||||
private Long labelingRemainingCount;
|
||||
|
||||
@Schema(description = "투입된 라벨러 수")
|
||||
private Long labelerCount;
|
||||
|
||||
@Schema(description = "남은 라벨링 작업 데이터 수")
|
||||
private Long remainingLabelCount;
|
||||
// === 검수(Inspection) 관련 (신규 추가) ===
|
||||
@Schema(description = "검수 진행률 (완료건/대상건)")
|
||||
private Double inspectionProgressRate;
|
||||
|
||||
@Schema(description = "검수 작업 상태 (진행중/완료)")
|
||||
private String inspectionStatus;
|
||||
|
||||
@Schema(description = "검수 전체 대상 건수")
|
||||
private Long inspectionTotalCount;
|
||||
|
||||
@Schema(description = "검수 완료 건수 (DONE)")
|
||||
private Long inspectionCompletedCount;
|
||||
|
||||
@Schema(description = "검수 제외 건수 (라벨링 스킵과 동일)")
|
||||
private Long inspectionSkipCount;
|
||||
|
||||
@Schema(description = "검수 남은 작업 건수")
|
||||
private Long inspectionRemainingCount;
|
||||
|
||||
@Schema(description = "투입된 검수자 수")
|
||||
private Long inspectorCount;
|
||||
|
||||
@Schema(description = "남은 검수 작업 데이터 수")
|
||||
// === 레거시 호환 필드 (Deprecated) ===
|
||||
@Deprecated
|
||||
@Schema(description = "[Deprecated] labelingProgressRate 사용 권장")
|
||||
private Double progressRate;
|
||||
|
||||
@Deprecated
|
||||
@Schema(description = "[Deprecated] labelingTotalCount 사용 권장")
|
||||
private Long totalAssignedCount;
|
||||
|
||||
@Deprecated
|
||||
@Schema(description = "[Deprecated] labelingCompletedCount 사용 권장")
|
||||
private Long completedCount;
|
||||
|
||||
@Deprecated
|
||||
@Schema(description = "[Deprecated] labelingRemainingCount 사용 권장")
|
||||
private Long remainingLabelCount;
|
||||
|
||||
@Deprecated
|
||||
@Schema(description = "[Deprecated] inspectionRemainingCount 사용 권장")
|
||||
private Long remainingInspectCount;
|
||||
|
||||
@Deprecated
|
||||
@Schema(description = "[Deprecated] labelingStatus/inspectionStatus 사용 권장")
|
||||
private String workStatus;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@@ -108,6 +194,9 @@ public class WorkerStatsDto {
|
||||
@Schema(description = "작업자 목록 응답 (작업 정보 포함)")
|
||||
public static class WorkerListResponse {
|
||||
|
||||
@Schema(description = "프로젝트 기본 정보 (상단 표시용)")
|
||||
private ProjectInfo projectInfo;
|
||||
|
||||
@Schema(description = "작업 진행 현황 정보")
|
||||
private WorkProgressInfo progressInfo;
|
||||
|
||||
|
||||
@@ -38,22 +38,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, "이미 배정완료된 회차 입니다.");
|
||||
}
|
||||
@@ -61,15 +61,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) {
|
||||
@@ -115,52 +115,55 @@ 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 정렬 조건
|
||||
* @param page 페이지 번호 (0부터 시작)
|
||||
* @param size 페이지 크기
|
||||
* @return 작업자 목록 및 통계
|
||||
*/
|
||||
public WorkerListResponse getWorkerStatistics(
|
||||
Long analUid,
|
||||
String workerType,
|
||||
String search,
|
||||
String sortType,
|
||||
Integer page,
|
||||
Integer size) {
|
||||
Long analUid,
|
||||
String workerType,
|
||||
String search,
|
||||
String sortType,
|
||||
Integer page,
|
||||
Integer size) {
|
||||
|
||||
// 프로젝트 정보 조회 (analUid가 있을 때만)
|
||||
var projectInfo = labelAllocateCoreService.findProjectInfo(analUid);
|
||||
|
||||
// 작업 진행 현황 조회
|
||||
var progressInfo = labelAllocateCoreService.findWorkProgressInfo(analUid);
|
||||
|
||||
// 작업자 통계 조회
|
||||
List<WorkerStatistics> workers =
|
||||
labelAllocateCoreService.findWorkerStatistics(
|
||||
analUid, workerType, search, sortType);
|
||||
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);
|
||||
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);
|
||||
|
||||
@@ -177,16 +180,17 @@ public class LabelAllocateService {
|
||||
int toIndex = Math.min(fromIndex + size, workers.size());
|
||||
|
||||
List<WorkerStatistics> pagedWorkers =
|
||||
(fromIndex < workers.size()) ? workers.subList(fromIndex, toIndex) : List.of();
|
||||
(fromIndex < workers.size()) ? workers.subList(fromIndex, toIndex) : List.of();
|
||||
|
||||
return WorkerListResponse.builder()
|
||||
.progressInfo(progressInfo)
|
||||
.workers(pagedWorkers)
|
||||
.currentPage(page)
|
||||
.pageSize(size)
|
||||
.totalElements(totalElements)
|
||||
.totalPages(totalPages)
|
||||
.build();
|
||||
.projectInfo(projectInfo)
|
||||
.progressInfo(progressInfo)
|
||||
.workers(pagedWorkers)
|
||||
.currentPage(page)
|
||||
.pageSize(size)
|
||||
.totalElements(totalElements)
|
||||
.totalPages(totalPages)
|
||||
.build();
|
||||
}
|
||||
|
||||
public InferenceDetail findInferenceDetail(String uuid) {
|
||||
@@ -194,11 +198,11 @@ public class LabelAllocateService {
|
||||
}
|
||||
|
||||
public ApiResponseDto.ResponseObj allocateMove(
|
||||
String autoType,
|
||||
Integer stage,
|
||||
List<TargetUser> targetUsers,
|
||||
Integer compareYyyy,
|
||||
Integer targetYyyy) {
|
||||
String autoType,
|
||||
Integer stage,
|
||||
List<TargetUser> targetUsers,
|
||||
Integer compareYyyy,
|
||||
Integer targetYyyy) {
|
||||
Long lastId = null;
|
||||
|
||||
Long chargeCnt = targetUsers.stream().mapToLong(TargetUser::getDemand).sum();
|
||||
@@ -208,8 +212,8 @@ public class LabelAllocateService {
|
||||
}
|
||||
|
||||
List<Long> allIds =
|
||||
labelAllocateCoreService.fetchNextMoveIds(
|
||||
lastId, chargeCnt, compareYyyy, targetYyyy, stage);
|
||||
labelAllocateCoreService.fetchNextMoveIds(
|
||||
lastId, chargeCnt, compareYyyy, targetYyyy, stage);
|
||||
int index = 0;
|
||||
for (TargetUser target : targetUsers) {
|
||||
int end = index + target.getDemand();
|
||||
|
||||
Reference in New Issue
Block a user