Refactor: 충돌 해결
This commit is contained in:
commit
27cbe81f50
@ -3,6 +3,7 @@ package com.worlabel.domain.image.service;
|
||||
import com.worlabel.domain.folder.entity.Folder;
|
||||
import com.worlabel.domain.folder.repository.FolderRepository;
|
||||
import com.worlabel.domain.image.entity.Image;
|
||||
import com.worlabel.domain.image.entity.LabelStatus;
|
||||
import com.worlabel.domain.image.entity.dto.*;
|
||||
import com.worlabel.domain.image.repository.ImageRepository;
|
||||
import com.worlabel.domain.participant.entity.PrivilegeType;
|
||||
@ -19,7 +20,9 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
@ -131,6 +134,8 @@ public class ImageService {
|
||||
Image image = imageRepository.findById(imageId)
|
||||
.orElseThrow(() -> new CustomException(ErrorCode.DATA_NOT_FOUND));
|
||||
String dataPath = image.getDataPath();
|
||||
image.updateStatus(LabelStatus.COMPLETED);
|
||||
imageRepository.save(image);
|
||||
s3UploadService.uploadJson(labelRequest.getData(), dataPath);
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import com.google.gson.Gson;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.worlabel.domain.image.entity.Image;
|
||||
import com.worlabel.domain.image.entity.LabelStatus;
|
||||
import com.worlabel.domain.image.repository.ImageRepository;
|
||||
import com.worlabel.domain.labelcategory.entity.ProjectCategory;
|
||||
import com.worlabel.domain.member.entity.Member;
|
||||
@ -185,12 +186,15 @@ public class ProjectService {
|
||||
}
|
||||
|
||||
// TODO: 트랜잭션 설정
|
||||
// TODO: 어떤 상황까지 덮어쓸껀지 물어보기
|
||||
@Transactional
|
||||
public void saveAutoLabelList(final List<AutoLabelingResult> resultList) {
|
||||
for(AutoLabelingResult result: resultList) {
|
||||
Image image = getImage(result.getImageId());
|
||||
if(image.getStatus() == LabelStatus.SAVE) continue;
|
||||
String dataPath = image.getDataPath();
|
||||
s3UploadService.uploadJson(result.getData(), dataPath);
|
||||
image.updateStatus(LabelStatus.IN_PROGRESS);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user