From 8b09fbc19a96b57bf1d0e4d7c79b51a76aeca554 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期五, 28 三月 2025 19:57:56 +0800
Subject: [PATCH] 修改bug

---
 ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TDriverMapper.xml |   58 +++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 41 insertions(+), 17 deletions(-)

diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TDriverMapper.xml b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TDriverMapper.xml
index 97e2007..d2162c5 100644
--- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TDriverMapper.xml
+++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TDriverMapper.xml
@@ -340,22 +340,22 @@
                 IFNULL(topc1.num, 0) as privateCarTotalNum,
                 IFNULL(topc2.num, 0) as privateCarNotPayNum,
                 IFNULL(topc3.num, 0) as privateCarcancelNum,
-                IFNULL(topc4.taxiMoney, 0) + IFNULL(topc11.taxiMoney, 0) as privateCarTotalMoney,
-                IFNULL(topc5.taxiMoney, 0) as privateCarNotPayMoney,
+                IFNULL(topc4.taxiMoney, 0) + IFNULL(topc11.taxiMoney, 0) + IFNULL(topc13.taxiMoney, 0) as privateCarTotalMoney,
+                IFNULL(topc5.taxiMoney, 0) + IFNULL(topc13.taxiMoney, 0) as privateCarNotPayMoney,
             </if>
             <if test="4 == type">
                 IFNULL(topc6.num, 0) as privateCarTotalNum,
                 IFNULL(topc7.num, 0) as privateCarNotPayNum,
                 IFNULL(topc8.num, 0) as privateCarcancelNum,
-                IFNULL(topc9.taxiMoney, 0) + IFNULL(topc12.taxiMoney, 0) as privateCarTotalMoney,
-                IFNULL(topc10.taxiMoney, 0) as privateCarNotPayMoney,
+                IFNULL(topc9.taxiMoney, 0) + IFNULL(topc12.taxiMoney, 0) + IFNULL(topc14.taxiMoney, 0) as privateCarTotalMoney,
+                IFNULL(topc10.taxiMoney, 0) + IFNULL(topc14.taxiMoney, 0) as privateCarNotPayMoney,
             </if>
             <if test="null == type">
                 IFNULL(topc1.num, 0) + IFNULL(topc6.num, 0) as privateCarTotalNum,
                 IFNULL(topc2.num, 0) + IFNULL(topc7.num, 0) as privateCarNotPayNum,
                 IFNULL(topc3.num, 0) + IFNULL(topc8.num, 0) as privateCarcancelNum,
-                IFNULL(topc4.taxiMoney, 0) + IFNULL(topc9.taxiMoney, 0) + IFNULL(topc11.taxiMoney, 0) + IFNULL(topc12.taxiMoney, 0) as privateCarTotalMoney,
-                IFNULL(topc5.taxiMoney, 0) + IFNULL(topc10.taxiMoney, 0) as privateCarNotPayMoney,
+                IFNULL(topc4.taxiMoney, 0) + IFNULL(topc9.taxiMoney, 0) + IFNULL(topc11.taxiMoney, 0) + IFNULL(topc12.taxiMoney, 0) + IFNULL(topc13.taxiMoney, 0) + IFNULL(topc14.taxiMoney, 0) as privateCarTotalMoney,
+                IFNULL(topc5.taxiMoney, 0) + IFNULL(topc10.taxiMoney, 0) + IFNULL(topc13.taxiMoney, 0) + IFNULL(topc14.taxiMoney, 0) as privateCarNotPayMoney,
             </if>
             td.state as driverState,
             td.phone as driverPhone
@@ -388,18 +388,30 @@
             </if>
         GROUP BY driverId
         ) AS topc4 ON topc4.driverId = td.id
