Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…erver into feature/donation
  • Loading branch information
Kang1221 committed Feb 22, 2024
2 parents ce19ca9 + 3d4e91e commit 91ab74e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ default Map<Store, Integer> getGiftboxSumsByStore(Long receiverId) {
}
return storeGiftBoxSums;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public ApiResponse receiverHome(){
return ApiResponse.failure(Error.NOT_AUTHENTICATED_EXCEPTION);
}
Receiver receiver = authUtils.getReceiver();
Long receiver_id = receiver.getId();

//사용 가능한 꾸러미만 조회
List<Giftbox> giftboxList = Optional.ofNullable(giftboxRepository.findAllByReceiverIdAndIsAvailable(receiver.getId()))
Expand All @@ -49,12 +50,14 @@ public ApiResponse receiverHome(){
// Integer cu = cuGiftBox.orElse(0);
// Integer gs25 = gs25GiftBox.orElse(0);
// Integer seveneleven = sevenelevenGiftBox.orElse(0);

//사용처별 꾸러미 잔액 -> 쿼리 한번만 호출하도록 변경
Map<Store, Integer> storeGiftBoxMap = giftboxRepository.getGiftboxSumsByStore(receiver.getId());
Integer cu = storeGiftBoxMap.getOrDefault(Store.CU, 0);
Integer gs25 = storeGiftBoxMap.getOrDefault(Store.GS25, 0);
Integer seveneleven = storeGiftBoxMap.getOrDefault(Store.SEVENELEVEN, 0);


//꾸러미 정보 가져오기
List<BoxInfo> boxInfoList = new ArrayList<>();
Long amount = 0L;
Expand Down

0 comments on commit 91ab74e

Please sign in to comment.