e63fbe2f 刘嘉

菠萝派接口- 订单下载接口数据格式化

1 个父辈 7e1707c7
...@@ -34,7 +34,9 @@ import org.springframework.stereotype.Service; ...@@ -34,7 +34,9 @@ import org.springframework.stereotype.Service;
34 34
35 import javax.annotation.Resource; 35 import javax.annotation.Resource;
36 import javax.xml.bind.ValidationException; 36 import javax.xml.bind.ValidationException;
37 import java.math.BigDecimal;
37 import java.text.MessageFormat; 38 import java.text.MessageFormat;
39 import java.text.SimpleDateFormat;
38 import java.util.ArrayList; 40 import java.util.ArrayList;
39 import java.util.HashMap; 41 import java.util.HashMap;
40 import java.util.List; 42 import java.util.List;
...@@ -79,7 +81,7 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest> ...@@ -79,7 +81,7 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
79 List<Orders> ordersList = pineappleDao.getOrdersList(params); 81 List<Orders> ordersList = pineappleDao.getOrdersList(params);
80 GetOrderResponse response = new GetOrderResponse(); 82 GetOrderResponse response = new GetOrderResponse();
81 response.setNumTotalOrder(ordersList.size()); 83 response.setNumTotalOrder(ordersList.size());
82 response.setOrders(null); 84 response.setOrders(findOrders(ordersList));
83 response.setCode(PineAppleConst.SUCCESS_CODE); 85 response.setCode(PineAppleConst.SUCCESS_CODE);
84 return response; 86 return response;
85 } 87 }
...@@ -121,9 +123,8 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest> ...@@ -121,9 +123,8 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
121 orderResponse.setTradeStatus(orderStatusEnum.getCode()); 123 orderResponse.setTradeStatus(orderStatusEnum.getCode());
122 orderResponse.setTradeStatusDescription(orderStatusEnum.getMsg()); 124 orderResponse.setTradeStatusDescription(orderStatusEnum.getMsg());
123 orderResponse.setPlatOrderNo(orders.getOrderSn()); 125 orderResponse.setPlatOrderNo(orders.getOrderSn());
124 orderResponse.setTradeStatus(orders.getOrderState().toString());
125 orderResponse.setTradeStatusDescription(orders.getRemark()); 126 orderResponse.setTradeStatusDescription(orders.getRemark());
126 orderResponse.setTradeTime(orders.getCreateTime()); 127 orderResponse.setTradeTime(this.buildDefaultSimpleDateFormat().format(orders.getCreateTime()));
127 orderResponse.setCountry("中国"); 128 orderResponse.setCountry("中国");
128 orderResponse.setProvince(orders.getRegionName1()); 129 orderResponse.setProvince(orders.getRegionName1());
129 orderResponse.setCity(orders.getRegionName2()); 130 orderResponse.setCity(orders.getRegionName2());
...@@ -131,11 +132,28 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest> ...@@ -131,11 +132,28 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
131 orderResponse.setAddress(orders.getAddressInfo()); 132 orderResponse.setAddress(orders.getAddressInfo());
132 orderResponse.setPhone(orders.getMobile()); 133 orderResponse.setPhone(orders.getMobile());
133 orderResponse.setMobile(orders.getMobile()); 134 orderResponse.setMobile(orders.getMobile());
134 orderResponse.setPostFee(orders.getMoneyLogistics().toString()); 135 orderResponse.setPostFee(this.convertAndCheckFreight(orders.getMoneyLogistics()));
135 orderResponse.setGoodsFee(orders.getMoneyProduct().toString()); 136 orderResponse.setGoodsFee(this.convertAndCheckFreight(orders.getMoneyProduct()));
136 orderResponse.setTotalMoney(orders.getMoneyOrder().toString()); 137 orderResponse.setTotalMoney(this.convertAndCheckFreight(orders.getMoneyOrder()));
137 orderResponse.setPayTime(orders.getPayTime()); 138 orderResponse.setPayTime(this.buildDefaultSimpleDateFormat().format(orders.getPayTime()));
138 orderResponse.setShouldPayType("银行收款"); 139 orderResponse.setShouldPayType("银行收款");
140 orderResponse.setTown("");
141 orderResponse.setTaxAmount("");
142 orderResponse.setCommissionValue("");
143 orderResponse.setTariffAmount("");
144 orderResponse.setAddedValueAmount("");
145 orderResponse.setConsumptionDutyAmount("");
146 orderResponse.setSendStyle("");
147 orderResponse.setQq("");
148 orderResponse.setEmail("");
149 orderResponse.setInvoiceTitle("");
150 orderResponse.setTaxPayerIdent("");
151 orderResponse.setCodServiceFee("");
152 orderResponse.setCurrencyCode("");
153 orderResponse.setIdCard("");
154 orderResponse.setIdCardTrueName("");
155 orderResponse.setWhseCode("");
156 orderResponse.setIsHwgFlag("");
139 return orderResponse; 157 return orderResponse;
140 } 158 }
141 159
...@@ -152,8 +170,12 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest> ...@@ -152,8 +170,12 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
152 orderGoodResponse.setTradeGoodsName(ordersProduct.getProductName()); 170 orderGoodResponse.setTradeGoodsName(ordersProduct.getProductName());
153 orderGoodResponse.setTradeGoodsSpec(ordersProduct.getSpecInfo()); 171 orderGoodResponse.setTradeGoodsSpec(ordersProduct.getSpecInfo());
154 orderGoodResponse.setGoodsCount(String.valueOf(ordersProduct.getNumber())); 172 orderGoodResponse.setGoodsCount(String.valueOf(ordersProduct.getNumber()));
155 orderGoodResponse.setPrice(String.valueOf(ordersProduct.getMoneyPrice())); 173 orderGoodResponse.setPrice(this.convertAndCheckFreight(ordersProduct.getMoneyPrice()));
156 orderGoodResponse.setDiscountMoney(String.valueOf(ordersProduct.getMoneyActSingle())); 174 orderGoodResponse.setDiscountMoney(this.convertAndCheckFreight(ordersProduct.getMoneyActSingle()));
175 orderGoodResponse.setTaxAmount("");
176 orderGoodResponse.setRefundStatus("");
177 orderGoodResponse.setStatus("");
178 orderGoodResponse.setRemark("");
157 return null; 179 return null;
158 } 180 }
159 181
...@@ -166,6 +188,15 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest> ...@@ -166,6 +188,15 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
166 return orderStatusEnum; 188 return orderStatusEnum;
167 } 189 }
168 190
191 private SimpleDateFormat buildDefaultSimpleDateFormat() {
192 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
193 return sdf;
194 }
195
196 private String convertAndCheckFreight(BigDecimal money) {
197 return money.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString();
198 }
199
169 @Override 200 @Override
170 public String getHandleMethodName() { 201 public String getHandleMethodName() {
171 return "Differ.JH.Business.GetOrder"; 202 return "Differ.JH.Business.GetOrder";
......