Pārlūkot izejas kodu

中台订单相关金额逻辑修改

zhangchen 3 mēneši atpakaļ
vecāks
revīzija
a76746ba9e

+ 11 - 7
alien-entity/src/main/resources/mapper/ManagementInfoMapper.xml

@@ -253,16 +253,20 @@
         </if>
     </select>
     <select id="getPlatformNetProfit" resultType="shop.alien.entity.store.vo.ManagementInfoVo">
-        SELECT
-            IFNULL(ROUND(sum(final_price) * 0.04,2) ,0) AS profit
+        select IFNULL(ROUND(sum(all_data.platform_profit),2), 0) AS profit from
+        (SELECT
+        ROUND(SUM(final_price) * (IFNULL(store.commission_rate, 3)/100),2) AS platform_profit
         FROM
-            life_user_order
+        life_user_order `order`
+        LEFT JOIN store_info store ON store.id = `order`.store_id
         WHERE
-            `status` = 1
+        `status` = 1
         <if test="dataTime != null and dataTime != ''">
             AND
-            used_time > #{dataTime}
+            `order`.used_time > #{dataTime}
         </if>
+        GROUP BY
+        store.id) all_data
     </select>
     <select id="getOrderQuantity" resultType="shop.alien.entity.store.vo.ManagementInfoVo">
         SELECT
@@ -675,8 +679,8 @@
             store_id,
             store.store_name,
             ROUND(SUM(final_price), 2 ) AS operation_revenue,
-            ROUND(SUM(final_price) * 0.96,2) AS store_profit,
-            ROUND(SUM(final_price) * 0.04,2) AS platform_profit
+            ROUND(SUM(final_price) * (1-IFNULL(store.commission_rate, 3)/100),2) AS store_profit,
+            ROUND(SUM(final_price) * (IFNULL(store.commission_rate, 3)/100),2) AS platform_profit
         FROM
             life_user_order `order`
                 LEFT JOIN store_info store ON store.id = `order`.store_id