b4c2c689 刘嘉

菠萝派接口-订单下载

1 个父辈 3564641c
......@@ -75,7 +75,7 @@ public interface PineappleDao {
* @param params
* @return
*/
List<OrderResponse> getOrdersList(Map<String,Object> params);
List<Orders> getOrdersList(Map<String,Object> params);
/**
* 子订单查询
......
......@@ -37,6 +37,9 @@
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="province" column="regionName1" />
<result property="city" column="regionName2" />
<result property="area" column="regionName3" />
</resultMap>
<!-- 根据订单号查询订单信息 只查询不是主订单的订单 -->
......@@ -158,7 +161,7 @@
<!-- 下载订单实体-->
<resultMap id="orderResponse" type="com.sibu.orderHelper.integral.pineapple.response.OrderResponse">
<!-- <resultMap id="orderResponse" type="com.sibu.orderHelper.integral.pineapple.response.OrderResponse">
<result property="platOrderNo" column="order_sn" />
<result property="tradeStatus" column="order_state" />
<result property="tradeStatusDescription" column="remark" />
......@@ -175,7 +178,7 @@
<result property="goodsFee" column="money_product" />
<result property="payTime" column="pay_time" />
<result property="nick" column="member_name" />
</resultMap>
</resultMap>-->
<!-- 主订单下载-->
......
package com.sibu.orderHelper.integral.pineapple.constant;
import com.sibu.orderHelper.enums.PayOrderStatus;
import com.sibu.orderHelper.integral.pineapple.enums.EJavaShopOrderStateEnum;
import java.util.Arrays;
import java.util.List;
......@@ -19,45 +20,44 @@ public class PineAppleConst {
/**
* 菠萝派对应商城【等待买家付款】状态
*/
public static final List<Integer> MALL_WAIT_BUYER_PAY_ORDER_STATUS = Arrays.asList(PayOrderStatus.WaitPay.getCode());
public static final List<Integer> MALL_WAIT_BUYER_PAY_ORDER_STATUS = Arrays.asList(EJavaShopOrderStateEnum.WaitPay.getCode());
/**
* 菠萝派对应商城【等待卖家发货】状态
*/
public static final List<Integer> MALL_WAIT_SELLER_DELIVER_ORDER_STATUS = Arrays.asList(PayOrderStatus.WaitShip.getCode());
public static final List<Integer> MALL_WAIT_SELLER_DELIVER_ORDER_STATUS = Arrays.asList(EJavaShopOrderStateEnum.WaitConfirmed.getCode(),EJavaShopOrderStateEnum.WaitShip.getCode());
/**
* 菠萝派对应商城【等待买家确认收货】状态
*/
public static final List<Integer> MALL_WAIT_BUYER_RECEIVED_ORDER_STATUS = Arrays.asList(PayOrderStatus.HasReceived.getCode());
public static final List<Integer> MALL_WAIT_BUYER_RECEIVED_ORDER_STATUS = Arrays.asList(EJavaShopOrderStateEnum.HasReceived.getCode());
/**
* 菠萝派对应商城【交易完成】状态
*/
public static final List<Integer> MALL_TRANSACTION_FINISHED_ORDER_STATUS = Arrays.asList(PayOrderStatus.HasDelive.getCode(), PayOrderStatus.Finished.getCode());
public static final List<Integer> MALL_TRANSACTION_FINISHED_ORDER_STATUS = Arrays.asList(EJavaShopOrderStateEnum.Finished.getCode());
/**
* 菠萝派对应商城【交易关闭】状态
*/
public static final List<Integer> MALL_TRANSACTION_CLOSED_ORDER_STATUS = Arrays.asList(PayOrderStatus.RefundFail.getCode());
public static final List<Integer> MALL_TRANSACTION_CLOSED_ORDER_STATUS = Arrays.asList(EJavaShopOrderStateEnum.RefundFail.getCode());
/**
* 菠萝派对应商城【所有订单】
*/
public static final List<Integer> MALL_ALL_ORDER = Arrays.asList(
PayOrderStatus.WaitPay.getCode(),
PayOrderStatus.WaitShip.getCode(),
PayOrderStatus.HasReceived.getCode(),
PayOrderStatus.HasDelive.getCode(),
PayOrderStatus.Finished.getCode(),
PayOrderStatus.RefundFail.getCode()
EJavaShopOrderStateEnum.WaitPay.getCode(),
EJavaShopOrderStateEnum.WaitConfirmed.getCode(),
EJavaShopOrderStateEnum.WaitShip.getCode(),
EJavaShopOrderStateEnum.HasReceived.getCode(),
EJavaShopOrderStateEnum.Finished.getCode(),
EJavaShopOrderStateEnum.RefundFail.getCode()
);
/**
* 菠萝派对应商城【未知】状态订单
*/
public static final List<Integer> MALL_UNKNOWN_ORDER_STATUS = Arrays.asList(
PayOrderStatus.WaitPay.getCode(),
PayOrderStatus.WaitShip.getCode(),
PayOrderStatus.HasReceived.getCode(),
PayOrderStatus.HasDelive.getCode(),
PayOrderStatus.Finished.getCode(),
PayOrderStatus.RefundFail.getCode()
EJavaShopOrderStateEnum.WaitPay.getCode(),
EJavaShopOrderStateEnum.WaitConfirmed.getCode(),
EJavaShopOrderStateEnum.WaitShip.getCode(),
EJavaShopOrderStateEnum.HasReceived.getCode(),
EJavaShopOrderStateEnum.Finished.getCode(),
EJavaShopOrderStateEnum.RefundFail.getCode()
);
}
......
......@@ -22,7 +22,7 @@ public class Orders {
private Integer memberId;
private String memberName;
private Integer orderState;
private Date payTime;
private String payTime;
private Integer paymentStatus;
private Integer invoiceStatus;
private String invoiceTitle;
......@@ -54,8 +54,8 @@ public class Orders {
private String email;
private String zipCode;
private String remark;
private Date deliverTime;
private Date finishTime;
private String deliverTime;
private String finishTime;
private String tradeSn;
private Integer source;
private Integer logisticsId;
......@@ -64,11 +64,11 @@ public class Orders {
private Integer isCodconfim;
private Integer codconfirmId;
private String codconfirmName;
private Date codconfirmTime;
private String codconfirmTime;
private String codconfirmRemark;
private Integer codconfirmState;
private Date createTime;
private Date DateupdateTime;
private String createTime;
private String DateupdateTime;
private Integer evaluateState;
private String regionName1;
private String regionName2;
......
......@@ -10,6 +10,7 @@ import com.sibu.orderHelper.integral.model.IMDoingOrderBean;
import com.sibu.orderHelper.integral.model.IMProductBean;
import com.sibu.orderHelper.integral.model.IMSupplier;
import com.sibu.orderHelper.integral.pineapple.constant.PineAppleConst;
import com.sibu.orderHelper.integral.pineapple.enums.OrderStatusEnum;
import com.sibu.orderHelper.integral.pineapple.exception.BizException;
import com.sibu.orderHelper.integral.pineapple.model.Orders;
import com.sibu.orderHelper.integral.pineapple.model.OrdersProduct;
......@@ -18,6 +19,7 @@ import com.sibu.orderHelper.integral.pineapple.request.CallRequest;
import com.sibu.orderHelper.integral.pineapple.request.GetOrderRequest;
import com.sibu.orderHelper.integral.pineapple.response.BaseResponse;
import com.sibu.orderHelper.integral.pineapple.response.GetOrderResponse;
import com.sibu.orderHelper.integral.pineapple.response.OrderGoodResponse;
import com.sibu.orderHelper.integral.pineapple.response.OrderResponse;
import com.sibu.orderHelper.integral.reponse.DoingOrder1DetailResponse;
import com.sibu.orderHelper.integral.reponse.DoingOrderDetailResponse;
......@@ -32,6 +34,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.xml.bind.ValidationException;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
......@@ -73,7 +76,7 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
}
params.put("PageIndex",(callRequest.getBizModel().getPageIndex() - 1) * callRequest.getBizModel().getPageSize());
params.put("PageSize",callRequest.getBizModel().getPageSize());
List<OrderResponse> ordersList = pineappleDao.getOrdersList(params);
List<Orders> ordersList = pineappleDao.getOrdersList(params);
GetOrderResponse response = new GetOrderResponse();
response.setNumTotalOrder(ordersList.size());
response.setOrders(null);
......@@ -81,29 +84,88 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
return response;
}
private List<OrderResponse> findOrders(List<OrderResponse> ordersList){
List<OrderResponse> orders = new ArrayList<>();
private List<OrderResponse> findOrders(List<Orders> ordersList){
List<OrderResponse> orderResponseList = new ArrayList<>();
if(!StringUtil.isNull(ordersList) && !ordersList.isEmpty()){
ordersList.stream().forEach(o ->{
OrderResponse orderResponse = new OrderResponse();
OrderResponse orderResponse = this.getOrderResponse(o);
try {
pineappleDao.getOrdersProductList(o.getPayOrderNo());
List<OrdersProduct> ordersProductList = pineappleDao.getOrdersProductList(o.getOrderSn());
if(StringUtil.isNull(null)){
throw new BizException(String.format("获取子订单数据业务异常[%s]",(o.getPayOrderNo())));
throw new BizException(String.format("获取子订单数据业务异常[%s]",(o.getOrderSn())));
}
//orderResponse.setGoodInfos(orderProductList);
orders.add(orderResponse);
List<OrderGoodResponse> goodInfos = new ArrayList<>();
ordersProductList.stream().forEach(p ->{
OrderGoodResponse orderGoodResponse = this.getOrderGoodResponse(p);
goodInfos.add(orderGoodResponse);
});
orderResponse.setGoodInfos(goodInfos);
orderResponseList.add(orderResponse);
} catch (Exception e) {
log.error("获取订单数据业务异常", e);
throw new BizException("获取订单数据业务异常", e);
}
});
}
return orders;
return orderResponseList;
}
/**
* 主订单数据
* @param orders
* @return
*/
private OrderResponse getOrderResponse(Orders orders){
OrderStatusEnum orderStatusEnum = this.convertAndCheckOrderStatusEnum(orders);
OrderResponse orderResponse = new OrderResponse();
orderResponse.setTradeStatus(orderStatusEnum.getCode());
orderResponse.setTradeStatusDescription(orderStatusEnum.getMsg());
orderResponse.setPlatOrderNo(orders.getOrderSn());
orderResponse.setTradeStatus(orders.getOrderState().toString());
orderResponse.setTradeStatusDescription(orders.getRemark());
orderResponse.setTradeTime(orders.getCreateTime());
orderResponse.setCountry("中国");
orderResponse.setProvince(orders.getRegionName1());
orderResponse.setCity(orders.getRegionName2());
orderResponse.setArea(orders.getRegionName3());
orderResponse.setAddress(orders.getAddressInfo());
orderResponse.setPhone(orders.getMobile());
orderResponse.setMobile(orders.getMobile());
orderResponse.setPostFee(orders.getMoneyLogistics().toString());
orderResponse.setGoodsFee(orders.getMoneyProduct().toString());
orderResponse.setTotalMoney(orders.getMoneyOrder().toString());
orderResponse.setPayTime(orders.getPayTime());
orderResponse.setShouldPayType("银行收款");
return orderResponse;
}
/**
* 子订单数据
* @param ordersProduct
* @return
*/
private OrderGoodResponse getOrderGoodResponse(OrdersProduct ordersProduct){
OrderGoodResponse orderGoodResponse = new OrderGoodResponse();
orderGoodResponse.setProductId(ordersProduct.getProductSku());
orderGoodResponse.setSubOrderNo(String.valueOf(ordersProduct.getId()));
orderGoodResponse.setTradeGoodsNo(ordersProduct.getProductSku());
orderGoodResponse.setTradeGoodsName(ordersProduct.getProductName());
orderGoodResponse.setTradeGoodsSpec(ordersProduct.getSpecInfo());
orderGoodResponse.setGoodsCount(String.valueOf(ordersProduct.getNumber()));
orderGoodResponse.setPrice(String.valueOf(ordersProduct.getMoneyPrice()));
orderGoodResponse.setDiscountMoney(String.valueOf(ordersProduct.getMoneyActSingle()));
return null;
}
private OrderStatusEnum convertAndCheckOrderStatusEnum(Orders orders) {
OrderStatusEnum orderStatusEnum = OrderStatusEnum.resolveByPlatformOrderStatus(orders.getOrderState());
if (orderStatusEnum.equals(OrderStatusEnum.UNKNOWN) || orderStatusEnum.equals(OrderStatusEnum.ALL_ORDER)) {
throw new BizException(MessageFormat.format("订单状态【{0}】转换失败,", orders.getOrderState()));
}
return orderStatusEnum;
}
@Override
public String getHandleMethodName() {
return "Differ.JH.Business.GetOrder";
......