Browse Source

商家收货地址和用户填写快递信息

fubojin 1 day ago
parent
commit
f30c0861e2

+ 4 - 5
yami-shop-bean/src/main/java/com/yami/shop/bean/model/Order.java

@@ -35,10 +35,14 @@ public class Order implements Serializable {
      * 店铺id
      */
     private Long shopId;
+    @TableField(exist = false)
+    private String shopName;
     /**
      * 渠道ID
      */
     private Long channelId;
+    @TableField(exist = false)
+    private String channelName;
 
     /**
      * 产品名称,多个产品将会以逗号隔开
@@ -203,11 +207,6 @@ public class Order implements Serializable {
     @ApiModelProperty("麦芽条状态 0 失败 1 成功 null为暂未创建")
     private Integer dvyStatus;
 
-    /**
-     * 店铺名称
-     */
-    @TableField(exist = false)
-    private String shopName;
 
     /**
      * 买家昵称

+ 0 - 1
yami-shop-bean/src/main/java/com/yami/shop/bean/model/OrderRefund.java

@@ -108,7 +108,6 @@ public class OrderRefund implements Serializable{
     private String photoFiles;
     /**
      * 退款单状态 10:待审核 20:处理中 30:驳回退款 40:撤销退款 60:待退货(一审同意) 65:待确认收货(二审待审核) 70:退款完成
-     *
      */
     private Integer returnMoneySts;
     /**

+ 48 - 0
yami-shop-bean/src/main/java/com/yami/shop/bean/param/OrderCountParam.java

@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2018-2999 广州亚米信息科技有限公司 All rights reserved.
+ *
+ * https://www.gz-yami.com/
+ *
+ * 未经允许,不可做商业用途!
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.yami.shop.bean.param;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.annotations.ApiOperation;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+
+@Data
+@Api("配送订单模块(数据统计)")
+public class OrderCountParam {
+
+    @ApiModelProperty("全部数量")
+    private Integer allCount;
+    @ApiModelProperty("待支付数量(0)")
+    private Integer payedCount;
+    @ApiModelProperty("待练货数量(20)")
+    private Integer readyCount;
+    @ApiModelProperty("待配送数量(30)")
+    private Integer deliveryCount;
+    @ApiModelProperty("配送中数量(40)")
+    private Integer shippingCount;
+    @ApiModelProperty("订单已送达(70)")
+    private Integer arrivedCount;
+    @ApiModelProperty("订单已完成(80)")
+    private Integer completedCount;
+
+    @ApiModelProperty("订单待取消待审核(50)")
+    private Integer cancelAuditCount;
+    @ApiModelProperty("订单已取消(60)")
+    private Integer canceledCount;
+
+
+
+}

+ 10 - 2
yami-shop-bean/src/main/java/com/yami/shop/bean/param/OrderParam.java

@@ -50,6 +50,12 @@ public class OrderParam {
     // 70-订单已送达,
     // 80-订单已完成'
     private Integer status;
+    private Integer hbOrderStatus;
+
+    /**
+     * 配送方式  1:快递 2:自提 3:及时配送
+     */
+    private Integer dvyType;
 
 //    @ApiModelProperty("付款方式 0:积分支付 1:微信支付 2:支付宝 3:微信扫码支付 4:微信H5支付 5:微信公众号支付 6:支付宝H5支付 7:支付宝APP支付 8:微信APP支付")
 //    private Integer payType;
@@ -58,6 +64,10 @@ public class OrderParam {
      */
     private Long shopId;
 
+    /**
+     * 渠道ID
+     */
+    private Long channelId;
 
     /**
      * 订单类型参考orderType ,1团购订单 2秒杀订单,3积分订单
@@ -74,8 +84,6 @@ public class OrderParam {
      */
     private String orderNumber;
 
-
-
     /**
      * 店铺名称
      */

+ 109 - 0
yami-shop-bean/src/main/java/com/yami/shop/bean/param/OrderStatisticsParam.java

@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2018-2999 广州亚米信息科技有限公司 All rights reserved.
+ *
+ * https://www.gz-yami.com/
+ *
+ * 未经允许,不可做商业用途!
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.yami.shop.bean.param;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+@Data
+public class OrderStatisticsParam {
+
+    /**
+     * 收货人手机号
+     */
+    private String mobile;
+    /**
+     * 收货人姓名
+     */
+    private String receiver;
+
+    /**
+     * 订购流水号
+     */
+    private String orderNumber;
+
+    /**
+     * 开始时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date startTime;
+
+    /**
+     * 结束时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date endTime;
+    /**
+     * 渠道ID
+     */
+    private Long channelId;
+    /**
+     * 店铺id
+     */
+    private Long shopId;
+    /**
+     * 店铺名称
+     */
+//    private String shopName;
+    /**
+     * 订单状态
+     */
+    @ApiModelProperty("订单状态(0-待付款,20-待发货,70-待收货,80-已完成,60-已取消)")
+    //'海博订单状态:0-待支付,
+    // 20-订单已接单(待拣货),
+    // 30-订单待配送(拣货完成/自提类订单为待自提),
+    // 40-订单配送中 ,
+    // 50-订单取消待审核,
+    // 60-订单已取消,
+    // 70-订单已送达,
+    // 80-订单已完成'
+    private Integer hbOrderStatus;
+
+    /**
+     * 配送方式  1:快递 2:自提 3:及时配送
+     */
+    private Integer dvyType;
+
+    /**
+     * 订单退款状态参考refundStatus(1:申请退款 2:退款成功 3:部分退款成功 4:退款失败)
+     */
+    private Integer refundStatus;
+
+
+//
+//    /**
+//     * 订单类型参考orderType ,1团购订单 2秒杀订单,3积分订单
+//     */
+//    private Integer orderType;
+//
+//    /**
+//     * 是否已经支付,1:已经支付过,0:,没有支付过
+//     */
+//    private Integer isPayed;
+//
+
+//
+//    /**
+//     * 商品名称
+//     */
+//    private String prodName;
+//    /**
+//     * 收货人姓名
+//     */
+//    private String receiver;
+//
+//
+
+
+}

+ 24 - 4
yami-shop-platform/src/main/java/com/yami/shop/platform/controller/OrderController.java

@@ -10,6 +10,8 @@
 
 package com.yami.shop.platform.controller;
 
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.yami.shop.bean.enums.DvyType;
@@ -18,13 +20,11 @@ import com.yami.shop.bean.model.Order;
 import com.yami.shop.bean.model.OrderItem;
 import com.yami.shop.bean.model.User;
 import com.yami.shop.bean.model.UserAddrOrder;
-import com.yami.shop.bean.param.BackendOrderParam;
-import com.yami.shop.bean.param.DeliveryOrderParam;
-import com.yami.shop.bean.param.OrderParam;
-import com.yami.shop.bean.param.OrderPayParam;
+import com.yami.shop.bean.param.*;
 import com.yami.shop.common.exception.GlobalException;
 import com.yami.shop.common.util.PageParam;
 import com.yami.shop.common.util.R;
+import com.yami.shop.coupon.comment.model.Coupon;
 import com.yami.shop.service.*;
 import com.yami.shop.utils.CullenUtils;
 import io.swagger.annotations.ApiOperation;
@@ -182,4 +182,24 @@ public class OrderController {
         return R.SUCCESS();
     }
 
+    /**
+     * 配送订单模块
+     */
+    @GetMapping("/deliveryOrder")
+    @ApiOperation("配送订单模块")
+    public R<IPage<Order>> deliveryOrder(PageParam<Order> page, OrderStatisticsParam orderParam) {
+        orderParam.setDvyType(DvyType.NOT_DELIVERY.value());
+        IPage<Order> orderIPage = orderService.deliveryOrder(page, orderParam);
+        return R.SUCCESS(orderIPage);
+    }
+    /**
+     *配送订单模块(数据统计)
+     */
+    @GetMapping("/selectOrderCount")
+    @ApiOperation("配送订单模块(数据统计)")
+    public R<OrderCountParam> selectOrderCount(OrderParam orderParam) {
+        OrderCountParam orderCount = orderService.selectOrderCount(orderParam);
+        return R.SUCCESS(orderCount);
+    }
+
 }

+ 20 - 1
yami-shop-platform/src/main/java/com/yami/shop/platform/controller/OrderRefundController.java

@@ -1,6 +1,7 @@
 package com.yami.shop.platform.controller;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.github.binarywang.wxpay.service.WxPayService;
 import com.yami.shop.bean.dto.OrderRefundDto;
@@ -12,6 +13,7 @@ import org.springframework.http.ResponseEntity;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 import com.yami.shop.common.util.R;
+
 /**
  * 订单退款管理实现
  *
@@ -36,7 +38,7 @@ public class OrderRefundController {
     @GetMapping("/page")
     @PreAuthorize("@pms.hasPermission('platform:orderRefund:page')")
     public R<IPage<OrderRefundDto>> getOrderRefundPage(PageParam<OrderRefundDto> page, OrderRefundDto orderRefundDto,
-                                                                    @RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime) {
+                                                       @RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime) {
         IPage<OrderRefundDto> page1 = orderRefundService.getPage(page, orderRefundDto, startTime, endTime);
         return R.SUCCESS(orderRefundService.getPage(page, orderRefundDto, startTime, endTime));
     }
@@ -54,4 +56,21 @@ public class OrderRefundController {
         return R.SUCCESS(orderRefund);
     }
 
+    /**
+     * 后管端分页获取退款订单列表
+     */
+    @GetMapping("/orderRefundPage")
+    public R<IPage<OrderRefund>> orderRefundPage(PageParam<OrderRefund> page, OrderRefund orderRefund) {
+        LambdaQueryWrapper<OrderRefund> wrapper = new LambdaQueryWrapper<OrderRefund>()
+                .eq(orderRefund.getShopId() != null, OrderRefund::getShopId, orderRefund.getShopId())
+                .like(orderRefund.getOrderNumber() != null, OrderRefund::getOrderNumber, orderRefund.getOrderNumber())
+                .like(orderRefund.getRefundSn() != null, OrderRefund::getRefundSn, orderRefund.getRefundSn())
+                .eq(orderRefund.getReturnMoneySts() != null, OrderRefund::getReturnMoneySts, orderRefund.getReturnMoneySts())
+                .eq(orderRefund.getBuyerMobile() != null, OrderRefund::getBuyerMobile, orderRefund.getBuyerMobile())
+                .eq(orderRefund.getApplyType() != null, OrderRefund::getApplyType, orderRefund.getApplyType());
+        IPage<OrderRefund> page1 = orderRefundService.page(page, wrapper);
+
+
+        return R.SUCCESS(page1);
+    }
 }

