라벨 다운로드 수정
This commit is contained in:
@@ -31,7 +31,6 @@ import java.util.List;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.coyote.BadRequestException;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
@@ -386,9 +385,9 @@ public class LabelAllocateApiController {
|
|||||||
@Parameter(example = "6d8d49dc-0c9d-4124-adc7-b9ca610cc394") @PathVariable UUID uuid)
|
@Parameter(example = "6d8d49dc-0c9d-4124-adc7-b9ca610cc394") @PathVariable UUID uuid)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
|
||||||
if (!labelAllocateService.isDownloadable(uuid)) {
|
// if (!labelAllocateService.isDownloadable(uuid)) {
|
||||||
throw new BadRequestException();
|
// throw new BadRequestException();
|
||||||
}
|
// }
|
||||||
|
|
||||||
String uid = labelAllocateService.findLearnUid(uuid);
|
String uid = labelAllocateService.findLearnUid(uuid);
|
||||||
Path zipPath = Paths.get(responsePath).resolve(uid + ".zip");
|
Path zipPath = Paths.get(responsePath).resolve(uid + ".zip");
|
||||||
|
|||||||
@@ -257,16 +257,16 @@ public class LabelAllocateCoreService {
|
|||||||
|
|
||||||
// 파일이 있는지만 확인
|
// 파일이 있는지만 확인
|
||||||
Path path = Paths.get(responsePath).resolve(dto.getLearnUid() + ".zip");
|
Path path = Paths.get(responsePath).resolve(dto.getLearnUid() + ".zip");
|
||||||
|
if (!Files.isRegularFile(path)) return false; // exists 포함
|
||||||
|
|
||||||
if (!Files.exists(path) || !Files.isRegularFile(path)) {
|
String state = dto.getAnalState();
|
||||||
// 실제 파일만 true (디렉터리는 제외)
|
boolean isLabelingIng =
|
||||||
return false;
|
LabelMngState.ASSIGNED.getId().equals(state) || LabelMngState.ING.getId().equals(state);
|
||||||
}
|
|
||||||
|
|
||||||
// 다운로드 확인할 학습데이터가 라벨링중인 경우 파일 생성여부가 정상인지 확인
|
if (isLabelingIng) {
|
||||||
if (dto.getAnalState().equals(LabelMngState.ASSIGNED.getId())
|
Long analId = dto.getAnalId();
|
||||||
|| dto.getAnalState().equals(LabelMngState.ING.getId())) {
|
if (analId == null) return false;
|
||||||
return batchStepHistoryRepository.isDownloadable(dto.getAnalId());
|
return batchStepHistoryRepository.isDownloadable(analId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user