-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…cascade Refactor/#97 order cascade
- Loading branch information
Showing
32 changed files
with
390 additions
and
187 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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
23 changes: 0 additions & 23 deletions
23
src/main/java/org/store/clothstar/order/service/OrderApplicationService.java
This file was deleted.
Oops, something went wrong.
This file contains 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
10 changes: 10 additions & 0 deletions
10
src/main/java/org/store/clothstar/order/service/OrderSave/OrderCreator.java
This file contains 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,10 @@ | ||
package org.store.clothstar.order.service.OrderSave; | ||
|
||
import org.store.clothstar.member.domain.Address; | ||
import org.store.clothstar.member.domain.Member; | ||
import org.store.clothstar.order.domain.Order; | ||
import org.store.clothstar.order.dto.request.CreateOrderRequest; | ||
|
||
public interface OrderCreator { | ||
Order createOrder(CreateOrderRequest request,Member member,Address address); | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/org/store/clothstar/order/service/OrderSave/OrderCreatorImpl.java
This file contains 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,17 @@ | ||
package org.store.clothstar.order.service.OrderSave; | ||
|
||
import org.springframework.stereotype.Service; | ||
import org.store.clothstar.member.domain.Address; | ||
import org.store.clothstar.member.domain.Member; | ||
import org.store.clothstar.order.domain.Order; | ||
import org.store.clothstar.order.dto.request.CreateOrderRequest; | ||
|
||
|
||
@Service | ||
public class OrderCreatorImpl implements OrderCreator { | ||
|
||
@Override | ||
public Order createOrder(CreateOrderRequest request,Member member,Address address) { | ||
return request.toOrder(member, address); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/org/store/clothstar/order/service/OrderSave/OrderDetailAdder.java
This file contains 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,8 @@ | ||
package org.store.clothstar.order.service.OrderSave; | ||
|
||
import org.store.clothstar.order.domain.Order; | ||
import org.store.clothstar.order.domain.OrderDetail; | ||
|
||
public interface OrderDetailAdder { | ||
void addOrderDetail(Order order, OrderDetail orderDetail); | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/org/store/clothstar/order/service/OrderSave/OrderDetailAdderImpl.java
This file contains 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,13 @@ | ||
package org.store.clothstar.order.service.OrderSave; | ||
|
||
import org.springframework.stereotype.Service; | ||
import org.store.clothstar.order.domain.Order; | ||
import org.store.clothstar.order.domain.OrderDetail; | ||
|
||
@Service | ||
public class OrderDetailAdderImpl implements OrderDetailAdder { | ||
@Override | ||
public void addOrderDetail(Order order, OrderDetail orderDetail) { | ||
order.addOrderDetail(orderDetail); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/org/store/clothstar/order/service/OrderSave/OrderDetailCreator.java
This file contains 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,11 @@ | ||
package org.store.clothstar.order.service.OrderSave; | ||
|
||
import org.store.clothstar.order.domain.Order; | ||
import org.store.clothstar.order.domain.OrderDetail; | ||
import org.store.clothstar.order.dto.request.CreateOrderDetailRequest; | ||
import org.store.clothstar.product.entity.ProductEntity; | ||
import org.store.clothstar.productLine.entity.ProductLineEntity; | ||
|
||
public interface OrderDetailCreator { | ||
OrderDetail createOrderDetail(CreateOrderDetailRequest createOrderDetailRequest, Order order, ProductLineEntity productLineEntity, ProductEntity productEntity); | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/org/store/clothstar/order/service/OrderSave/OrderDetailCreatorImpl.java
This file contains 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,16 @@ | ||
package org.store.clothstar.order.service.OrderSave; | ||
|
||
import org.springframework.stereotype.Service; | ||
import org.store.clothstar.order.domain.Order; | ||
import org.store.clothstar.order.domain.OrderDetail; | ||
import org.store.clothstar.order.dto.request.CreateOrderDetailRequest; | ||
import org.store.clothstar.product.entity.ProductEntity; | ||
import org.store.clothstar.productLine.entity.ProductLineEntity; | ||
|
||
@Service | ||
public class OrderDetailCreatorImpl implements OrderDetailCreator { | ||
@Override | ||
public OrderDetail createOrderDetail(CreateOrderDetailRequest createOrderDetailRequest, Order order, ProductLineEntity productLineEntity, ProductEntity productEntity) { | ||
return createOrderDetailRequest.toOrderDetail(order, productLineEntity, productEntity); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/org/store/clothstar/order/service/OrderSave/OrderDetailValidator.java
This file contains 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,8 @@ | ||
package org.store.clothstar.order.service.OrderSave; | ||
|
||
import org.store.clothstar.order.dto.request.CreateOrderDetailRequest; | ||
import org.store.clothstar.product.entity.ProductEntity; | ||
|
||
public interface OrderDetailValidator { | ||
void validateOrderDetail(CreateOrderDetailRequest request, ProductEntity product); | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/org/store/clothstar/order/service/OrderSave/OrderDetailValidatorImpl.java
This file contains 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,17 @@ | ||
package org.store.clothstar.order.service.OrderSave; | ||
|
||
import org.springframework.http.HttpStatus; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.web.server.ResponseStatusException; | ||
import org.store.clothstar.order.dto.request.CreateOrderDetailRequest; | ||
import org.store.clothstar.product.entity.ProductEntity; | ||
|
||
@Service | ||
public class OrderDetailValidatorImpl implements OrderDetailValidator{ | ||
@Override | ||
public void validateOrderDetail(CreateOrderDetailRequest request, ProductEntity product) { | ||
if (request.getQuantity() > product.getStock()) { | ||
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "주문 개수가 재고보다 더 많습니다."); | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/org/store/clothstar/order/service/OrderSave/OrderPriceUpdater.java
This file contains 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,8 @@ | ||
package org.store.clothstar.order.service.OrderSave; | ||
|
||
import org.store.clothstar.order.domain.Order; | ||
import org.store.clothstar.order.domain.OrderDetail; | ||
|
||
public interface OrderPriceUpdater { | ||
void updateOrderPrice(Order order, OrderDetail orderDetail); | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/org/store/clothstar/order/service/OrderSave/OrderPriceUpdaterImpl.java
This file contains 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,17 @@ | ||
package org.store.clothstar.order.service.OrderSave; | ||
|
||
import org.springframework.stereotype.Service; | ||
import org.store.clothstar.order.domain.Order; | ||
import org.store.clothstar.order.domain.OrderDetail; | ||
|
||
@Service | ||
public class OrderPriceUpdaterImpl implements OrderPriceUpdater { | ||
@Override | ||
public void updateOrderPrice(Order order, OrderDetail orderDetail) { | ||
int newTotalProductsPrice = order.getTotalPrice().getProducts() + orderDetail.getPrice().getOneKindTotalPrice(); | ||
int newTotalPaymentPrice = | ||
order.getTotalPrice().getProducts() + order.getTotalPrice().getShipping() + orderDetail.getPrice().getOneKindTotalPrice(); | ||
|
||
order.getTotalPrice().updatePrices(newTotalProductsPrice, newTotalPaymentPrice); | ||
} | ||
} |
Oops, something went wrong.