라벨할당 수정, 상세 조회 API

This commit is contained in:
2026-01-02 20:19:54 +09:00
parent 513a2d3ebe
commit 89b1ea755f
8 changed files with 268 additions and 155 deletions

View File

@@ -3,8 +3,7 @@ package com.kamco.cd.kamcoback.label;
import com.kamco.cd.kamcoback.code.dto.CommonCodeDto;
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
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.InferenceDetail;
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerListResponse;
import com.kamco.cd.kamcoback.label.service.LabelAllocateService;
import io.swagger.v3.oas.annotations.Operation;
@@ -69,7 +68,7 @@ public class LabelAllocateApiController {
})
@GetMapping("/avail-user")
public ApiResponseDto<List<LabelAllocateDto.UserList>> availUserList(
@Parameter(description = "사용자 역할 (LABELER: 라벨러, INSPECTOR: 검수자)", example = "LABELER")
@Parameter(description = "사용자 역할 (LABELER: 라벨러, REVIEWER: 검수자)", example = "LABELER")
@RequestParam
@Schema()
String role) {
@@ -78,10 +77,9 @@ public class LabelAllocateApiController {
@Operation(
summary = "작업자 목록 및 3일치 통계 조회",
description =
"""
학습데이터 제작 현황 조회 API입니다.
""")
description = """
학습데이터 제작 현황 조회 API입니다.
""")
@ApiResponses(
value = {
@ApiResponse(
@@ -97,93 +95,93 @@ public class LabelAllocateApiController {
description = "라벨러 작업자들의 통계 정보",
value =
"""
{
"data": {
"progressInfo": {
"labelingProgressRate": 79.34,
"workStatus": "진행중",
"completedCount": 6554,
"totalAssignedCount": 8258,
"labelerCount": 5,
"remainingLabelCount": 1704,
"inspectorCount": 3,
"remainingInspectCount": 890
},
"workers": [
{
"workerId": "1234567",
"workerName": "김라벨",
"workerType": "LABELER",
"totalAssigned": 1500,
"completed": 1100,
"skipped": 50,
"remaining": 350,
"history": {
"day1Ago": 281,
"day2Ago": 302,
"day3Ago": 294,
"average": 292
},
"isStagnated": false
{
"data": {
"progressInfo": {
"labelingProgressRate": 79.34,
"workStatus": "진행중",
"completedCount": 6554,
"totalAssignedCount": 8258,
"labelerCount": 5,
"remainingLabelCount": 1704,
"inspectorCount": 3,
"remainingInspectCount": 890
},
{
"workerId": "2345678",
"workerName": "이작업",
"workerType": "LABELER",
"totalAssigned": 2000,
"completed": 1850,
"skipped": 100,
"remaining": 50,
"history": {
"day1Ago": 5,
"day2Ago": 3,
"day3Ago": 8,
"average": 5
"workers": [
{
"workerId": "1234567",
"workerName": "김라벨",
"workerType": "LABELER",
"totalAssigned": 1500,
"completed": 1100,
"skipped": 50,
"remaining": 350,
"history": {
"day1Ago": 281,
"day2Ago": 302,
"day3Ago": 294,
"average": 292
},
"isStagnated": false
},
"isStagnated": true
}
]
{
"workerId": "2345678",
"workerName": "이작업",
"workerType": "LABELER",
"totalAssigned": 2000,
"completed": 1850,
"skipped": 100,
"remaining": 50,
"history": {
"day1Ago": 5,
"day2Ago": 3,
"day3Ago": 8,
"average": 5
},
"isStagnated": true
}
]
}
}
}
"""),
"""),
@ExampleObject(
name = "검수자 조회 예시",
description = "검수자 작업자들의 통계 정보",
value =
"""
{
"data": {
"progressInfo": {
"labelingProgressRate": 79.34,
"workStatus": "진행중",
"completedCount": 6554,
"totalAssignedCount": 8258,
"labelerCount": 5,
"remainingLabelCount": 1704,
"inspectorCount": 3,
"remainingInspectCount": 890
},
"workers": [
{
"workerId": "9876543",
"workerName": "박검수",
"workerType": "INSPECTOR",
"totalAssigned": 1200,
"completed": 980,
"skipped": 20,
"remaining": 200,
"history": {
"day1Ago": 150,
"day2Ago": 145,
"day3Ago": 155,
"average": 150
},
"isStagnated": false
}
]
{
"data": {
"progressInfo": {
"labelingProgressRate": 79.34,
"workStatus": "진행중",
"completedCount": 6554,
"totalAssignedCount": 8258,
"labelerCount": 5,
"remainingLabelCount": 1704,
"inspectorCount": 3,
"remainingInspectCount": 890
},
"workers": [
{
"workerId": "9876543",
"workerName": "박검수",
"workerType": "REVIEWER",
"totalAssigned": 1200,
"completed": 980,
"skipped": 20,
"remaining": 200,
"history": {
"day1Ago": 150,
"day2Ago": 145,
"day3Ago": 155,
"average": 150
},
"isStagnated": false
}
]
}
}
}
""")
""")
})),
@ApiResponse(
responseCode = "404",
@@ -227,7 +225,7 @@ public class LabelAllocateApiController {
example = "LABELER",
schema =
@Schema(
allowableValues = {"LABELER", "INSPECTOR"},
allowableValues = {"LABELER", "REVIEWER"},
defaultValue = "LABELER"))
@RequestParam(required = false)
String type,
@@ -259,22 +257,40 @@ public class LabelAllocateApiController {
analUid, workerType, searchName, searchEmployeeNo, sort));
}
// 라벨링 수량 할당하는 로직 테스트
@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)
})
@PostMapping("/allocate")
public ApiResponseDto<Void> labelAllocate(@RequestBody LabelAllocateDto dto) {
public ApiResponseDto<Void> labelAllocate(
@io.swagger.v3.oas.annotations.parameters.RequestBody(
description = "라벨링 수량 할당",
required = true,
content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = LabelAllocateDto.AllocateDto.class)))
@RequestBody
LabelAllocateDto.AllocateDto dto)
throws Exception {
List<TargetUser> targets =
List.of(
new TargetUser("1234567", 1000),
new TargetUser("2345678", 400),
new TargetUser("3456789", 440));
List<TargetInspector> inspectors =
List.of(
new TargetInspector("9876543", 1000),
new TargetInspector("8765432", 340),
new TargetInspector("98765432", 500));
labelAllocateService.allocateAsc(targets, inspectors);
labelAllocateService.allocateAsc(
dto.getAutoType(), dto.getStage(), dto.getLabelers(), dto.getInspectors());
return ApiResponseDto.ok(null);
}
@GetMapping
public ApiResponseDto<InferenceDetail> findInferenceDetail(@RequestParam Long analUid) {
return ApiResponseDto.ok(labelAllocateService.findInferenceDetail(analUid));
}
}