Skip to content

Commit

Permalink
#18 [Refactor] StoreId Long으로 전환
Browse files Browse the repository at this point in the history
  • Loading branch information
JSoi committed Jul 25, 2022
1 parent dfd71dd commit 262e718
Show file tree
Hide file tree
Showing 16 changed files with 22 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@Getter
@NoArgsConstructor
public class AdminResponseDto {
private int registerStoreId;
private long registerStoreId;
private String name;
private String address;
private String elevator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class LocationInfoDto {
public static class LocationResponse {

String category;
Integer storeId;
Long storeId;
String storeName;
String longitude;
String latitude;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
@Builder
public class ReviewMainResponseDto {
// review 테이블 컬럼
private int storeId;
private long storeId;
private int userId;
private String storeName;
private String userName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@Builder
public class ReviewRequestDto {
//review 테이블 컬럼
private int storeId; //업장 아이디
private long storeId; //업장 아이디
private String content; //리뷰 코멘트
private double point; //별점
private List<String> tagList; //태그
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -82,7 +82,7 @@ public void review(ReviewRequestDto reviewRequestDto, String socialId) throws IO



public List<ReviewResponseDto> getReview(int storeId) {
public List<ReviewResponseDto> getReview(long storeId) {
Store store = storeRepository.findById(storeId).orElseThrow(() -> new IllegalArgumentException("해당 가게가 없습니다"));
return reviewRepository.findAllByStoreId(store)
.stream().map(ReviewResponseDto::new).collect(Collectors.toList());
Expand All @@ -94,7 +94,7 @@ public List<ReviewResponseDto> 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("해당하는 리뷰가 없습니다."));
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/mpnp/baechelin/store/domain/Store.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
@Slf4j
public class Store {
@Id
private int id;
private Long id;

@Column(nullable = false)
private String category;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -114,7 +114,7 @@ public Store updatePointAvg(double changePoint) {
}

public Store(LocationInfoDto.LocationResponse sr, PublicApiV2Form.ServList servList, List<String> 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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@Builder
@Slf4j
public class StoreCardResponseDto implements Comparable<StoreCardResponseDto> {
private int storeId;
private long storeId;
private String category;
private String name;
private BigDecimal latitude;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
import java.util.List;

@Repository
public interface StoreRepository extends JpaRepository<Store, Integer> {
public interface StoreRepository extends JpaRepository<Store, Long> {
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

public interface UserRegisterStoreRepository extends JpaRepository<UserRegisterStore, Integer> {
public interface UserRegisterStoreRepository extends JpaRepository<UserRegisterStore, Long> {
Page<UserRegisterStore> findAll(Pageable pageable);
}
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ private List<StoreCardResponseDto> 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) {
Expand Down

0 comments on commit 262e718

Please sign in to comment.