bec237c6 lauka

菠萝派接口-订单下载,更改查询语句,返回信息

1 个父辈 447edb3c
......@@ -56,6 +56,7 @@
<result property="moneyBack" column="money_back" />
<result property="moneyIntegral" column="money_integral" />
<result property="payTime" column="pay_time" />
<result property="couponMoney" column="couponMoney" />
</resultMap>
<!-- 根据订单号查询订单信息 只查询不是主订单的订单 -->
......@@ -152,7 +153,7 @@
<select id="getOrdersList" parameterType="java.util.Map" resultMap="orders">
select o.order_sn,o.order_state,o.remark,o.create_time,p.regionName AS regionName1,
c.regionName AS regionName2,a.regionName AS regionName3,
o.address_info,o.mobile,o.zip_code,o.zip_code,o.money_logistics,o.money_product-o.money_order-o.money_logistics AS couponMoney,
o.address_info,o.mobile,o.zip_code,o.zip_code,o.money_logistics,o.money_product-o.money_order+o.money_logistics AS couponMoney,
o.money_order,o.money_product,o.pay_time,o.member_name FROM orders o
LEFT JOIN regions p ON p.id = o.province_id
LEFT JOIN regions c ON c.id = o.city_id
......@@ -225,6 +226,8 @@
<result property="moneyPrice" column="money_price" />
<result property="number" column="number" />
<result property="moneyAmount" column="money_amount" />
<result property="moneyFullAoumt" column="money_full_amount" />
<result property="deductionProductVbMoney" column="deduction_product_vb_money" />
<result property="moneyActSingle" column="money_act_single" />
<result property="actSingleId" column="act_single_id" />
<result property="actGroupId" column="act_group_id" />
......@@ -240,12 +243,13 @@
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="isEvaluate" column="is_evaluate" />
<result property="moneyCouponAmount" column="money_coupon_amount" />
</resultMap>
<!-- 查询子订单-->
<select id="getOrdersProductList" resultType="java.lang.String" resultMap="ordersProduct">
SELECT product_sku,id,product_name,spec_info,number,money_price,money_act_single FROM orders_product
<select id="getOrdersProductList" parameterType="java.lang.String" resultMap="ordersProduct">
SELECT product_sku,id,product_name,spec_info,number,money_price,money_act_single,money_coupon_amount,money_full_amount FROM orders_product
WHERE orders_sn = #{orderSn}
</select>
......
......@@ -74,6 +74,8 @@ public class Orders implements Serializable{
private String regionName1;
private String regionName2;
private String regionName3;
private BigDecimal deductionVbMoney;
private BigDecimal couponMoney;
private List<OrdersProduct> goodinfos;
......
......@@ -43,6 +43,10 @@ public class OrdersProduct {
private Date createTime;
private Date updateTime;
private Integer isEvaluate;
private BigDecimal moneyFullAoumt;
private BigDecimal moneyCouponAmount;
private BigDecimal deductionProductVbMoney;
}
......
......@@ -123,24 +123,24 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
private OrderResponse getOrderResponse(Orders orders){
OrderStatusEnum orderStatusEnum = this.convertAndCheckOrderStatusEnum(orders);
OrderResponse orderResponse = new OrderResponse();
orderResponse.setTradeStatus(orderStatusEnum.getCode());
orderResponse.setTradeStatus(orderStatusEnum.getCode());//订单状态
orderResponse.setTradeStatusDescription(orderStatusEnum.getMsg());
orderResponse.setPlatOrderNo(orders.getOrderSn());
orderResponse.setTradeStatusDescription(orders.getRemark());
orderResponse.setTradeTime(this.buildDefaultSimpleDateFormat().format(orders.getCreateTime()));
orderResponse.setCountry("中国");
orderResponse.setProvince(orders.getRegionName1());
orderResponse.setCity(orders.getRegionName2());
orderResponse.setArea(orders.getRegionName3());
orderResponse.setAddress(orders.getAddressInfo());
orderResponse.setNick(orders.getMemberName());
orderResponse.setPhone(orders.getMobile());
orderResponse.setPlatOrderNo(orders.getOrderSn());//订单号
orderResponse.setTradeStatusDescription(orders.getRemark());//订单备注
orderResponse.setTradeTime(this.buildDefaultSimpleDateFormat().format(orders.getCreateTime()));//交易时间
orderResponse.setProvince(orders.getRegionName1());//省
orderResponse.setCity(orders.getRegionName2());//市
orderResponse.setArea(orders.getRegionName3());//区
orderResponse.setAddress(orders.getAddressInfo());//地址
orderResponse.setNick(orders.getMemberName());//买家昵称
orderResponse.setPhone(orders.getMobile());//电话
orderResponse.setMobile(orders.getMobile());
orderResponse.setPostFee(this.convertAndCheckFreight(orders.getMoneyLogistics()));
orderResponse.setGoodsFee(this.convertAndCheckFreight(orders.getMoneyProduct()));
orderResponse.setTotalMoney(this.convertAndCheckFreight(orders.getMoneyOrder()));
orderResponse.setPayTime(orders.getPayTime()==null?"":this.buildDefaultSimpleDateFormat().format(orders.getPayTime()));
orderResponse.setShouldPayType("银行收款");
orderResponse.setPostFee(this.convertAndCheckFreight(orders.getMoneyLogistics()));//邮费
orderResponse.setGoodsFee(this.convertAndCheckFreight(orders.getMoneyProduct()));//货款金额
orderResponse.setTotalMoney(this.convertAndCheckFreight(orders.getMoneyOrder()));//支付金额
orderResponse.setFavourableMoney(this.convertAndCheckFreight(orders.getCouponMoney()));//优惠金额
orderResponse.setPayTime(orders.getPayTime()==null?"":this.buildDefaultSimpleDateFormat().format(orders.getPayTime()));//支付时间
orderResponse.setShouldPayType("银行收款");//结算方式
orderResponse.setTown("");
orderResponse.setTaxAmount("");
orderResponse.setCommissionValue("");
......@@ -161,6 +161,7 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
return orderResponse;
}
/**
* 子订单数据
* @param ordersProduct
......@@ -168,14 +169,14 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
*/
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(this.convertAndCheckFreight(ordersProduct.getMoneyPrice()));
orderGoodResponse.setDiscountMoney(this.convertAndCheckFreight(ordersProduct.getMoneyActSingle()));
orderGoodResponse.setProductId(ordersProduct.getProductSku());//平台商品ID或SKUID(SKUID优先)
orderGoodResponse.setSubOrderNo(String.valueOf(ordersProduct.getId()));//子订单号(若需要支持拆单发货,则必填)
orderGoodResponse.setTradeGoodsNo(ordersProduct.getProductSku());//外部商家编码或外部SKU编码(SKU编码优先)。注意,如果要与管家对接,这里一般返回管家的商品编码,作为平台的外部商家编码,与管家商品映射
orderGoodResponse.setTradeGoodsName(ordersProduct.getProductName());//商品交易名称
orderGoodResponse.setTradeGoodsSpec(ordersProduct.getSpecInfo());//商品交易规格
orderGoodResponse.setGoodsCount(String.valueOf(ordersProduct.getNumber()));//商品数量
orderGoodResponse.setPrice(this.convertAndCheckFreight(ordersProduct.getMoneyPrice()));//单价
orderGoodResponse.setDiscountMoney(this.convertAndCheckFreight(getOrdersProductDiscountMoney(ordersProduct)));//子订单优惠金额
orderGoodResponse.setTaxAmount("");
orderGoodResponse.setRefundStatus("");
orderGoodResponse.setStatus("");
......@@ -183,6 +184,19 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
return orderGoodResponse;
}
private BigDecimal getOrdersProductDiscountMoney(OrdersProduct ordersProduct){
BigDecimal moneyActSingle = ordersProduct.getMoneyActSingle() ==null? BigDecimal.ZERO : ordersProduct.getMoneyActSingle();//立减优惠金额
BigDecimal moneyFullAmount = ordersProduct.getMoneyFullAoumt() ==null? BigDecimal.ZERO:ordersProduct.getMoneyFullAoumt();//网单满减金额和
BigDecimal moneyCouponAmount = ordersProduct.getMoneyCouponAmount() ==null?BigDecimal.ZERO:ordersProduct.getMoneyCouponAmount();//网单优惠券优惠金额和
BigDecimal deductionProductVbMoney = ordersProduct.getDeductionProductVbMoney() ==null?BigDecimal.ZERO:ordersProduct.getDeductionProductVbMoney();
BigDecimal sumDiscountMoney =BigDecimal.ZERO;
sumDiscountMoney = sumDiscountMoney.add(moneyActSingle);
sumDiscountMoney = sumDiscountMoney.add(moneyFullAmount);
sumDiscountMoney = sumDiscountMoney.add(moneyCouponAmount);
sumDiscountMoney = sumDiscountMoney.add(deductionProductVbMoney);
return sumDiscountMoney;
}
private OrderStatusEnum convertAndCheckOrderStatusEnum(Orders orders) {
OrderStatusEnum orderStatusEnum = OrderStatusEnum.resolveByPlatformOrderStatus(orders.getOrderState());
......