+ 13 - 3
yami-shop-service/src/main/java/com/yami/shop/dao/OrderMapper.java

@@ -12,15 +12,15 @@ package com.yami.shop.dao;
 
 import cn.hutool.core.date.DateTime;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.yami.shop.bean.app.dto.MyOrderDto;
 import com.yami.shop.bean.app.dto.MyOrderItemDto;
 import com.yami.shop.bean.app.dto.OrderCountData;
 import com.yami.shop.bean.distribution.UserShoppingDataDto;
 import com.yami.shop.bean.model.Order;
-import com.yami.shop.bean.param.BackendOrderParam;
-import com.yami.shop.bean.param.OrderParam;
-import com.yami.shop.bean.param.OrderPayParam;
+import com.yami.shop.bean.param.*;
 import com.yami.shop.common.util.PageAdapter;
+import com.yami.shop.common.util.PageParam;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.Date;
@@ -124,4 +124,14 @@ public interface OrderMapper extends BaseMapper<Order> {
     void updateByToPaySuccessDelivery(@Param("orderNumbers") List<String> orderNumbers, @Param("payType") Integer payType);
 
     Integer statusCount(@Param("status") List<Integer> status);
+
+    /**
+     * 统计订单数量
+     */
+    OrderCountParam selectOrderCount(@Param("orderParam") OrderParam orderParam);
+
+    /**
+     * 后管端分页获取订单列表
+     */
+    IPage<Order> deliveryOrder(@Param("page") PageParam<Order> page, @Param("orderParam") OrderStatisticsParam orderParam);
 }

