Ver código fonte

首页统计跑腿提现等查询优化

wanxl 1 ano atrás
pai
commit
f4c1cd6346

+ 4 - 2
src/main/java/com/sqx/modules/errand/service/impl/TbIndentServiceImpl.java

@@ -1467,7 +1467,8 @@ public class TbIndentServiceImpl extends ServiceImpl<TbIndentDao, TbIndent> impl
     }
 
     @Override
-    public Result taskAnalysis(DataCenterQuery query, String indentState) {
+    public Result taskAnalysis(DataCenterQuery oldQuery, String indentState) {
+        DataCenterQuery query=DateUtils.dateStrEndTime(oldQuery);
         HashMap hashMap = new HashMap();
         //发单总金额
         BigDecimal billMoney = tbIndentDao.billMoney(query);
@@ -1489,8 +1490,9 @@ public class TbIndentServiceImpl extends ServiceImpl<TbIndentDao, TbIndent> impl
     }
 
     @Override
-    public Result selectOrderByStatus(DataCenterQuery query) {
+    public Result selectOrderByStatus(DataCenterQuery oldQuery) {
         HashMap hashMap = new HashMap();
+        DataCenterQuery query=DateUtils.dateStrEndTime(oldQuery);
         //全部
         int i = tbIndentDao.selectOrderByStatus(query, null);
         // 付款

+ 3 - 1
src/main/java/com/sqx/modules/pay/service/impl/CashOutServiceImpl.java

@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.sqx.common.constant.RedisKey;
 import com.sqx.common.exception.SqxException;
 import com.sqx.common.utils.Constant;
+import com.sqx.common.utils.DateUtils;
 import com.sqx.common.utils.PageUtils;
 import com.sqx.common.utils.Result;
 import com.sqx.modules.app.dao.UserCashOutDao;
@@ -338,8 +339,9 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
     }
 
     @Override
-    public Result incomeStatistics(DataCenterQuery query) {
+    public Result incomeStatistics(DataCenterQuery oldQuery) {
         HashMap hashMap = new HashMap();
+        DataCenterQuery query= DateUtils.dateStrEndTime(oldQuery);
         //扣除骑手保证金收入
         BigDecimal deductMoneySum = errandComplaintDao.deductMoneySum(query);
         //保价费收入

+ 2 - 2
src/main/resources/mapper/dataCentre/dataCenterMapper.xml

@@ -247,7 +247,7 @@
         ( SELECT @rank_num := 0 ) r,
         ( SELECT ifnull( sum( pay_money ), 0 ) AS shopMoney,ifnull( sum( shop_income_money ), 0 ) AS shopIncomeMoney, tor.shop_id , u.shop_name,gp.id as
         shopType,gp.shop_type_name as shopTypeName
-        FROM tb_order tor left join goods_shop u on tor.shop_id = u.shop_id
+        FROM tb_order tor force index(tb_order_pay_time_IDX) left join goods_shop u on tor.shop_id = u.shop_id
         left join shop_type gp on gp.id=u.shop_type_id
         WHERE tor.shop_id IS NOT NULL and tor.status = 4
         <if test="query.startTime != null and query.startTime !=''">
@@ -265,7 +265,7 @@
 
     <select id="selectRankingListAmount" resultType="com.sqx.modules.order.entity.TbOrder">
         SELECT ifnull( sum( pay_money ), 0 ) AS shopMoney,ifnull( sum( shop_income_money ), 0 ) AS shopIncomeMoney
-        FROM tb_order tor left join goods_shop u on tor.shop_id = u.shop_id
+        FROM tb_order tor force index(tb_order_pay_time_IDX) left join goods_shop u on tor.shop_id = u.shop_id
         left join shop_type gp on gp.id=u.shop_type_id
         WHERE tor.shop_id IS NOT NULL and tor.status = 4
         <if test="query.startTime != null and query.startTime !=''">

+ 0 - 9
src/main/resources/mapper/errand/ErrandComplaintMapper.xml

@@ -62,15 +62,6 @@
 
     <select id="deductMoneySum" resultType="java.math.BigDecimal">
         select ifnull(sum(deduct_money), 0) from errand_complaint where 1 = 1
-        <if test="query.dateType=='day'">
-            and date_format(complaint_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
-        </if>
-        <if test="query.dateType=='month'">
-            and date_format(complaint_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
-        </if>
-        <if test="query.dateType=='year'">
-            and date_format(complaint_time,'%Y')=date_format(#{query.date},'%Y')
-        </if>
         <if test="query.startTime!=null and query.startTime!=''">
             and complaint_time>=#{query.startTime}
         </if>

+ 0 - 18
src/main/resources/mapper/errand/TbIndentMapper.xml

@@ -597,15 +597,6 @@
         left join tb_user t on s.user_id = t.user_id
         left join tb_user u on s.rider_user_id = u.user_id
         where indent_state = "6"
-        <if test="query.dateType=='day'">
-            and date_format(s.create_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
-        </if>
-        <if test="query.dateType=='month'">
-            and date_format(s.create_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
-        </if>
-        <if test="query.dateType=='year'">
-            and date_format(s.create_time,'%Y')=date_format(#{query.date},'%Y')
-        </if>
         <if test="indentState!=null and indentState!=''">
             and s.indent_state = #{status}
         </if>
@@ -677,15 +668,6 @@
         <if test="status!=null">
             and indent_state = #{status}
         </if>
-        <if test="query.dateType=='day'">
-            and date_format(create_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
-        </if>
-        <if test="query.dateType=='month'">
-            and date_format(create_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
-        </if>
-        <if test="query.dateType=='year'">
-            and date_format(create_time,'%Y')=date_format(#{query.date},'%Y')
-        </if>
         <if test="query.startTime!=null and query.startTime!=''">
             and create_time>=#{query.startTime}
         </if>

+ 0 - 27
src/main/resources/mapper/pay/CashDao.xml

@@ -189,15 +189,6 @@
 
     <select id="cargoInsurance" resultType="java.math.BigDecimal">
         select ifnull(sum(cargo_insurance), 0) from tb_indent where 1 = 1
-        <if test="query.dateType=='day'">
-            and date_format(create_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
-        </if>
-        <if test="query.dateType=='month'">
-            and date_format(create_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
-        </if>
-        <if test="query.dateType=='year'">
-            and date_format(create_time,'%Y')=date_format(#{query.date},'%Y')
-        </if>
         <if test="query.startTime!=null and query.startTime!=''">
             and create_time>=#{query.startTime}
         </if>
@@ -209,15 +200,6 @@
 
     <select id="MoneySumByIndentType" resultType="java.math.BigDecimal">
         select ifnull(sum(platform_money), 0) from tb_indent where 1 = 1
-        <if test="query.dateType=='day'">
-            and date_format(create_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
-        </if>
-        <if test="query.dateType=='month'">
-            and date_format(create_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
-        </if>
-        <if test="query.dateType=='year'">
-            and date_format(create_time,'%Y')=date_format(#{query.date},'%Y')
-        </if>
         <if test="query.startTime!=null and query.startTime!=''">
             and create_time>=#{query.startTime}
         </if>
@@ -229,15 +211,6 @@
 
     <select id="cashDepositMoney" resultType="java.math.BigDecimal">
         select ifnull(sum(money), 0) from pay_details where 1 = 1
-        <if test="query.dateType=='day'">
-            and date_format(create_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
-        </if>
-        <if test="query.dateType=='month'">
-            and date_format(create_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
-        </if>
-        <if test="query.dateType=='year'">
-            and date_format(create_time,'%Y')=date_format(#{query.date},'%Y')
-        </if>
         <if test="query.startTime!=null and query.startTime!=''">
             and create_time>=#{query.startTime}
         </if>