-
Notifications
You must be signed in to change notification settings - Fork 1
[Feature] [상점] 주문 상세 및 정산내역 CRUD #205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
bce32ac
feature #112: 상점 주문 상세내역 및 정산 내역
Moses249 9160c21
feature #112: 상점 주문 상세내역 및 정산 내역
Moses249 ab4e387
feature #112: 정산내역 CRUD
Moses249 44067f0
feature #112: 정산 수정
Moses249 606bf13
feature #112: 정산 수정
Moses249 7ecc0b5
feature #112: 정산 내역 추가
Moses249 c324911
feature #112: 정산 내역 추가
Moses249 760f886
feature #112: 오류 수정 위한 임시 커밋
Moses249 d64787b
Merge remote-tracking branch 'origin/develop' into feature/#112-store…
Moses249 d1ef014
feature #112: 주문 상세 및 정산 내역 수정
Moses249 2435911
feature #112: 주문 상세 및 정산 내역 수정
Moses249 9fd69ae
feature #112: 주문 상세 및 정산 내역 수정
Moses249 1b775cd
feature #112: 주문 상세 및 정산 내역 수정
Moses249 27c31cc
Update comment from '정산 내역' to '총 주문 내역'
Moses249 b4806a3
feature #112: 결제 엔티티 수정
Moses249 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
src/main/java/com/irum/come2us/domain/order/application/service/SalesService.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| package com.irum.come2us.domain.order.application.service; | ||
|
|
||
| import com.irum.come2us.domain.member.domain.entity.Member; | ||
| import com.irum.come2us.domain.order.domain.entity.Order; | ||
| import com.irum.come2us.domain.order.domain.entity.enums.OrderStatus; | ||
| import com.irum.come2us.domain.order.domain.repository.OrderRepository; | ||
| import com.irum.come2us.domain.order.presentation.dto.response.SalesResponse; | ||
| import com.irum.come2us.domain.refund.domain.entity.Refund; | ||
| import com.irum.come2us.domain.refund.domain.entity.enums.RefundStatus; | ||
| import com.irum.come2us.domain.refund.domain.repository.RefundRepository; | ||
| import com.irum.come2us.domain.store.domain.entity.Store; | ||
| import com.irum.come2us.domain.store.domain.repository.StoreRepository; | ||
| import com.irum.come2us.global.presentation.advice.exception.CommonException; | ||
| import com.irum.come2us.global.presentation.advice.exception.errorcode.StoreErrorCode; | ||
| import com.irum.come2us.global.util.MemberUtil; | ||
| import java.util.List; | ||
| import java.util.Optional; | ||
| import java.util.UUID; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.stereotype.Service; | ||
|
|
||
| @Service | ||
| @RequiredArgsConstructor | ||
| public class SalesService { | ||
| private final StoreRepository storeRepository; | ||
| private final OrderRepository orderRepository; | ||
| private final RefundRepository refundRepository; | ||
| private final MemberUtil memberUtil; | ||
|
|
||
| public SalesResponse getSalesList(UUID storeId) { | ||
| Member member = memberUtil.getCurrentMember(); | ||
| Store store = | ||
| storeRepository | ||
| .findById(storeId) | ||
| .orElseThrow(() -> new CommonException(StoreErrorCode.STORE_NOT_FOUND)); | ||
| List<OrderStatus> orderStatuses = | ||
| List.of( | ||
| OrderStatus.DELIVERED, | ||
| OrderStatus.PARTIALLY_DELIVERED, | ||
| OrderStatus.DELIVERED, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. p1 : OrderStatus.DELIVERED가 중복 되어 있습니다! |
||
| OrderStatus.SHIPPED, | ||
| OrderStatus.PREPARING); | ||
| List<RefundStatus> refundStatuses = | ||
| List.of( | ||
| RefundStatus.APPROVED, | ||
| RefundStatus.COMPLETED, | ||
| RefundStatus.PENDING, | ||
| RefundStatus.REJECTED, | ||
| RefundStatus.REQUESTED); | ||
|
Bal1oon marked this conversation as resolved.
Outdated
|
||
| List<Order> orders = orderRepository.findSalesAll(storeId); | ||
| List<SalesResponse.OrderSummary> orderList = | ||
| orders.stream().map(this::toOrderSummary).toList(); | ||
| return new SalesResponse(orderList, null, false); | ||
| } | ||
|
|
||
| private SalesResponse.OrderSummary toOrderSummary(Order order) { | ||
| List<SalesResponse.ProductSummary> productList = | ||
| order.getOrderDetails().stream() | ||
| .map( | ||
| detail -> | ||
| new SalesResponse.ProductSummary( | ||
| detail.getOrderDetailId(), | ||
| detail.getProduct().getName(), | ||
| detail.getQuantity(), | ||
| detail.getPrice(), | ||
| detail.getOptionName())) | ||
| .toList(); | ||
| Optional<Refund> latestRefund = refundRepository.findLatestByOrder(order); | ||
|
|
||
| String displayStatus = latestRefund | ||
| .map(r -> r.getRefundStatus().name()) | ||
| .orElse(order.getOrderStatusAll().name()); | ||
|
|
||
|
|
||
| return new SalesResponse.OrderSummary( | ||
| order.getOrderId(), | ||
| order.getDeliveryAddress().getRecipientName(), | ||
| order.getDeliveryAddress().getRecipientContact(), | ||
| order.getDeliveryAddress().getAddress().toString(), | ||
| order.getCreatedAt(), | ||
| order.getTotalPrice(), | ||
| 0, | ||
| order.getTotalPrice() + order.getDeliveryFee(), | ||
| order.getDeliveryFee(), | ||
| productList, | ||
| displayStatus); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...ain/java/com/irum/come2us/domain/order/presentation/dto/response/OrderDetailResponse.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| package com.irum.come2us.domain.order.presentation.dto.response; | ||
|
|
||
| import java.util.List; | ||
| import java.util.UUID; | ||
|
|
||
| public record OrderDetailResponse( | ||
| List<ProductSummary> productList, | ||
| String recipientName, | ||
| String recipientContact, | ||
| String recipientAddress, | ||
| String paymentStatus, | ||
| String deliveryStatus, | ||
| String deliveryRequest, | ||
| String trackingNumber, | ||
| String arrivedDate, | ||
| String couponName, | ||
| Integer deliveryFee, | ||
| Integer discountAmount, | ||
| int payingAmount, | ||
| String orderDate, | ||
| int totalProductPrice) { | ||
| public record ProductSummary( | ||
| UUID orderDetailId, | ||
| String productName, | ||
| int productPrice, | ||
| int productCounts, | ||
| String productOption) {} | ||
| } |
28 changes: 28 additions & 0 deletions
28
...ava/com/irum/come2us/domain/order/presentation/dto/response/OwnerOrderDetailResponse.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| package com.irum.come2us.domain.order.presentation.dto.response; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonFormat; | ||
| import java.time.LocalDateTime; | ||
| import java.util.List; | ||
| import java.util.UUID; | ||
|
|
||
| public record OwnerOrderDetailResponse( | ||
| List<OrderSummary> orderList, UUID nextCursor, boolean hasNext) { | ||
| public record OrderSummary( | ||
| UUID orderId, | ||
| String recipientName, | ||
| String recipientContact, | ||
| String recipientAddress, | ||
| @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime orderDate, | ||
| int totalProductPrice, | ||
| int discountAmount, | ||
| int payingAmount, | ||
| int deliveryFee, | ||
| List<ProductSummary> productList) {} | ||
|
|
||
| public record ProductSummary( | ||
| UUID orderDetailId, | ||
| String productName, | ||
| int productCounts, | ||
| int productPrice, | ||
| String optionTitle) {} | ||
| } |
28 changes: 28 additions & 0 deletions
28
src/main/java/com/irum/come2us/domain/order/presentation/dto/response/SalesResponse.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| package com.irum.come2us.domain.order.presentation.dto.response; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonFormat; | ||
| import java.time.LocalDateTime; | ||
| import java.util.List; | ||
| import java.util.UUID; | ||
|
|
||
| public record SalesResponse(List<OrderSummary> orderList, UUID nextCursor, boolean hasNext) { | ||
| public record OrderSummary( | ||
| UUID orderId, | ||
| String recipientName, | ||
| String recipientContact, | ||
| String recipientAddress, | ||
| @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime orderDate, | ||
| int totalProductPrice, | ||
| int discountAmount, | ||
| int payingAmount, | ||
| int deliveryFee, | ||
| List<ProductSummary> productList, | ||
| String orderStatus) {} | ||
|
|
||
| public record ProductSummary( | ||
| UUID orderDetailId, | ||
| String productName, | ||
| int productCounts, | ||
| int productPrice, | ||
| String optionTitle) {} | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.