+ 16 - 0
yami-shop-service/src/main/java/com/yami/shop/service/OrderService.java

@@ -148,4 +148,20 @@ public interface OrderService extends IService<Order> {
 
     Map<String,Integer> deliverListStatusNum();
 
+    /**
+     * 订单统计数据
+     *
+     * @param orderParam 订单参数
+     * @return 订单统计数据
+     */
+    OrderCountParam selectOrderCount(OrderParam orderParam);
+
+    /**
+     * 订单发货列表
+     *
+     * @param page 分页参数
+     * @param orderParam 订单参数
+     * @return 订单发货列表
+     */
+    IPage<Order> deliveryOrder(PageParam<Order> page, OrderStatisticsParam orderParam);
 }

+ 25 - 10
yami-shop-service/src/main/java/com/yami/shop/service/impl/OrderServiceImpl.java

@@ -16,6 +16,7 @@ import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.io.IORuntimeException;
 import cn.hutool.core.lang.Snowflake;
 import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.RandomUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.poi.excel.ExcelUtil;
 import cn.hutool.poi.excel.ExcelWriter;
@@ -67,6 +68,7 @@ import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
 import java.time.Instant;
 import java.time.LocalDateTime;
 import java.util.*;
@@ -241,12 +243,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
     }
 
     public static void main(String[] args) throws Exception {
-        String json = "{'buyPrice':10,'buyOrder':1}";
-        ObjectMapper om = new ObjectMapper();
-        // 允许单引号(非标准)
-        om.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true);
-        GrowthParamConfig growthParamConfig = om.readValue(json, GrowthParamConfig.class);
-        System.out.println(growthParamConfig);
+        String tyyyyMMddHHmmss = "T" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + RandomUtil.randomNumbers(4);
+        System.out.println(tyyyyMMddHHmmss);
     }
 
     @Override
