Commit d53e2b234a78a83401ca410c60d31977b5924bdf

Authored by zhangxing
1 parent 22e8f6ef

订单默认创建者更改

src/main/java/com/diligrp/xtrade/order/domain/builder/DefaultOrderCreator.java
... ... @@ -29,6 +29,8 @@ public class DefaultOrderCreator {
29 29  
30 30 private AccountDto saccountDto;
31 31  
  32 + private AccountDto baccountDto;
  33 +
32 34 private OrderCreateRequestDto orderCreateDto;
33 35  
34 36 public DefaultOrderCreator() {
... ... @@ -56,17 +58,18 @@ public class DefaultOrderCreator {
56 58 * 构建初始订单数据 TODO need modify because of change
57 59 */
58 60 public void initializeOrderBaseData() {
59   - OrderDo orderDo = new OrderDo();
60   - orderDo.setOrderId(orderCreateDto.getOrderId());
61   - orderDo.setBaccount(saccountDto.getAccountId());
62   - orderDo.setSname(saccountDto.getAccountName());
63   - orderDo.setSmobile(saccountDto.getMobile());
64   - orderDo.setScardType(saccountDto.getType());
65   - orderDo.setCreatedSrc(orderCreateDto.getCreatedSrc());
66   - orderDo.setOrderType(OrderType.NORMAL.getCode());
67   - orderDo.setTradeType(TradeType.NORMAL.getCode());
68   - orderDo.setMarketCode("SYDEV");
69   - this.orderDo = orderDo;
  61 +
  62 + //基本信息
  63 + buildBaseInfo();
  64 +
  65 + //卖家信息
  66 + buildSeller();
  67 +
  68 + //买家信息
  69 + if (isBuildBuyerInfo()) {
  70 + buildBuyer();
  71 + }
  72 +
70 73 }
71 74  
72 75 /**
... ... @@ -104,5 +107,40 @@ public class DefaultOrderCreator {
104 107 BigDecimal.valueOf(orderDo.getWeight()).add(BigDecimal.valueOf(orderItemDo.getWeight())).doubleValue());
105 108 items.add(orderItemDo);
106 109 }
  110 +
  111 + public boolean isBuildBuyerInfo() {
  112 + return orderCreateDto.getBaccount() == null ? false : true;
  113 + }
  114 +
  115 + /**
  116 + * 构建卖家信息
  117 + */
  118 + public void buildSeller() {
  119 + orderDo.setSaccount(saccountDto.getAccountId());
  120 + orderDo.setSname(saccountDto.getAccountName());
  121 + orderDo.setSmobile(saccountDto.getMobile());
  122 + orderDo.setScardType(saccountDto.getType());
  123 + }
  124 +
  125 + /**
  126 + * 构建买家信息
  127 + */
  128 + public void buildBuyer() {
  129 + orderDo.setBaccount(baccountDto.getAccountId());
  130 + orderDo.setBname(baccountDto.getAccountName());
  131 + orderDo.setBmobile(baccountDto.getMobile());
  132 + orderDo.setBcardType(baccountDto.getType());
  133 + }
  134 +
  135 + /**
  136 + * 构建基本信息
  137 + */
  138 + public void buildBaseInfo() {
  139 + orderDo.setOrderId(orderCreateDto.getOrderId());
  140 + orderDo.setOrderType(OrderType.NORMAL.getCode());
  141 + orderDo.setTradeType(TradeType.NORMAL.getCode());
  142 + orderDo.setMarketCode("SYDEV");
  143 + }
  144 +
107 145  
108 146 }
... ...