From 262e7181d9d50b31f264f38dd1e19f74de0348f7 Mon Sep 17 00:00:00 2001 From: JSoi Date: Mon, 25 Jul 2022 17:39:23 +0900 Subject: [PATCH] =?UTF-8?q?#18=20[Refactor]=20StoreId=20Long=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EC=A0=84=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/mpnp/baechelin/admin/dto/AdminResponseDto.java | 2 +- .../java/com/mpnp/baechelin/api/dto/LocationInfoDto.java | 2 +- .../java/com/mpnp/baechelin/api/model/PublicApiV1Form.java | 2 +- .../com/mpnp/baechelin/api/service/LocationServiceRT.java | 5 ++--- .../com/mpnp/baechelin/api/service/LocationServiceWC.java | 5 ++--- .../mpnp/baechelin/bookmark/service/BookmarkService.java | 2 +- .../mpnp/baechelin/review/dto/ReviewMainResponseDto.java | 2 +- .../com/mpnp/baechelin/review/dto/ReviewRequestDto.java | 2 +- .../com/mpnp/baechelin/review/dto/ReviewResponseDto.java | 2 +- .../com/mpnp/baechelin/review/service/ReviewService.java | 6 +++--- src/main/java/com/mpnp/baechelin/store/domain/Store.java | 6 +++--- .../com/mpnp/baechelin/store/domain/UserRegisterStore.java | 2 +- .../com/mpnp/baechelin/store/dto/StoreCardResponseDto.java | 2 +- .../mpnp/baechelin/store/repository/StoreRepository.java | 2 +- .../store/repository/UserRegisterStoreRepository.java | 2 +- .../java/com/mpnp/baechelin/store/service/StoreService.java | 2 +- 16 files changed, 22 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/mpnp/baechelin/admin/dto/AdminResponseDto.java b/src/main/java/com/mpnp/baechelin/admin/dto/AdminResponseDto.java index 33ecf70..3f25e39 100644 --- a/src/main/java/com/mpnp/baechelin/admin/dto/AdminResponseDto.java +++ b/src/main/java/com/mpnp/baechelin/admin/dto/AdminResponseDto.java @@ -8,7 +8,7 @@ @Getter @NoArgsConstructor public class AdminResponseDto { - private int registerStoreId; + private long registerStoreId; private String name; private String address; private String elevator; diff --git a/src/main/java/com/mpnp/baechelin/api/dto/LocationInfoDto.java b/src/main/java/com/mpnp/baechelin/api/dto/LocationInfoDto.java index d958774..f073b51 100644 --- a/src/main/java/com/mpnp/baechelin/api/dto/LocationInfoDto.java +++ b/src/main/java/com/mpnp/baechelin/api/dto/LocationInfoDto.java @@ -24,7 +24,7 @@ public class LocationInfoDto { public static class LocationResponse { String category; - Integer storeId; + Long storeId; String storeName; String longitude; String latitude; diff --git a/src/main/java/com/mpnp/baechelin/api/model/PublicApiV1Form.java b/src/main/java/com/mpnp/baechelin/api/model/PublicApiV1Form.java index 3782ac6..835c284 100644 --- a/src/main/java/com/mpnp/baechelin/api/model/PublicApiV1Form.java +++ b/src/main/java/com/mpnp/baechelin/api/model/PublicApiV1Form.java @@ -46,7 +46,7 @@ public static class Result { public static class Row { @JsonProperty("SEQ") int SEQ; - Integer storeId; + Long storeId; BigDecimal latitude; BigDecimal longitude; String category; diff --git a/src/main/java/com/mpnp/baechelin/api/service/LocationServiceRT.java b/src/main/java/com/mpnp/baechelin/api/service/LocationServiceRT.java index fa7d933..4ae132b 100644 --- a/src/main/java/com/mpnp/baechelin/api/service/LocationServiceRT.java +++ b/src/main/java/com/mpnp/baechelin/api/service/LocationServiceRT.java @@ -145,11 +145,10 @@ public LocationInfoDto.LocationResponse convertGeoAndStoreNameToKeyword(String l return null; } return LocationInfoDto.LocationResponse.builder() - .storeId(Integer.parseInt(latLngDoc.getId())) + .storeId(Long.parseLong(latLngDoc.getId())) .latitude(latLngDoc.getY()) .longitude(latLngDoc.getX()) .category(categoryFilter(latLngDoc.getCategory_name())) - .storeId(Integer.parseInt(latLngDoc.getId())) .storeName(latLngDoc.getPlace_name()) .phoneNumber(latLngDoc.getPhone()).build(); } @@ -195,7 +194,7 @@ private void getStoreResults(String lat, String lng, String address, String type .longitude(latLngDoc.getX()) .category(categoryFilter(latLngDoc.getCategory_name())) .storeName(latLngDoc.getPlace_name()) - .storeId(Integer.parseInt(latLngDoc.getId())) + .storeId(Long.parseLong(latLngDoc.getId())) .phoneNumber(latLngDoc.getPhone()) .build(); if (newResult.validate()) { diff --git a/src/main/java/com/mpnp/baechelin/api/service/LocationServiceWC.java b/src/main/java/com/mpnp/baechelin/api/service/LocationServiceWC.java index 8f17557..90971a5 100644 --- a/src/main/java/com/mpnp/baechelin/api/service/LocationServiceWC.java +++ b/src/main/java/com/mpnp/baechelin/api/service/LocationServiceWC.java @@ -134,11 +134,10 @@ public LocationInfoDto.LocationResponse convertGeoAndStoreNameToKeyword(String l return null; } return LocationInfoDto.LocationResponse.builder() - .storeId(Integer.parseInt(latLngDoc.getId())) + .storeId(Long.valueOf(latLngDoc.getId())) .latitude(latLngDoc.getY()) .longitude(latLngDoc.getX()) .category(categoryFilter(latLngDoc.getCategory_name())) - .storeId(Integer.parseInt(latLngDoc.getId())) .storeName(latLngDoc.getPlace_name()) .phoneNumber(latLngDoc.getPhone()).build(); } @@ -178,7 +177,7 @@ private void getStoreResults(String lat, String lng, String address, String type .longitude(latLngDoc.getX()) .category(categoryFilter(latLngDoc.getCategory_name())) .storeName(latLngDoc.getPlace_name()) - .storeId(Integer.parseInt(latLngDoc.getId())) + .storeId(Long.valueOf(latLngDoc.getId())) .phoneNumber(latLngDoc.getPhone()) .build(); if (newResult.validate()) { diff --git a/src/main/java/com/mpnp/baechelin/bookmark/service/BookmarkService.java b/src/main/java/com/mpnp/baechelin/bookmark/service/BookmarkService.java index cd9b49c..61834a5 100644 --- a/src/main/java/com/mpnp/baechelin/bookmark/service/BookmarkService.java +++ b/src/main/java/com/mpnp/baechelin/bookmark/service/BookmarkService.java @@ -24,7 +24,7 @@ public class BookmarkService { public void bookmark(BookmarkRequestDto bookmarkRequestDto, String socialId) { Folder folder = folderRepository.findById(bookmarkRequestDto.getFolderId()).orElseThrow(()-> new IllegalArgumentException("폴더가 존재하지 않습니다")); - Store store = storeRepository.findById(bookmarkRequestDto.getStoreId()).orElseThrow(()-> new IllegalArgumentException("가게가 존재하지 않습니다")); + Store store = storeRepository.findById((long) bookmarkRequestDto.getStoreId()).orElseThrow(()-> new IllegalArgumentException("가게가 존재하지 않습니다")); User user = userRepository.findBySocialId(socialId); if(user == null) { throw new IllegalArgumentException("해당하는 유저가 없습니다."); } Bookmark bookmark = Bookmark diff --git a/src/main/java/com/mpnp/baechelin/review/dto/ReviewMainResponseDto.java b/src/main/java/com/mpnp/baechelin/review/dto/ReviewMainResponseDto.java index cc7bef3..0f7e447 100644 --- a/src/main/java/com/mpnp/baechelin/review/dto/ReviewMainResponseDto.java +++ b/src/main/java/com/mpnp/baechelin/review/dto/ReviewMainResponseDto.java @@ -18,7 +18,7 @@ @Builder public class ReviewMainResponseDto { // review 테이블 컬럼 - private int storeId; + private long storeId; private int userId; private String storeName; private String userName; diff --git a/src/main/java/com/mpnp/baechelin/review/dto/ReviewRequestDto.java b/src/main/java/com/mpnp/baechelin/review/dto/ReviewRequestDto.java index ab0108a..acd7272 100644 --- a/src/main/java/com/mpnp/baechelin/review/dto/ReviewRequestDto.java +++ b/src/main/java/com/mpnp/baechelin/review/dto/ReviewRequestDto.java @@ -12,7 +12,7 @@ @Builder public class ReviewRequestDto { //review 테이블 컬럼 - private int storeId; //업장 아이디 + private long storeId; //업장 아이디 private String content; //리뷰 코멘트 private double point; //별점 private List tagList; //태그 diff --git a/src/main/java/com/mpnp/baechelin/review/dto/ReviewResponseDto.java b/src/main/java/com/mpnp/baechelin/review/dto/ReviewResponseDto.java index cc78705..c03937a 100644 --- a/src/main/java/com/mpnp/baechelin/review/dto/ReviewResponseDto.java +++ b/src/main/java/com/mpnp/baechelin/review/dto/ReviewResponseDto.java @@ -16,7 +16,7 @@ @Getter @Setter public class ReviewResponseDto { private int reviewId; // storeId - private int storeId; + private long storeId; private int userId; private Double point; diff --git a/src/main/java/com/mpnp/baechelin/review/service/ReviewService.java b/src/main/java/com/mpnp/baechelin/review/service/ReviewService.java index 129affe..cd97bca 100644 --- a/src/main/java/com/mpnp/baechelin/review/service/ReviewService.java +++ b/src/main/java/com/mpnp/baechelin/review/service/ReviewService.java @@ -46,7 +46,7 @@ public class ReviewService { /** 리뷰 작성 */ public void review(ReviewRequestDto reviewRequestDto, String socialId) throws IOException { - int storeId = reviewRequestDto.getStoreId(); + long storeId = reviewRequestDto.getStoreId(); Store store = storeRepository.findById(storeId).orElseThrow(() -> new IllegalArgumentException("해당하는 업장이 존재하지 않습니다.")); User user = userRepository.findBySocialId(socialId); Review review = new Review(reviewRequestDto, store, user); @@ -82,7 +82,7 @@ public void review(ReviewRequestDto reviewRequestDto, String socialId) throws IO - public List getReview(int storeId) { + public List getReview(long storeId) { Store store = storeRepository.findById(storeId).orElseThrow(() -> new IllegalArgumentException("해당 가게가 없습니다")); return reviewRepository.findAllByStoreId(store) .stream().map(ReviewResponseDto::new).collect(Collectors.toList()); @@ -94,7 +94,7 @@ public List getReview(int storeId) { /** 리뷰 수정 */ public void reviewUpdate(ReviewRequestDto reviewRequestDto, String socialId, int reviewId) throws IOException { - int storeId = reviewRequestDto.getStoreId(); + long storeId = reviewRequestDto.getStoreId(); User user = userRepository.findBySocialId(socialId); if(user == null){ new IllegalArgumentException("해당하는 소셜아이디를 찾을 수 없습니다."); } Store store = storeRepository.findById(storeId) .orElseThrow(() -> new IllegalArgumentException("해당하는 업장이 존재하지 않습니다.")); Review review = reviewRepository.findById(reviewId) .orElseThrow(() -> new IllegalArgumentException("해당하는 리뷰가 없습니다.")); diff --git a/src/main/java/com/mpnp/baechelin/store/domain/Store.java b/src/main/java/com/mpnp/baechelin/store/domain/Store.java index c963755..897cadd 100644 --- a/src/main/java/com/mpnp/baechelin/store/domain/Store.java +++ b/src/main/java/com/mpnp/baechelin/store/domain/Store.java @@ -22,7 +22,7 @@ @Slf4j public class Store { @Id - private int id; + private Long id; @Column(nullable = false) private String category; @@ -77,7 +77,7 @@ public class Store { public Store(PublicApiV1Form.Row row) { //storeId - 임시 - this.id = row.getStoreId(); + this.id = Long.valueOf(row.getStoreId()); this.name = row.getSISULNAME(); this.address = DataClarification.clarifyString(row.getADDR()); this.phoneNumber = row.getTEL(); @@ -114,7 +114,7 @@ public Store updatePointAvg(double changePoint) { } public Store(LocationInfoDto.LocationResponse sr, PublicApiV2Form.ServList servList, List barrierTagList) { - this.id = sr.getStoreId(); + this.id = Long.valueOf(sr.getStoreId()); this.name = sr.getStoreName(); this.latitude = new BigDecimal(servList.getFaclLat()); this.longitude = new BigDecimal(servList.getFaclLng()); diff --git a/src/main/java/com/mpnp/baechelin/store/domain/UserRegisterStore.java b/src/main/java/com/mpnp/baechelin/store/domain/UserRegisterStore.java index eff7313..38c9ce0 100644 --- a/src/main/java/com/mpnp/baechelin/store/domain/UserRegisterStore.java +++ b/src/main/java/com/mpnp/baechelin/store/domain/UserRegisterStore.java @@ -16,7 +16,7 @@ public class UserRegisterStore extends TimeStamped { @Id @GeneratedValue(strategy = GenerationType.AUTO) - private int id; + private long id; @Column(nullable = false) private String name; diff --git a/src/main/java/com/mpnp/baechelin/store/dto/StoreCardResponseDto.java b/src/main/java/com/mpnp/baechelin/store/dto/StoreCardResponseDto.java index 72644be..fef5d02 100644 --- a/src/main/java/com/mpnp/baechelin/store/dto/StoreCardResponseDto.java +++ b/src/main/java/com/mpnp/baechelin/store/dto/StoreCardResponseDto.java @@ -17,7 +17,7 @@ @Builder @Slf4j public class StoreCardResponseDto implements Comparable { - private int storeId; + private long storeId; private String category; private String name; private BigDecimal latitude; diff --git a/src/main/java/com/mpnp/baechelin/store/repository/StoreRepository.java b/src/main/java/com/mpnp/baechelin/store/repository/StoreRepository.java index 517bfdb..fecf060 100644 --- a/src/main/java/com/mpnp/baechelin/store/repository/StoreRepository.java +++ b/src/main/java/com/mpnp/baechelin/store/repository/StoreRepository.java @@ -7,5 +7,5 @@ import java.util.List; @Repository -public interface StoreRepository extends JpaRepository { +public interface StoreRepository extends JpaRepository { } \ No newline at end of file diff --git a/src/main/java/com/mpnp/baechelin/store/repository/UserRegisterStoreRepository.java b/src/main/java/com/mpnp/baechelin/store/repository/UserRegisterStoreRepository.java index 1da5d61..1c0ad0e 100644 --- a/src/main/java/com/mpnp/baechelin/store/repository/UserRegisterStoreRepository.java +++ b/src/main/java/com/mpnp/baechelin/store/repository/UserRegisterStoreRepository.java @@ -5,6 +5,6 @@ import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; -public interface UserRegisterStoreRepository extends JpaRepository { +public interface UserRegisterStoreRepository extends JpaRepository { Page findAll(Pageable pageable); } diff --git a/src/main/java/com/mpnp/baechelin/store/service/StoreService.java b/src/main/java/com/mpnp/baechelin/store/service/StoreService.java index 493098c..a80674d 100644 --- a/src/main/java/com/mpnp/baechelin/store/service/StoreService.java +++ b/src/main/java/com/mpnp/baechelin/store/service/StoreService.java @@ -163,7 +163,7 @@ private List getStoreCardResponseDtos(User targetUser, Lis * @param socialId 유저 social 아이디 * @return 업장 상세 정보 */ - public StoreCardResponseDto getStore(int storeId, String socialId) { + public StoreCardResponseDto getStore(long storeId, String socialId) { Store store = storeRepository.findById(storeId).orElseThrow(() -> new IllegalArgumentException("해당하는 업장이 존재하지 않습니다.")); if (socialId == null) {