라벨링 종료여부 추가
This commit is contained in:
@@ -6,6 +6,7 @@ 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.UpdateClosedRequest;
|
||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerListResponse;
|
||||
import com.kamco.cd.kamcoback.label.service.LabelAllocateService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -236,4 +237,66 @@ public class LabelAllocateApiController {
|
||||
String uuid) {
|
||||
return ApiResponseDto.ok(labelAllocateService.moveAvailUserList(userId, uuid));
|
||||
}
|
||||
|
||||
@Operation(
|
||||
summary = "작업현황 관리 > 라벨링/검수 종료 여부 업데이트",
|
||||
description = "라벨링/검수 종료 여부를 업데이트합니다. uuid 생략 시 최신 프로젝트 대상")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(responseCode = "200", description = "업데이트 성공"),
|
||||
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
})
|
||||
@PostMapping("/projectinfo/closed")
|
||||
public ApiResponseDto<ApiResponseDto.ResponseObj> updateClosedYn(
|
||||
@io.swagger.v3.oas.annotations.parameters.RequestBody(
|
||||
description = "종료 여부 업데이트 요청",
|
||||
required = true,
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = UpdateClosedRequest.class),
|
||||
examples = {
|
||||
@io.swagger.v3.oas.annotations.media.ExampleObject(
|
||||
name = "라벨링 종료",
|
||||
value = """
|
||||
{"closedType": "LABELING", "closedYn": "Y"}
|
||||
"""),
|
||||
@io.swagger.v3.oas.annotations.media.ExampleObject(
|
||||
name = "검수 종료",
|
||||
value = """
|
||||
{"closedType": "INSPECTION", "closedYn": "Y"}
|
||||
"""),
|
||||
@io.swagger.v3.oas.annotations.media.ExampleObject(
|
||||
name = "라벨링 재개",
|
||||
value = """
|
||||
{"closedType": "LABELING", "closedYn": "N"}
|
||||
"""),
|
||||
@io.swagger.v3.oas.annotations.media.ExampleObject(
|
||||
name = "검수 재개",
|
||||
value = """
|
||||
{"closedType": "INSPECTION", "closedYn": "N"}
|
||||
"""),
|
||||
@io.swagger.v3.oas.annotations.media.ExampleObject(
|
||||
name = "특정 프로젝트 라벨링 종료",
|
||||
value = """
|
||||
{"uuid": "f97dc186-e6d3-4645-9737-3173dde8dc64", "closedType": "LABELING", "closedYn": "Y"}
|
||||
""")
|
||||
}))
|
||||
@RequestBody
|
||||
@Valid
|
||||
UpdateClosedRequest request) {
|
||||
|
||||
labelAllocateService.updateClosedYn(
|
||||
request.getUuid(), request.getClosedType(), request.getClosedYn());
|
||||
|
||||
String typeLabel = "LABELING".equals(request.getClosedType()) ? "라벨링" : "검수";
|
||||
String statusMessage =
|
||||
"Y".equals(request.getClosedYn())
|
||||
? typeLabel + "이(가) 종료되었습니다."
|
||||
: typeLabel + "이(가) 재개되었습니다.";
|
||||
|
||||
return ApiResponseDto.okObject(
|
||||
new ApiResponseDto.ResponseObj(ApiResponseDto.ApiResponseCode.OK, statusMessage));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.kamco.cd.kamcoback.label.dto;
|
||||
|
||||
import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import java.time.ZonedDateTime;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
@@ -35,6 +37,43 @@ public class WorkerStatsDto {
|
||||
|
||||
@Schema(description = "프로젝트 UUID")
|
||||
private String uuid;
|
||||
|
||||
@Schema(description = "라벨링 종료 여부 (Y: 종료, N: 진행중)")
|
||||
private String labelingClosedYn;
|
||||
|
||||
@Schema(description = "검수 종료 여부 (Y: 종료, N: 진행중)")
|
||||
private String inspectionClosedYn;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(description = "프로젝트 종료 여부 업데이트 요청")
|
||||
public static class UpdateClosedRequest {
|
||||
|
||||
@Schema(
|
||||
description = "프로젝트 UUID (선택) - 미입력 시 현재 진행중인 최신 프로젝트가 대상",
|
||||
example = "f97dc186-e6d3-4645-9737-3173dde8dc64")
|
||||
private String uuid;
|
||||
|
||||
@NotBlank(message = "종료 유형은 필수입니다.")
|
||||
@Pattern(regexp = "^(LABELING|INSPECTION)$", message = "종료 유형은 LABELING 또는 INSPECTION이어야 합니다.")
|
||||
@Schema(
|
||||
description = "종료 유형 (LABELING: 라벨링, INSPECTION: 검수)",
|
||||
example = "LABELING",
|
||||
allowableValues = {"LABELING", "INSPECTION"},
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String closedType;
|
||||
|
||||
@NotBlank(message = "종료 여부는 필수입니다.")
|
||||
@Pattern(regexp = "^[YN]$", message = "종료 여부는 Y 또는 N이어야 합니다.")
|
||||
@Schema(
|
||||
description = "종료 여부 (Y: 종료, N: 진행중)",
|
||||
example = "Y",
|
||||
allowableValues = {"Y", "N"},
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String closedYn;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@@ -144,7 +183,7 @@ public class WorkerStatsDto {
|
||||
@Schema(description = "검수 작업 상태 (진행중/완료)")
|
||||
private String inspectionStatus;
|
||||
|
||||
@Schema(description = "검수 전체 대상 건수")
|
||||
@Schema(description = "검수 대상 건수 (라벨링 대상과 동일)")
|
||||
private Long inspectionTotalCount;
|
||||
|
||||
@Schema(description = "검수 완료 건수 (DONE)")
|
||||
@@ -179,10 +218,6 @@ public class WorkerStatsDto {
|
||||
@Deprecated
|
||||
@Schema(description = "[Deprecated] inspectionRemainingCount 사용 권장")
|
||||
private Long remainingInspectCount;
|
||||
|
||||
@Deprecated
|
||||
@Schema(description = "[Deprecated] labelingStatus/inspectionStatus 사용 권장")
|
||||
private String workStatus;
|
||||
}
|
||||
|
||||
@Getter
|
||||
|
||||
@@ -195,4 +195,27 @@ public class LabelAllocateService {
|
||||
public MoveInfo moveAvailUserList(String userId, String uuid) {
|
||||
return labelAllocateCoreService.moveAvailUserList(userId, uuid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 프로젝트 종료 여부 업데이트
|
||||
*
|
||||
* @param uuid 프로젝트 UUID (선택, 미입력 시 최신 프로젝트 대상)
|
||||
* @param closedType 종료 유형 (LABELING/INSPECTION)
|
||||
* @param closedYn 종료 여부 (Y/N)
|
||||
*/
|
||||
@Transactional
|
||||
public void updateClosedYn(String uuid, String closedType, String closedYn) {
|
||||
String targetUuid = uuid;
|
||||
|
||||
// uuid가 없으면 최신 프로젝트 uuid 조회
|
||||
if (targetUuid == null || targetUuid.isBlank()) {
|
||||
var latestProjectInfo = labelAllocateCoreService.findLatestProjectInfo();
|
||||
if (latestProjectInfo == null || latestProjectInfo.getUuid() == null) {
|
||||
throw new IllegalArgumentException("진행중인 프로젝트가 없습니다.");
|
||||
}
|
||||
targetUuid = latestProjectInfo.getUuid();
|
||||
}
|
||||
|
||||
labelAllocateCoreService.updateClosedYnByUuid(targetUuid, closedType, closedYn);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user