Commit eb6a12531e1f64e095588901e9cf3c4da921a7dc
1 parent
eee70062
详情调整
Showing
3 changed files
with
18 additions
and
7 deletions
src/main/java/com/diligrp/xtrade/order/domain/builder/DefaultOrderCreator.java
... | ... | @@ -33,10 +33,7 @@ public class DefaultOrderCreator { |
33 | 33 | |
34 | 34 | private OrderCreateRequestDto orderCreateDto; |
35 | 35 | |
36 | - public DefaultOrderCreator() { | |
37 | - } | |
38 | - | |
39 | - public DefaultOrderCreator(AccountDto saccountDto, OrderCreateRequestDto orderCreateDto) { | |
36 | + private DefaultOrderCreator(AccountDto saccountDto, OrderCreateRequestDto orderCreateDto) { | |
40 | 37 | this.saccountDto = saccountDto; |
41 | 38 | this.orderCreateDto = orderCreateDto; |
42 | 39 | } | ... | ... |
src/main/java/com/diligrp/xtrade/order/domain/builder/OrderDataBuilder.java
... | ... | @@ -2,6 +2,9 @@ package com.diligrp.xtrade.order.domain.builder; |
2 | 2 | |
3 | 3 | import java.util.List; |
4 | 4 | |
5 | +import org.springframework.beans.BeanUtils; | |
6 | + | |
7 | +import com.diligrp.xtrade.order.domain.dto.OrderItemDto; | |
5 | 8 | import com.diligrp.xtrade.order.domain.dto.OrderQueryResponseDto; |
6 | 9 | import com.diligrp.xtrade.order.domain.entity.OrderDo; |
7 | 10 | import com.diligrp.xtrade.order.domain.entity.OrderItemDo; |
... | ... | @@ -19,8 +22,14 @@ public class OrderDataBuilder { |
19 | 22 | * 构建基本的订单详情数据 TODO need modify because of change |
20 | 23 | */ |
21 | 24 | public static OrderQueryResponseDto buildOrderDetail(OrderDo order, List<OrderItemDo> orderItem) { |
22 | - OrderQueryResponseDto orderQueryResponseDto = new OrderQueryResponseDto(); | |
23 | - return orderQueryResponseDto; | |
25 | + OrderQueryResponseDto orderResponseDto = new OrderQueryResponseDto(); | |
26 | + BeanUtils.copyProperties(order, orderResponseDto); | |
27 | + for (OrderItemDo orderItemDo : orderItem) { | |
28 | + OrderItemDto orderItemDto = new OrderItemDto(); | |
29 | + BeanUtils.copyProperties(orderItemDo, orderItemDto); | |
30 | + orderResponseDto.addItems(orderItemDto); | |
31 | + } | |
32 | + return orderResponseDto; | |
24 | 33 | } |
25 | 34 | |
26 | 35 | } | ... | ... |
src/main/java/com/diligrp/xtrade/order/domain/dto/OrderQueryResponseDto.java
1 | 1 | package com.diligrp.xtrade.order.domain.dto; |
2 | 2 | |
3 | 3 | import java.time.LocalDateTime; |
4 | +import java.util.ArrayList; | |
4 | 5 | import java.util.List; |
5 | 6 | |
6 | 7 | /** |
... | ... | @@ -82,7 +83,11 @@ public class OrderQueryResponseDto { |
82 | 83 | private LocalDateTime payTime; |
83 | 84 | |
84 | 85 | //订单详情 |
85 | - private List<OrderItemDto> items; | |
86 | + private List<OrderItemDto> items = new ArrayList<OrderItemDto>(); | |
87 | + | |
88 | + public void addItems(OrderItemDto item) { | |
89 | + items.add(item); | |
90 | + } | |
86 | 91 | |
87 | 92 | public Long getOrderId() { |
88 | 93 | return orderId; | ... | ... |