95041489 刘嘉

菠萝派接口- 订单下载更新数据源

1 个父辈 4b154430
......@@ -67,6 +67,14 @@ public interface MemberReadDao {
*/
List<Orders> getOrdersList(Map<String,Object> params);
/**
* 订单下载总数
* @param params
* @return
*/
int countgetOrdersList(Map<String,Object> params);
/**
* 子订单查询
* @param orderSn
......
......@@ -42,10 +42,20 @@
<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" />
<result property="regionName1" column="regionName1" />
<result property="regionName2" column="regionName2" />
<result property="regionName3" column="regionName3" />
<result property="orderState" column="order_state" />
<result property="moneyOrder" column="money_order" />
<result property="moneyPaidBalance" column="money_paid_balance" />
<result property="moneyCoupon" column="money_coupon" />
<result property="moneyLogistics" column="money_logistics" />
<result property="moneyProduct" column="money_product" />
<result property="moneyActFull" column="money_act_full" />
<result property="moneyDiscount" column="money_discount" />
<result property="moneyBack" column="money_back" />
<result property="moneyIntegral" column="money_integral" />
<result property="payTime" column="pay_time" />
</resultMap>
<!-- 根据订单号查询订单信息 只查询不是主订单的订单 -->
......@@ -142,25 +152,58 @@
<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
LEFT JOIN regions a ON a.id = o.area_id
WHERE o.is_parent = 0
AND seller_id = #{sellerId} AND order_sn = #{orderSn}
<if test="startTime !=null and startTime ! =''">
AND create_time >= #{startTime}
AND o.seller_id = #{sellerId}
<if test="orderState!=null and orderState!=''">
AND o.order_state in
<foreach collection="orderState" item="state" open="(" close=")" separator=",">
#{state}
</foreach>
</if>
<if test="endTime !=null and endTime ! =''">
<if test="orderSn!=null and orderSn!=''">
AND o.order_sn = #{orderSn}
</if>
<if test="startTime!=null and startTime!=''">
AND o.create_time >= #{startTime}
</if>
<if test="endTime!=null and endTime!=''">
<![CDATA[
and create_time <= #{endTime}
and o.create_time <= #{endTime}
]]>
</if>
ORDER BY o.id DESC
ORDER BY o.create_time DESC
limit ${PageIndex}, ${PageSize}
</select>
<!-- 订单下载总数-->
<select id="countgetOrdersList" parameterType="java.util.Map" resultType="java.lang.Integer">
select count(*) FROM orders o
WHERE o.is_parent = 0
AND o.seller_id = #{sellerId}
<if test="orderState!=null and orderState!=''">
AND o.order_state in
<foreach collection="orderState" item="state" open="(" close=")" separator=",">
#{state}
</foreach>
</if>
<if test="orderSn!=null and orderSn!=''">
AND o.order_sn = #{orderSn}
</if>
<if test="startTime!=null and startTime!=''">
AND o.create_time >= #{startTime}
</if>
<if test="endTime!=null and endTime!=''">
<![CDATA[
and o.create_time <= #{endTime}
]]>
</if>
</select>
<!-- 子订单实体-->
<resultMap id="ordersProduct" type="com.sibu.orderHelper.integral.pineapple.model.OrdersProduct">
<result property="id" column="id" />
......@@ -201,9 +244,9 @@
<!-- 查询子订单-->
<select id="getOrdersProductList" resultType="java.util.Map" resultMap="ordersProduct">
<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
WHERE orders_sn = #{ordersSn}
WHERE orders_sn = #{orderSn}
</select>
<!-- 地址实体类-->
......
......@@ -23,7 +23,7 @@ public class Orders implements Serializable{
private Integer memberId;
private String memberName;
private Integer orderState;
private String payTime;
private Date payTime;
private Integer paymentStatus;
private Integer invoiceStatus;
private String invoiceTitle;
......@@ -68,7 +68,7 @@ public class Orders implements Serializable{
private String codconfirmTime;
private String codconfirmRemark;
private Integer codconfirmState;
private String createTime;
private Date createTime;
private String updateTime;
private Integer evaluateState;
private String regionName1;
......
......@@ -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.EJavaShopOrderStateEnum;
import com.sibu.orderHelper.integral.pineapple.enums.OrderStatusEnum;
import com.sibu.orderHelper.integral.pineapple.exception.BizException;
import com.sibu.orderHelper.integral.pineapple.model.Orders;
......@@ -26,6 +27,7 @@ import com.sibu.orderHelper.integral.reponse.DoingOrderDetailResponse;
import com.sibu.orderHelper.integral.service.IIMDoingOrderService;
import com.sibu.orderHelper.integral.service.impl.IMDoingOrderService;
import com.sibu.orderHelper.integral.service.pineapple.converter.PlatformOrderToPineAppleOrderConverter;
import com.sibu.orderHelper.mall.member.read.MemberReadDao;
import com.sibu.orderHelper.service.redis.RedisProductSkuService;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
......@@ -52,16 +54,12 @@ import java.util.stream.Collectors;
@Service
public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest> {
private static Logger log = Logger.getLogger(GetOrderBizServiceImpl.class);
@Resource
private IIMDoingOrderService iimDoingOrderService;
@Resource
private IMDoingOrderDao iMDoingOrderDao;
@Autowired
private PlatformOrderToPineAppleOrderConverter platformOrderToPineAppleOrderConverter;
@Resource
PineappleDao pineappleDao;
private MemberReadDao memberReadDao;
@Override
public BaseResponse call(CallRequest<GetOrderRequest> callRequest) {
......@@ -69,6 +67,10 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
if(!StringUtil.isNull(callRequest.getBizModel().getPlatOrderNo())){
params.put("orderSn",callRequest.getBizModel().getPlatOrderNo());
}
if(!StringUtil.isNull(callRequest.getBizModel().getOrderStatus())){
OrderStatusEnum orderStatusEnum = OrderStatusEnum.resolve(callRequest.getBizModel().getOrderStatus());
params.put("orderState",orderStatusEnum.getMallOrderStatus());
}
params.put("sellerId",callRequest.getSupplier().getId());
if(!StringUtil.isNull(callRequest.getBizModel().getStartTime())){
params.put("startTime",callRequest.getBizModel().getStartTime());
......@@ -78,9 +80,9 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
}
params.put("PageIndex",(callRequest.getBizModel().getPageIndex() - 1) * callRequest.getBizModel().getPageSize());
params.put("PageSize",callRequest.getBizModel().getPageSize());
List<Orders> ordersList = pineappleDao.getOrdersList(params);
List<Orders> ordersList = memberReadDao.getOrdersList(params);
GetOrderResponse response = new GetOrderResponse();
response.setNumTotalOrder(ordersList.size());
response.setNumTotalOrder(memberReadDao.countgetOrdersList(params));
response.setOrders(findOrders(ordersList));
response.setCode(PineAppleConst.SUCCESS_CODE);
return response;
......@@ -92,8 +94,8 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
ordersList.stream().forEach(o ->{
OrderResponse orderResponse = this.getOrderResponse(o);
try {
List<OrdersProduct> ordersProductList = pineappleDao.getOrdersProductList(o.getOrderSn());
if(StringUtil.isNull(null)){
List<OrdersProduct> ordersProductList = memberReadDao.getOrdersProductList(o.getOrderSn());
if(StringUtil.isNull(ordersProductList)){
throw new BizException(String.format("获取子订单数据业务异常[%s]",(o.getOrderSn())));
}
List<OrderGoodResponse> goodInfos = new ArrayList<>();
......@@ -101,11 +103,12 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
OrderGoodResponse orderGoodResponse = this.getOrderGoodResponse(p);
goodInfos.add(orderGoodResponse);
});
orderResponse.setGoodInfos(goodInfos);
orderResponseList.add(orderResponse);
} catch (Exception e) {
log.error("获取订单数据业务异常", e);
throw new BizException("获取订单数据业务异常", e);
throw new BizException(String.format("获取订单数据业务异常:[%s]",o.getOrderSn()));
}
});
}
......@@ -130,12 +133,13 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
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(this.buildDefaultSimpleDateFormat().format(orders.getPayTime()));
orderResponse.setPayTime(orders.getPayTime()==null?"":this.buildDefaultSimpleDateFormat().format(orders.getPayTime()));
orderResponse.setShouldPayType("银行收款");
orderResponse.setTown("");
orderResponse.setTaxAmount("");
......@@ -176,7 +180,7 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
orderGoodResponse.setRefundStatus("");
orderGoodResponse.setStatus("");
orderGoodResponse.setRemark("");
return null;
return orderGoodResponse;
}
......@@ -194,7 +198,8 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
}
private String convertAndCheckFreight(BigDecimal money) {
return money.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString();
BigDecimal price = money==null?BigDecimal.ZERO:money;
return price.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString();
}
@Override
......