b4c2c689 刘嘉

菠萝派接口-订单下载

1 个父辈 3564641c
...@@ -75,7 +75,7 @@ public interface PineappleDao { ...@@ -75,7 +75,7 @@ public interface PineappleDao {
75 * @param params 75 * @param params
76 * @return 76 * @return
77 */ 77 */
78 List<OrderResponse> getOrdersList(Map<String,Object> params); 78 List<Orders> getOrdersList(Map<String,Object> params);
79 79
80 /** 80 /**
81 * 子订单查询 81 * 子订单查询
......
...@@ -37,6 +37,9 @@ ...@@ -37,6 +37,9 @@
37 <result property="remark" column="remark" /> 37 <result property="remark" column="remark" />
38 <result property="createTime" column="create_time" /> 38 <result property="createTime" column="create_time" />
39 <result property="updateTime" column="update_time" /> 39 <result property="updateTime" column="update_time" />
40 <result property="province" column="regionName1" />
41 <result property="city" column="regionName2" />
42 <result property="area" column="regionName3" />
40 </resultMap> 43 </resultMap>
41 44
42 <!-- 根据订单号查询订单信息 只查询不是主订单的订单 --> 45 <!-- 根据订单号查询订单信息 只查询不是主订单的订单 -->
...@@ -158,7 +161,7 @@ ...@@ -158,7 +161,7 @@
158 161
159 162
160 <!-- 下载订单实体--> 163 <!-- 下载订单实体-->
161 <resultMap id="orderResponse" type="com.sibu.orderHelper.integral.pineapple.response.OrderResponse"> 164 <!-- <resultMap id="orderResponse" type="com.sibu.orderHelper.integral.pineapple.response.OrderResponse">
162 <result property="platOrderNo" column="order_sn" /> 165 <result property="platOrderNo" column="order_sn" />
163 <result property="tradeStatus" column="order_state" /> 166 <result property="tradeStatus" column="order_state" />
164 <result property="tradeStatusDescription" column="remark" /> 167 <result property="tradeStatusDescription" column="remark" />
...@@ -175,7 +178,7 @@ ...@@ -175,7 +178,7 @@
175 <result property="goodsFee" column="money_product" /> 178 <result property="goodsFee" column="money_product" />
176 <result property="payTime" column="pay_time" /> 179 <result property="payTime" column="pay_time" />
177 <result property="nick" column="member_name" /> 180 <result property="nick" column="member_name" />
178 </resultMap> 181 </resultMap>-->
179 182
180 183
181 <!-- 主订单下载--> 184 <!-- 主订单下载-->
......
1 package com.sibu.orderHelper.integral.pineapple.constant; 1 package com.sibu.orderHelper.integral.pineapple.constant;
2 2
3 import com.sibu.orderHelper.enums.PayOrderStatus; 3 import com.sibu.orderHelper.enums.PayOrderStatus;
4 import com.sibu.orderHelper.integral.pineapple.enums.EJavaShopOrderStateEnum;
4 5
5 import java.util.Arrays; 6 import java.util.Arrays;
6 import java.util.List; 7 import java.util.List;
...@@ -19,45 +20,44 @@ public class PineAppleConst { ...@@ -19,45 +20,44 @@ public class PineAppleConst {
19 /** 20 /**
20 * 菠萝派对应商城【等待买家付款】状态 21 * 菠萝派对应商城【等待买家付款】状态
21 */ 22 */
22 public static final List<Integer> MALL_WAIT_BUYER_PAY_ORDER_STATUS = Arrays.asList(PayOrderStatus.WaitPay.getCode()); 23 public static final List<Integer> MALL_WAIT_BUYER_PAY_ORDER_STATUS = Arrays.asList(EJavaShopOrderStateEnum.WaitPay.getCode());
23 /** 24 /**
24 * 菠萝派对应商城【等待卖家发货】状态 25 * 菠萝派对应商城【等待卖家发货】状态
25 */ 26 */
26 public static final List<Integer> MALL_WAIT_SELLER_DELIVER_ORDER_STATUS = Arrays.asList(PayOrderStatus.WaitShip.getCode()); 27 public static final List<Integer> MALL_WAIT_SELLER_DELIVER_ORDER_STATUS = Arrays.asList(EJavaShopOrderStateEnum.WaitConfirmed.getCode(),EJavaShopOrderStateEnum.WaitShip.getCode());
27 /** 28 /**
28 * 菠萝派对应商城【等待买家确认收货】状态 29 * 菠萝派对应商城【等待买家确认收货】状态
29 */ 30 */
30 public static final List<Integer> MALL_WAIT_BUYER_RECEIVED_ORDER_STATUS = Arrays.asList(PayOrderStatus.HasReceived.getCode()); 31 public static final List<Integer> MALL_WAIT_BUYER_RECEIVED_ORDER_STATUS = Arrays.asList(EJavaShopOrderStateEnum.HasReceived.getCode());
31 /** 32 /**
32 * 菠萝派对应商城【交易完成】状态 33 * 菠萝派对应商城【交易完成】状态
33 */ 34 */
34 public static final List<Integer> MALL_TRANSACTION_FINISHED_ORDER_STATUS = Arrays.asList(PayOrderStatus.HasDelive.getCode(), PayOrderStatus.Finished.getCode()); 35 public static final List<Integer> MALL_TRANSACTION_FINISHED_ORDER_STATUS = Arrays.asList(EJavaShopOrderStateEnum.Finished.getCode());
35 /** 36 /**
36 * 菠萝派对应商城【交易关闭】状态 37 * 菠萝派对应商城【交易关闭】状态
37 */ 38 */
38 public static final List<Integer> MALL_TRANSACTION_CLOSED_ORDER_STATUS = Arrays.asList(PayOrderStatus.RefundFail.getCode()); 39 public static final List<Integer> MALL_TRANSACTION_CLOSED_ORDER_STATUS = Arrays.asList(EJavaShopOrderStateEnum.RefundFail.getCode());
39 /** 40 /**
40 * 菠萝派对应商城【所有订单】 41 * 菠萝派对应商城【所有订单】
41 */ 42 */
42 public static final List<Integer> MALL_ALL_ORDER = Arrays.asList( 43 public static final List<Integer> MALL_ALL_ORDER = Arrays.asList(
43 PayOrderStatus.WaitPay.getCode(), 44 EJavaShopOrderStateEnum.WaitPay.getCode(),
44 PayOrderStatus.WaitShip.getCode(), 45 EJavaShopOrderStateEnum.WaitConfirmed.getCode(),
45 PayOrderStatus.HasReceived.getCode(), 46 EJavaShopOrderStateEnum.WaitShip.getCode(),
46 PayOrderStatus.HasDelive.getCode(), 47 EJavaShopOrderStateEnum.HasReceived.getCode(),
47 PayOrderStatus.Finished.getCode(), 48 EJavaShopOrderStateEnum.Finished.getCode(),
48 PayOrderStatus.RefundFail.getCode() 49 EJavaShopOrderStateEnum.RefundFail.getCode()
49
50 ); 50 );
51 51
52 /** 52 /**
53 * 菠萝派对应商城【未知】状态订单 53 * 菠萝派对应商城【未知】状态订单
54 */ 54 */
55 public static final List<Integer> MALL_UNKNOWN_ORDER_STATUS = Arrays.asList( 55 public static final List<Integer> MALL_UNKNOWN_ORDER_STATUS = Arrays.asList(
56 PayOrderStatus.WaitPay.getCode(), 56 EJavaShopOrderStateEnum.WaitPay.getCode(),
57 PayOrderStatus.WaitShip.getCode(), 57 EJavaShopOrderStateEnum.WaitConfirmed.getCode(),
58 PayOrderStatus.HasReceived.getCode(), 58 EJavaShopOrderStateEnum.WaitShip.getCode(),
59 PayOrderStatus.HasDelive.getCode(), 59 EJavaShopOrderStateEnum.HasReceived.getCode(),
60 PayOrderStatus.Finished.getCode(), 60 EJavaShopOrderStateEnum.Finished.getCode(),
61 PayOrderStatus.RefundFail.getCode() 61 EJavaShopOrderStateEnum.RefundFail.getCode()
62 ); 62 );
63 } 63 }
......
...@@ -22,7 +22,7 @@ public class Orders { ...@@ -22,7 +22,7 @@ public class Orders {
22 private Integer memberId; 22 private Integer memberId;
23 private String memberName; 23 private String memberName;
24 private Integer orderState; 24 private Integer orderState;
25 private Date payTime; 25 private String payTime;
26 private Integer paymentStatus; 26 private Integer paymentStatus;
27 private Integer invoiceStatus; 27 private Integer invoiceStatus;
28 private String invoiceTitle; 28 private String invoiceTitle;
...@@ -54,8 +54,8 @@ public class Orders { ...@@ -54,8 +54,8 @@ public class Orders {
54 private String email; 54 private String email;
55 private String zipCode; 55 private String zipCode;
56 private String remark; 56 private String remark;
57 private Date deliverTime; 57 private String deliverTime;
58 private Date finishTime; 58 private String finishTime;
59 private String tradeSn; 59 private String tradeSn;
60 private Integer source; 60 private Integer source;
61 private Integer logisticsId; 61 private Integer logisticsId;
...@@ -64,11 +64,11 @@ public class Orders { ...@@ -64,11 +64,11 @@ public class Orders {
64 private Integer isCodconfim; 64 private Integer isCodconfim;
65 private Integer codconfirmId; 65 private Integer codconfirmId;
66 private String codconfirmName; 66 private String codconfirmName;
67 private Date codconfirmTime; 67 private String codconfirmTime;
68 private String codconfirmRemark; 68 private String codconfirmRemark;
69 private Integer codconfirmState; 69 private Integer codconfirmState;
70 private Date createTime; 70 private String createTime;
71 private Date DateupdateTime; 71 private String DateupdateTime;
72 private Integer evaluateState; 72 private Integer evaluateState;
73 private String regionName1; 73 private String regionName1;
74 private String regionName2; 74 private String regionName2;
......
...@@ -10,6 +10,7 @@ import com.sibu.orderHelper.integral.model.IMDoingOrderBean; ...@@ -10,6 +10,7 @@ import com.sibu.orderHelper.integral.model.IMDoingOrderBean;
10 import com.sibu.orderHelper.integral.model.IMProductBean; 10 import com.sibu.orderHelper.integral.model.IMProductBean;
11 import com.sibu.orderHelper.integral.model.IMSupplier; 11 import com.sibu.orderHelper.integral.model.IMSupplier;
12 import com.sibu.orderHelper.integral.pineapple.constant.PineAppleConst; 12 import com.sibu.orderHelper.integral.pineapple.constant.PineAppleConst;
13 import com.sibu.orderHelper.integral.pineapple.enums.OrderStatusEnum;
13 import com.sibu.orderHelper.integral.pineapple.exception.BizException; 14 import com.sibu.orderHelper.integral.pineapple.exception.BizException;
14 import com.sibu.orderHelper.integral.pineapple.model.Orders; 15 import com.sibu.orderHelper.integral.pineapple.model.Orders;
15 import com.sibu.orderHelper.integral.pineapple.model.OrdersProduct; 16 import com.sibu.orderHelper.integral.pineapple.model.OrdersProduct;
...@@ -18,6 +19,7 @@ import com.sibu.orderHelper.integral.pineapple.request.CallRequest; ...@@ -18,6 +19,7 @@ import com.sibu.orderHelper.integral.pineapple.request.CallRequest;
18 import com.sibu.orderHelper.integral.pineapple.request.GetOrderRequest; 19 import com.sibu.orderHelper.integral.pineapple.request.GetOrderRequest;
19 import com.sibu.orderHelper.integral.pineapple.response.BaseResponse; 20 import com.sibu.orderHelper.integral.pineapple.response.BaseResponse;
20 import com.sibu.orderHelper.integral.pineapple.response.GetOrderResponse; 21 import com.sibu.orderHelper.integral.pineapple.response.GetOrderResponse;
22 import com.sibu.orderHelper.integral.pineapple.response.OrderGoodResponse;
21 import com.sibu.orderHelper.integral.pineapple.response.OrderResponse; 23 import com.sibu.orderHelper.integral.pineapple.response.OrderResponse;
22 import com.sibu.orderHelper.integral.reponse.DoingOrder1DetailResponse; 24 import com.sibu.orderHelper.integral.reponse.DoingOrder1DetailResponse;
23 import com.sibu.orderHelper.integral.reponse.DoingOrderDetailResponse; 25 import com.sibu.orderHelper.integral.reponse.DoingOrderDetailResponse;
...@@ -32,6 +34,7 @@ import org.springframework.stereotype.Service; ...@@ -32,6 +34,7 @@ import org.springframework.stereotype.Service;
32 34
33 import javax.annotation.Resource; 35 import javax.annotation.Resource;
34 import javax.xml.bind.ValidationException; 36 import javax.xml.bind.ValidationException;
37 import java.text.MessageFormat;
35 import java.util.ArrayList; 38 import java.util.ArrayList;
36 import java.util.HashMap; 39 import java.util.HashMap;
37 import java.util.List; 40 import java.util.List;
...@@ -73,7 +76,7 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest> ...@@ -73,7 +76,7 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
73 } 76 }
74 params.put("PageIndex",(callRequest.getBizModel().getPageIndex() - 1) * callRequest.getBizModel().getPageSize()); 77 params.put("PageIndex",(callRequest.getBizModel().getPageIndex() - 1) * callRequest.getBizModel().getPageSize());
75 params.put("PageSize",callRequest.getBizModel().getPageSize()); 78 params.put("PageSize",callRequest.getBizModel().getPageSize());
76 List<OrderResponse> ordersList = pineappleDao.getOrdersList(params); 79 List<Orders> ordersList = pineappleDao.getOrdersList(params);
77 GetOrderResponse response = new GetOrderResponse(); 80 GetOrderResponse response = new GetOrderResponse();
78 response.setNumTotalOrder(ordersList.size()); 81 response.setNumTotalOrder(ordersList.size());
79 response.setOrders(null); 82 response.setOrders(null);
...@@ -81,28 +84,87 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest> ...@@ -81,28 +84,87 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
81 return response; 84 return response;
82 } 85 }
83 86
84 private List<OrderResponse> findOrders(List<OrderResponse> ordersList){ 87 private List<OrderResponse> findOrders(List<Orders> ordersList){
85 List<OrderResponse> orders = new ArrayList<>(); 88 List<OrderResponse> orderResponseList = new ArrayList<>();
86 if(!StringUtil.isNull(ordersList) && !ordersList.isEmpty()){ 89 if(!StringUtil.isNull(ordersList) && !ordersList.isEmpty()){
87 ordersList.stream().forEach(o ->{ 90 ordersList.stream().forEach(o ->{
88 OrderResponse orderResponse = new OrderResponse(); 91 OrderResponse orderResponse = this.getOrderResponse(o);
89 try { 92 try {
90 pineappleDao.getOrdersProductList(o.getPayOrderNo()); 93 List<OrdersProduct> ordersProductList = pineappleDao.getOrdersProductList(o.getOrderSn());
91 if(StringUtil.isNull(null)){ 94 if(StringUtil.isNull(null)){
92 throw new BizException(String.format("获取子订单数据业务异常[%s]",(o.getPayOrderNo()))); 95 throw new BizException(String.format("获取子订单数据业务异常[%s]",(o.getOrderSn())));
93 } 96 }
94 //orderResponse.setGoodInfos(orderProductList); 97 List<OrderGoodResponse> goodInfos = new ArrayList<>();
95 orders.add(orderResponse); 98 ordersProductList.stream().forEach(p ->{
99 OrderGoodResponse orderGoodResponse = this.getOrderGoodResponse(p);
100 goodInfos.add(orderGoodResponse);
101 });
102 orderResponse.setGoodInfos(goodInfos);
103 orderResponseList.add(orderResponse);
96 } catch (Exception e) { 104 } catch (Exception e) {
97 log.error("获取订单数据业务异常", e); 105 log.error("获取订单数据业务异常", e);
98 throw new BizException("获取订单数据业务异常", e); 106 throw new BizException("获取订单数据业务异常", e);
99 } 107 }
100 }); 108 });
101 } 109 }
102 return orders; 110 return orderResponseList;
103 } 111 }
104 112
113 /**
114 * 主订单数据
115 * @param orders
116 * @return
117 */
118 private OrderResponse getOrderResponse(Orders orders){
119 OrderStatusEnum orderStatusEnum = this.convertAndCheckOrderStatusEnum(orders);
120 OrderResponse orderResponse = new OrderResponse();
121 orderResponse.setTradeStatus(orderStatusEnum.getCode());
122 orderResponse.setTradeStatusDescription(orderStatusEnum.getMsg());
123 orderResponse.setPlatOrderNo(orders.getOrderSn());
124 orderResponse.setTradeStatus(orders.getOrderState().toString());
125 orderResponse.setTradeStatusDescription(orders.getRemark());
126 orderResponse.setTradeTime(orders.getCreateTime());
127 orderResponse.setCountry("中国");
128 orderResponse.setProvince(orders.getRegionName1());
129 orderResponse.setCity(orders.getRegionName2());
130 orderResponse.setArea(orders.getRegionName3());
131 orderResponse.setAddress(orders.getAddressInfo());
132 orderResponse.setPhone(orders.getMobile());
133 orderResponse.setMobile(orders.getMobile());
134 orderResponse.setPostFee(orders.getMoneyLogistics().toString());
135 orderResponse.setGoodsFee(orders.getMoneyProduct().toString());
136 orderResponse.setTotalMoney(orders.getMoneyOrder().toString());
137 orderResponse.setPayTime(orders.getPayTime());
138 orderResponse.setShouldPayType("银行收款");
139 return orderResponse;
140 }
105 141
142 /**
143 * 子订单数据
144 * @param ordersProduct
145 * @return
146 */
147 private OrderGoodResponse getOrderGoodResponse(OrdersProduct ordersProduct){
148 OrderGoodResponse orderGoodResponse = new OrderGoodResponse();
149 orderGoodResponse.setProductId(ordersProduct.getProductSku());
150 orderGoodResponse.setSubOrderNo(String.valueOf(ordersProduct.getId()));
151 orderGoodResponse.setTradeGoodsNo(ordersProduct.getProductSku());
152 orderGoodResponse.setTradeGoodsName(ordersProduct.getProductName());
153 orderGoodResponse.setTradeGoodsSpec(ordersProduct.getSpecInfo());
154 orderGoodResponse.setGoodsCount(String.valueOf(ordersProduct.getNumber()));
155 orderGoodResponse.setPrice(String.valueOf(ordersProduct.getMoneyPrice()));
156 orderGoodResponse.setDiscountMoney(String.valueOf(ordersProduct.getMoneyActSingle()));
157 return null;
158 }
159
160
161 private OrderStatusEnum convertAndCheckOrderStatusEnum(Orders orders) {
162 OrderStatusEnum orderStatusEnum = OrderStatusEnum.resolveByPlatformOrderStatus(orders.getOrderState());
163 if (orderStatusEnum.equals(OrderStatusEnum.UNKNOWN) || orderStatusEnum.equals(OrderStatusEnum.ALL_ORDER)) {
164 throw new BizException(MessageFormat.format("订单状态【{0}】转换失败,", orders.getOrderState()));
165 }
166 return orderStatusEnum;
167 }
106 168
107 @Override 169 @Override
108 public String getHandleMethodName() { 170 public String getHandleMethodName() {
......