feat(owner-vue): 점주 서비스 주문 상태 변경 로직 추가
- 픽업완료, 픽업대기, 거절 상태에 따른 상태값 변경 이벤트 추가
This commit is contained in:
@@ -49,8 +49,7 @@ public class OrderRepositoryCustom {
|
||||
orderIdLt(condition.getLastOrderId()),
|
||||
order.orderTime.between(start, end),
|
||||
order.storeId.eq(storeId),
|
||||
order.orderStatus.ne(OrderStatus.PENDING),
|
||||
order.orderStatus.ne(OrderStatus.FAILED)
|
||||
order.orderStatus.ne(OrderStatus.PENDING)
|
||||
)
|
||||
.orderBy(order.id.desc())
|
||||
.limit(pageSize + 1)
|
||||
@@ -88,6 +87,7 @@ public class OrderRepositoryCustom {
|
||||
.leftJoin(order.transaction).fetchJoin()
|
||||
.where(
|
||||
order.orderTime.between(search.getStartDateTime(), search.getEndDateTime()),
|
||||
order.orderStatus.ne(OrderStatus.PENDING),
|
||||
order.storeId.eq(storeId)
|
||||
)
|
||||
.orderBy(order.orderTime.desc())
|
||||
@@ -105,7 +105,8 @@ public class OrderRepositoryCustom {
|
||||
.selectFrom(order)
|
||||
.leftJoin(order.transaction).fetchJoin()
|
||||
.where(
|
||||
order.userId.eq(userId)
|
||||
order.userId.eq(userId),
|
||||
order.orderStatus.ne(OrderStatus.PENDING)
|
||||
)
|
||||
.orderBy(order.orderTime.desc())
|
||||
.offset(pageable.getOffset())
|
||||
@@ -122,7 +123,7 @@ public class OrderRepositoryCustom {
|
||||
return new SliceImpl<>(contents, pageable, hasNext);
|
||||
}
|
||||
|
||||
public Optional<Order> fetchOrder(Long userId){
|
||||
public Optional<Order> fetchOrderBasket(Long userId){
|
||||
|
||||
return Optional.ofNullable(queryFactory.selectFrom(order)
|
||||
.leftJoin(order.orderItems, orderItem).fetchJoin()
|
||||
|
||||
@@ -184,7 +184,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
|
||||
@Override
|
||||
public FetchOrderDto fetchOrder(Long userId) {
|
||||
Order order = orderRepositoryCustom.fetchOrder(userId)
|
||||
Order order = orderRepositoryCustom.fetchOrderBasket(userId)
|
||||
.orElseThrow(() -> new OrderException("장바구니 정보를 찾을 수 없습니다."));
|
||||
GetStoreReseponse store = storeClient.getStore(String.valueOf(order.getStoreId())).getData();
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@ public class OrderController {
|
||||
public ResponseEntity<Result> patchOrder(@PathVariable("orderId") Long orderId,
|
||||
@RequestBody PatchOrderRequest patchOrderRequest) {
|
||||
OrderStatus orderStatus = patchOrderRequest.getOrderStatus();
|
||||
if (orderStatus != OrderStatus.PLACED && orderStatus != OrderStatus.REJECTED) {
|
||||
throw new OrderException("주문 수락, 거절 외에는 변경 불가능합니다.");
|
||||
if (orderStatus == OrderStatus.PENDING && orderStatus != OrderStatus.FAILED) {
|
||||
throw new OrderException(orderStatus.getMessage() + "는 변경 불가능합니다.");
|
||||
}
|
||||
|
||||
orderService.modifyOrder(orderId, orderStatus);
|
||||
|
||||
Reference in New Issue
Block a user