@@ -902,7 +900,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
         newOrderRefund.setUserId(order.getUserId());
         newOrderRefund.setOrderId(order.getOrderId());
         newOrderRefund.setOrderNumber(order.getOrderNumber());
-        newOrderRefund.setRefundSn(String.valueOf(snowflake.nextId()));
+        //退款单号   T+年+月+日+时+分+秒+随机四个数字。
+        String T = "T" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + RandomUtil.randomNumbers(4);
+
+        newOrderRefund.setRefundSn(T);
         newOrderRefund.setRefundType(orderRefundParam.getRefundType());
         newOrderRefund.setRefundAmount(orderRefundParam.getRefundAmount());
 
@@ -949,11 +950,11 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
                 orderRefundSkuMapper.insert(c);
             });
         }
-
         return newOrderRefund;
     }
 
 
+
     /**
      * 退货退款
      */
@@ -1186,12 +1187,26 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
         map.put("all", orderMapper.statusCount(Lists.newArrayList(0, 1, 20, 30, 40, 50, 60, 70, 80)));
         map.put("paddingPay", orderMapper.statusCount(Lists.newArrayList(0)));
         map.put("paddingShipped", orderMapper.statusCount(Lists.newArrayList(1)));
-        map.put("paddingReceived", orderMapper.statusCount(Lists.newArrayList(20, 30, 40, 50, 70)));
+        map.put("paddingReceived", orderMapper.statusCount(Lists.newArrayList(20, 30, 40, 70)));
         map.put("completed", orderMapper.statusCount(Lists.newArrayList(80)));
-        map.put("cancel", orderMapper.statusCount(Lists.newArrayList(60)));
+        map.put("cancel", orderMapper.statusCount(Lists.newArrayList(60,50)));
         return map;
     }
 
