Commit 699e884ea10fdd8909c63fc4dff18aba5f4cc358

Authored by zhangxing
1 parent e12eecdc

[代码优化]

src/main/java/com/diligrp/xtrade/order/domain/builder/DefaultOrderCreator.java
... ... @@ -44,6 +44,14 @@ public class DefaultOrderCreator {
44 44 orderCreateDto.setOrderId(orderId);
45 45 return new DefaultOrderCreator(saccountDto, orderCreateDto);
46 46 }
  47 +
  48 + public OrderDo createOrder() {
  49 + return getOrderDo();
  50 + }
  51 +
  52 + public List<OrderItemDo> createOrderItems() {
  53 + return getItems();
  54 + }
47 55  
48 56 /**
49 57 * 构建初始订单数据 TODO need modify because of change
... ...
src/main/java/com/diligrp/xtrade/order/service/impl/OrderServiceImpl.java
... ... @@ -49,6 +49,7 @@ public class OrderServiceImpl implements OrderService {
49 49  
50 50 DefaultOrderCreator orderCreator = DefaultOrderCreator.builder(saccountDto, orderCreateDto, getOrderKey());
51 51  
  52 + //初始化订单基本信息
52 53 orderCreator.initializeOrderBaseData();
53 54  
54 55 for (OrderItemDto orderItemDto : orderCreateDto.getItems()) {
... ... @@ -56,9 +57,9 @@ public class OrderServiceImpl implements OrderService {
56 57 orderCreator.initializeItemData(getOrderItemKey(), orderItemDto);
57 58 }
58 59  
59   - orderItemDao.insertBatch(orderCreator.getItems());
  60 + orderItemDao.insertBatch(orderCreator.createOrderItems());
60 61  
61   - orderDao.insertEntity(orderCreator.getOrderDo());
  62 + orderDao.insertEntity(orderCreator.createOrder());
62 63 }
63 64  
64 65 // TODO need modify because of change
... ...