liu 1 год назад
Родитель
Сommit
23e0ad3d43

+ 5 - 0
src/main/java/com/sqx/modules/order/controller/OrderController.java

@@ -115,4 +115,9 @@ public class OrderController extends AbstractController {
         return Result.success().put("data", appOrderService.getEvaluateList(evaluate, page, limit));
     }
 
+    @ApiOperation("店铺总交易金额")
+    @GetMapping(value = "selectAllOrderTotalPrice")
+    public Result selectAllOrderTotalPrice(OrderQueryDto queryDto) {
+        return appOrderService.selectAllOrderTotalPrice(queryDto);
+    }
 }

+ 2 - 0
src/main/java/com/sqx/modules/order/dao/AppOrderDao.java

@@ -100,4 +100,6 @@ public interface AppOrderDao extends BaseMapper<TbOrder> {
     int countCurDayPayByShopId(@Param("shopId") Long shopId, @Param("payTime") String payTime);
 
     IPage<TbOrder> selectOrderPage(Page<TbOrder> pages,@Param("userId") Long userId,@Param("orderId") Integer orderId);
+
+    BigDecimal selectAllOrderTotalPrice(@Param("query") OrderQueryDto queryDto);
 }

+ 2 - 0
src/main/java/com/sqx/modules/order/service/AppOrderService.java

@@ -172,4 +172,6 @@ public interface AppOrderService extends IService<TbOrder> {
     Result selectOrder(Long userId, Integer orderId,Integer page, Integer limit);
 
     Result updateTimeOutOrder(Long userId, Integer orderId);
+
+    Result selectAllOrderTotalPrice(OrderQueryDto queryDto);
 }

+ 6 - 0
src/main/java/com/sqx/modules/order/service/impl/AppAppOrderServiceImpl.java

@@ -2574,6 +2574,12 @@ public class AppAppOrderServiceImpl extends ServiceImpl<AppOrderDao, TbOrder> im
 
     }
 
+    @Override
+    public Result selectAllOrderTotalPrice(OrderQueryDto queryDto) {
+        BigDecimal totalPrice = appOrderDao.selectAllOrderTotalPrice(queryDto);
+        return Result.success().put("data", totalPrice);
+    }
+
     /**
      * 获取当前店铺当前订单在已支付订单中的序号
      * @param order 订单信息

+ 73 - 2
src/main/resources/mapper/order/OrderMapper.xml

@@ -395,10 +395,10 @@
             and tor.status = #{status}
         </if>
         <if test="status!=null and status==5">
-            and tor.status in (5, 8)
+            and tor.status =8
         </if>
         <if test="status==null">
-            and tor.status in (0, 7, 6, 3, 4, 5, 8)
+            and tor.status in (0, 7, 6, 3, 4, 8)
         </if>
         order by tor.pay_time desc, tor.create_time desc
 
@@ -613,5 +613,76 @@
             and tor.order_id = #{orderId}
 
     </select>
+    <select id="selectAllOrderTotalPrice" resultType="java.math.BigDecimal">
+        select SUM(tor.pay_money) as totalPrice
+        from tb_order tor
+        left join tb_user tu on tor.user_id = tu.user_id
+        left join goods_shop gs on tor.shop_id = gs.shop_id
+        left join tb_indent ti on tor.order_id = ti.order_id
+        left join tb_user tiu on tiu.user_id = ti.rider_user_id
+        left join tb_coupon_user tcu on tor.coupon_id = tcu.id
+        left join activity_part_record apr on apr.order_id = tor.order_id
+        left join activity ai on ai.id = apr.activity_id
+        left join goods_shop gs2 on gs2.shop_id=tcu.shop_id
+        where 1 = 1
+        <if test="query.riderPhone!=null and query.riderPhone!=''">
+            and tiu.phone =#{query.riderPhone}
+        </if>
+        <if test="query.shopName!=null and query.shopName!=''">
+            and gs.shop_name like concat('%',#{query.shopName},'%')
+        </if>
+        <if test="query.userName!=null and query.userName!=''">
+            and tor.user_name like concat('%',#{query.userName},'%')
+        </if>
+        <if test="query.phone!=null and query.phone!=''">
+            and tor.phone like concat('%',#{query.phone},'%')
+        </if>
+        <if test="query.orderNumber!=null and query.orderNumber!=''">
+            and tor.order_number = #{query.orderNumber}
+        </if>
+        <if test="query.status!=null and query.status!=-1 and query.status!=1">
+            and tor.status = #{query.status}
+        </if>
+        <if test="query.status!=null and query.status==1">
+            and tor.status in (1,2)
+        </if>
+        <if test="query.shopId!=null">
+            and tor.shop_id = #{query.shopId}
+        </if>
+        <if test="query.orderType!=null">
+            and tor.order_type_extra = #{query.orderType}
+        </if>
+        <if test="query.indentStatus != null and query.indentStatus != ''">
+            and ti.indent_state = #{query.indentStatus}
+        </if>
+        <if test="query.reservationFlag != null and query.reservationFlag !=''">
+            and tor.reservation_flag = #{query.reservationFlag}
+        </if>
+        <if test="query.startTime!=null and query.startTime!=''">
+            and date_format(tor.create_time,'%Y-%m-%d') >= date_format(#{query.startTime},'%Y-%m-%d')
+        </if>
+        <if test="query.endTime!=null and query.endTime!='' ">
+            and date_format(tor.create_time,'%Y-%m-%d') &lt;= date_format(#{query.endTime},'%Y-%m-%d')
+        </if>
+        <if test="query.payStartTime != null and query.payStartTime != ''">
+            and date_format(tor.pay_time,'%Y-%m-%d') >= date_format(#{query.payStartTime},'%Y-%m-%d')
+        </if>
+        <if test="query.payEndTime != null and query.payEndTime != '' ">
+            and date_format(tor.pay_time,'%Y-%m-%d') &lt;= date_format(#{query.payEndTime},'%Y-%m-%d')
+        </if>
+        <if test="query.riderStationId!=null and query.riderStationId!=''">
+            and tiu.rider_station_id=#{query.riderStationId}
+        </if>
+        <if test="query.shopTypeId!=null and query.shopTypeId!=''">
+            and gs.shop_type_id=#{query.shopTypeId}
+        </if>
+        <if test='query.couponType== "0" '>
+            and tcu.shop_id =0
+        </if>
+        <if test='query.couponType== "1"'>
+            and tcu.shop_id !=0
+        </if>
+        order by tor.pay_time desc, tor.create_time desc
+    </select>
 
 </mapper>