+    @Override
+    public OrderCountParam selectOrderCount(OrderParam orderParam) {
+        return orderMapper.selectOrderCount(orderParam);
+    }
+
+    @Override
+    public IPage<Order> deliveryOrder(PageParam<Order> page, OrderStatisticsParam orderParam) {
+        IPage<Order> orderIPage = orderMapper.deliveryOrder(page, orderParam);
+        orderIPage.getRecords().forEach(order -> {
+            order.setOrderItems(orderItemService.getOrderItemsByOrderNumber(order.getOrderNumber()));
+        });
+        return orderIPage;
+    }
+
     private boolean isPaymentOver7Days(Date paymentDate) {
         // 1. 将支付时间转换为 Instant
         Instant paymentInstant = paymentDate.toInstant();

+ 122 - 6
yami-shop-service/src/main/resources/mapper/OrderMapper.xml

@@ -4,6 +4,9 @@
     <resultMap id="BaseResultMap" type="com.yami.shop.bean.model.Order">
         <id column="order_id" jdbcType="BIGINT" property="orderId"/>
         <result column="shop_id" jdbcType="BIGINT" property="shopId"/>
+        <result column="shop_name" jdbcType="VARCHAR" property="shopName"/>
+        <result column="channel_id" jdbcType="BIGINT" property="channelId"/>
+        <result column="channel_name" jdbcType="VARCHAR" property="channelName"/>
         <result column="prod_name" jdbcType="VARCHAR" property="prodName"/>
         <result column="user_id" jdbcType="VARCHAR" property="userId"/>
         <result column="order_number" jdbcType="VARCHAR" property="orderNumber"/>
@@ -12,6 +15,7 @@
         <result column="pay_type" jdbcType="INTEGER" property="payType"/>
         <result column="remarks" jdbcType="VARCHAR" property="remarks"/>
         <result column="hb_order_status" jdbcType="INTEGER" property="hbOrderStatus"/>
+        <result column="dvy_status" jdbcType="VARCHAR" property="dvyStatus"/>
         <result column="dvy_type" jdbcType="VARCHAR" property="dvyType"/>
         <result column="dvy_id" jdbcType="BIGINT" property="dvyId"/>
         <result column="dvy_flow_id" jdbcType="VARCHAR" property="dvyFlowId"/>
@@ -80,9 +84,14 @@
     <resultMap type="com.yami.shop.bean.model.Order" id="orderAndOrderItemMap">
         <id column="order_id" jdbcType="BIGINT" property="orderId"/>
         <result column="shop_id" jdbcType="BIGINT" property="shopId"/>
+        <result column="shop_name" jdbcType="VARCHAR" property="shopName"/>
+        <result column="channel_id" jdbcType="BIGINT" property="channelId"/>
+        <result column="channel_name" jdbcType="VARCHAR" property="channelName"/>
         <result column="prod_name" jdbcType="VARCHAR" property="prodName"/>
         <result column="user_id" jdbcType="VARCHAR" property="userId"/>
         <result column="order_number" jdbcType="VARCHAR" property="orderNumber"/>
+        <result column="hb_order_status" jdbcType="VARCHAR" property="hbOrderStatus"/>
+        <result column="dvy_status" jdbcType="VARCHAR" property="dvyStatus"/>
         <result column="total" jdbcType="DECIMAL" property="total"/>
         <result column="actual_total" jdbcType="DECIMAL" property="actualTotal"/>
         <result column="pay_type" jdbcType="INTEGER" property="payType"/>
@@ -408,6 +417,12 @@
 <!--            <if test="orderParam.payType != null">-->
 <!--                and o.pay_type = #{orderParam.payType}-->
 <!--            </if>-->
+            <if test="orderParam.dvyType != null">
+                and o.dvy_type = #{orderParam.dvyType}
+            </if>
+            <if test="orderParam.channelId != null">
+                and o.channel_id = #{orderParam.channelId}
+            </if>
             <if test="orderParam.shopId != null">
                 and o.shop_id = #{orderParam.shopId}
             </if>
@@ -499,13 +514,13 @@
                 </if>
 
                 <if test="orderParam.orderStatus == 'paddingReceived'">
-                    AND a.hb_order_status in (20,30,40,50,70)
+                    AND a.hb_order_status in (20,30,40,70)
                 </if>
                 <if test="orderParam.orderStatus == 'completed'">
                     AND a.hb_order_status in (80)
                 </if>
                 <if test="orderParam.orderStatus == 'cancel'">
-                    AND a.hb_order_status in (60)
+                    AND a.hb_order_status in (50,60)
                 </if>
             </if>
         </where>
@@ -554,13 +569,13 @@
                 </if>
 
                 <if test="orderParam.orderStatus == 'paddingReceived'">
-                    AND a.hb_order_status in (20,30,40,50,70)
+                    AND a.hb_order_status in (20,30,40,70)
                 </if>
                 <if test="orderParam.orderStatus == 'completed'">
                     AND a.hb_order_status in (80)
                 </if>
                 <if test="orderParam.orderStatus == 'cancel'">
-                    AND a.hb_order_status in (60)
+                    AND a.hb_order_status in (50,60)
                 </if>
             </if>
         </where>
@@ -575,15 +590,22 @@
         JOIN tz_user_addr_order uao
         ON o.addr_order_id = uao.addr_order_id
         <where>
+            o.delete_status = 0
             <if test="orderParam.orderNumber != null and orderParam.orderNumber != ''">
                 and o.order_number = #{orderParam.orderNumber}
             </if>
-            <if test="orderParam.orderStatus != null">
-                and o.hb_order_status = #{orderParam.orderStatus}
+            <if test="orderParam.hbOrderStatus != null">
+                and o.hb_order_status = #{orderParam.hbOrderStatus}
             </if>
             <if test="orderParam.shopId != null">
                 and o.shop_id = #{orderParam.shopId}
             </if>
+            <if test="orderParam.channelId != null">
+                and o.channel_id = #{orderParam.channelId}
+            </if>
+            <if test="orderParam.dvyType != null">
+                and o.dvy_type = #{orderParam.dvyType}
+            </if>
             <if test="orderParam.isPayed != null">
                 and o.is_payed = #{orderParam.isPayed}
                 and o.hb_order_status != 60
@@ -966,5 +988,99 @@
             #{status}
         </foreach>
     </select>
+    <select id="selectOrderCount" resultType="com.yami.shop.bean.param.OrderCountParam">
+        SELECT
+        count(1) as allCount,
+        count(case when hb_order_status = 0 then 1 end) as payedCount,
+        count(case when hb_order_status = 20 then 1 end) as readyCount,
+        count(case when hb_order_status = 30 then 1 end) as deliveryCount,
+        count(case when hb_order_status = 40 then 1 end) as shippingCount,
+        count(case when hb_order_status = 50 then 1 end) as cancelAuditCount,
+        count(case when hb_order_status = 60 then 1 end) as canceledCount,
+        count(case when hb_order_status = 70 then 1 end) as arrivedCount,
+        count(case when hb_order_status = 80 then 1 end) as completedCount
+        FROM tz_order
+        <where>
+            delete_status = 0
+            <if test="orderParam.orderNumber != null and orderParam.orderNumber != ''">
+                and o.order_number = #{orderParam.orderNumber}
+            </if>
+            <if test="orderParam.hbOrderStatus != null">
+                and o.hb_order_status = #{orderParam.hbOrderStatus}
+            </if>
+            <if test="orderParam.dvyType != null">
+                and o.dvy_type = #{orderParam.dvyType}
+            </if>
+            <if test="orderParam.channelId != null">
+                and o.channel_id = #{orderParam.channelId}
+            </if>
+            <if test="orderParam.shopId != null">
+                and o.shop_id = #{orderParam.shopId}
+            </if>
+            <if test="orderParam.startTime != null">
+                and o.create_time &gt; #{orderParam.startTime}
+            </if>
+            <if test="orderParam.endTime != null">
+                and o.create_time &lt; #{orderParam.endTime}
+            </if>
+            <if test="orderParam.orderType != null">
+                and o.order_type = #{orderParam.orderType}
+            </if>
+
+            <if test="orderParam.refundStatus == 0">
+                and o.refund_status  IS NULL
+            </if>
+        </where>
+    </select>
+
+    <select id="deliveryOrder" resultMap="BaseResultMap">
+        SELECT o.*, sd.shop_name,ch.channel_name
+        FROM tz_order o
+        LEFT JOIN tz_shop_detail sd ON o.shop_id = sd.shop_id
+        LEFT JOIN tz_channel ch ON o.channel_id = ch.id
+        join tz_user_addr_order uao ON o.addr_order_id = uao.addr_order_id
+        <where>
+            o.delete_status = 0 AND o.dvy_type = #{orderParam.dvyType}
+            <if test="orderParam.orderNumber != null and orderParam.orderNumber != ''">
+                AND o.order_number  LIKE concat('%',  #{orderParam.orderNumber}, '%')
+            </if>
+            <if test="orderParam.mobile != null and orderParam.mobile != ''">
+                AND uao.mobile LIKE concat('%', #{orderParam.mobile}, '%')
+            </if>
+            <if test="orderParam.receiver != null and orderParam.receiver != ''">
+                AND uao.receiver LIKE concat('%', #{orderParam.receiver}, '%')
+            </if>
+            <if test="orderParam.startTime != null">
+                AND o.create_time &gt;= #{orderParam.startTime}
+            </if>
+            <if test="orderParam.endTime != null">
+                AND o.create_time &lt;= #{orderParam.endTime}
+            </if>
+            <if test="orderParam.channelId != null">
+                AND o.channel_id = #{orderParam.channelId}
+            </if>
+            <if test="orderParam.shopId != null">
+                AND o.shopId = #{orderParam.shopId}
+            </if>
+            <if test="orderParam.hbOrderStatus != null">
+                <if test="orderParam.hbOrderStatus == 0">
+                    AND o.hb_order_status = 0
+                </if>
+                <if test="orderParam.hbOrderStatus == 20">
+                    AND o.hb_order_status = 20
+                </if>
+                <if test="orderParam.hbOrderStatus == 70">
+                    AND o.hb_order_status in (30,40,70)
+                </if>
+                <if test="orderParam.hbOrderStatus == 80">
+                    AND o.hb_order_status = 80
+                </if>
+                <if test="orderParam.hbOrderStatus == 60">
+                    AND o.hb_order_status in (50, 60)
+                </if>
+            </if>
+        </where>
+        ORDER BY o.create_time DESC
+    </select>
 
 </mapper>