라벨 다운로드 수정 #64

Merged
teddy merged 1 commits from feat/infer_dev_260211 into develop 2026-02-11 11:37:59 +09:00
2 changed files with 11 additions and 12 deletions

View File

@@ -31,7 +31,6 @@ import java.util.List;
import java.util.UUID;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.coyote.BadRequestException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.http.MediaType;
@@ -386,9 +385,9 @@ public class LabelAllocateApiController {
@Parameter(example = "6d8d49dc-0c9d-4124-adc7-b9ca610cc394") @PathVariable UUID uuid)
throws IOException {
if (!labelAllocateService.isDownloadable(uuid)) {
throw new BadRequestException();
}
// if (!labelAllocateService.isDownloadable(uuid)) {
// throw new BadRequestException();
// }
String uid = labelAllocateService.findLearnUid(uuid);
Path zipPath = Paths.get(responsePath).resolve(uid + ".zip");

View File

@@ -257,16 +257,16 @@ public class LabelAllocateCoreService {
// 파일이 있는지만 확인
Path path = Paths.get(responsePath).resolve(dto.getLearnUid() + ".zip");
if (!Files.isRegularFile(path)) return false; // exists 포함
if (!Files.exists(path) || !Files.isRegularFile(path)) {
// 실제 파일만 true (디렉터리는 제외)
return false;
}
String state = dto.getAnalState();
boolean isLabelingIng =
LabelMngState.ASSIGNED.getId().equals(state) || LabelMngState.ING.getId().equals(state);
// 다운로드 확인할 학습데이터가 라벨링중인 경우 파일 생성여부가 정상인지 확인
if (dto.getAnalState().equals(LabelMngState.ASSIGNED.getId())
|| dto.getAnalState().equals(LabelMngState.ING.getId())) {
return batchStepHistoryRepository.isDownloadable(dto.getAnalId());
if (isLabelingIng) {
Long analId = dto.getAnalId();
if (analId == null) return false;
return batchStepHistoryRepository.isDownloadable(analId);
}
return true;