From 556950e19b6a0564d8372a123e4eefa9c072a260 Mon Sep 17 00:00:00 2001 From: Donghoon Jeong <112836685+jjeongdong@users.noreply.github.com> Date: Sun, 11 Aug 2024 12:45:15 +0900 Subject: [PATCH] =?UTF-8?q?fix=20:=20=EC=82=AC=EC=A7=84=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C,=20=EC=97=85=EB=A1=9C=EB=93=9C=EC=8B=9C=20=EB=B2=84?= =?UTF-8?q?=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../umc/naoman/domain/photo/converter/PhotoConverter.java | 6 ++++-- .../umc/naoman/domain/photo/service/PhotoServiceImpl.java | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/photo/converter/PhotoConverter.java b/src/main/java/com/umc/naoman/domain/photo/converter/PhotoConverter.java index 90824c9..7328d0d 100644 --- a/src/main/java/com/umc/naoman/domain/photo/converter/PhotoConverter.java +++ b/src/main/java/com/umc/naoman/domain/photo/converter/PhotoConverter.java @@ -9,6 +9,7 @@ import org.springframework.stereotype.Component; import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; import java.util.stream.Collectors; @@ -64,6 +65,8 @@ public PhotoResponse.PagedPhotoEsInfo toPagedPhotoEsInfo(Page photoEsLi public PhotoResponse.PhotoEsInfo toPhotoEsInfo(PhotoEs photoEs, Member member) { String rawUrl = photoEs.getUrl(); Boolean isDownload = !photoEs.getDownloadTag().isEmpty() && photoEs.getDownloadTag().contains(member.getId()); + DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + LocalDateTime createdAt = LocalDateTime.parse(photoEs.getCreatedAt(), dateTimeFormatter); return PhotoResponse.PhotoEsInfo.builder() .photoId(photoEs.getRdsId()) @@ -71,11 +74,10 @@ public PhotoResponse.PhotoEsInfo toPhotoEsInfo(PhotoEs photoEs, Member member) { .w200PhotoUrl(createResizedPhotoUrl(rawUrl, W200_PATH_PREFIX)) .w400PhotoUrl(createResizedPhotoUrl(rawUrl, W400_PATH_PREFIX)) .isDownload(isDownload) - .createdAt(LocalDateTime.parse(photoEs.getCreatedAt())) + .createdAt(createdAt) .build(); } - private String createResizedPhotoUrl(String photoUrl, String size) { String resizedUrl = getResizedUrl(photoUrl, size); return convertExtension(resizedUrl); diff --git a/src/main/java/com/umc/naoman/domain/photo/service/PhotoServiceImpl.java b/src/main/java/com/umc/naoman/domain/photo/service/PhotoServiceImpl.java index 053583e..2b03ff7 100644 --- a/src/main/java/com/umc/naoman/domain/photo/service/PhotoServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/photo/service/PhotoServiceImpl.java @@ -185,7 +185,7 @@ private String extractPhotoNameFromUrl(String photoUrl) { // S3에 객체의 존재 여부 확인 및 DB에 사진을 저장하고 객체를 반환하는 메서드 private Photo checkAndSavePhotoInDB(String photoUrl, String photoName, ShareGroup shareGroup) { - if (amazonS3.doesObjectExist(bucketName, RAW_PATH_PREFIX + "/" + photoName)) { + if (!amazonS3.doesObjectExist(bucketName, RAW_PATH_PREFIX + "/" + photoName)) { throw new BusinessException(PHOTO_NOT_FOUND_S3); }