-        LEFT JOIN ( SELECT SUM(orderMoney) AS taxiMoney, driverId FROM t_order_private_car WHERE FIND_IN_SET(state, '7,12')
+        LEFT JOIN ( SELECT SUM(orderMoney) AS taxiMoney, driverId FROM t_order_private_car WHERE FIND_IN_SET(state, '7')
             <if test="null != start and '' != start and null != end and '' != end">
                 and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
             </if>
         GROUP BY driverId
         ) AS topc5 ON topc5.driverId = td.id
-        LEFT JOIN ( SELECT SUM(money) AS taxiMoney, objectId as driverId FROM t_income WHERE type = 3 and userType = 2 and orderType = 1
-        <if test="null != start and '' != start and null != end and '' != end">
-            and DATE_FORMAT(insertTime, '%Y-%m-%d') between #{start} and #{end}
-        </if>
-        GROUP BY objectId
-        ) AS topc11 ON topc11.driverId = td.id
+            LEFT JOIN (
+            SELECT SUM(a.money) AS taxiMoney, b.driverId FROM t_order_cancel a
+            left join t_order_private_car b on (a.orderId = b.id and a.orderType = 1)
+            where FIND_IN_SET(b.state, '10')
+            <if test="null != start and '' != start and null != end and '' != end">
+                and DATE_FORMAT(b.travelTime, '%Y-%m-%d') between #{start} and #{end}
+            </if>
+            group by b.driverId
+            ) AS topc11 ON topc11.driverId = td.id
+        LEFT JOIN (
+            SELECT SUM(a.money) AS taxiMoney, b.driverId FROM t_order_cancel a
+            left join t_order_private_car b on (a.orderId = b.id and a.orderType = 1)
+            where FIND_IN_SET(b.state, '12')
+            <if test="null != start and '' != start and null != end and '' != end">
+                and DATE_FORMAT(b.travelTime, '%Y-%m-%d') between #{start} and #{end}
+            </if>
+            group by b.driverId
+        ) AS topc13 ON topc13.driverId = td.id
         </if>
         <if test="null == type or 4 == type">
             LEFT JOIN ( SELECT COUNT(id) AS num, driverId FROM t_order_logistics WHERE FIND_IN_SET(state, '7,8,9,10,12')
@@ -426,18 +438,30 @@
             </if>
             GROUP BY driverId
             ) AS topc9 ON topc9.driverId = td.id
-            LEFT JOIN ( SELECT SUM(orderMoney) AS taxiMoney, driverId FROM t_order_logistics WHERE FIND_IN_SET(state, '7,12')
+            LEFT JOIN ( SELECT SUM(orderMoney) AS taxiMoney, driverId FROM t_order_logistics WHERE FIND_IN_SET(state, '7')
             <if test="null != start and '' != start and null != end and '' != end">
                 and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
             </if>
             GROUP BY driverId
             ) AS topc10 ON topc10.driverId = td.id
-            LEFT JOIN ( SELECT SUM(money) AS taxiMoney, objectId as driverId FROM t_income WHERE type = 3 and userType = 2 and orderType = 4
+            LEFT JOIN (
+            SELECT SUM(a.money) AS taxiMoney, b.driverId FROM t_order_cancel a
+            left join t_order_logistics b on (a.orderId = b.id and a.orderType = 4)
+            where FIND_IN_SET(b.state, '10')
             <if test="null != start and '' != start and null != end and '' != end">
-                and DATE_FORMAT(insertTime, '%Y-%m-%d') between #{start} and #{end}
+                and DATE_FORMAT(b.travelTime, '%Y-%m-%d') between #{start} and #{end}
             </if>
-            GROUP BY objectId
+            group by b.driverId
             ) AS topc12 ON topc12.driverId = td.id
+            LEFT JOIN (
+            SELECT SUM(a.money) AS taxiMoney, b.driverId FROM t_order_cancel a
+            left join t_order_logistics b on (a.orderId = b.id and a.orderType = 4)
+            where FIND_IN_SET(b.state, '12')
+            <if test="null != start and '' != start and null != end and '' != end">
+                and DATE_FORMAT(b.travelTime, '%Y-%m-%d') between #{start} and #{end}
+            </if>
+            group by b.driverId
+            ) AS topc14 ON topc14.driverId = td.id
         </if>
         <where>
             <if test="null!= companyId and '' != companyId">

--
Gitblit v1.7.1