Browse Source

运营绩效功能,优化问题

zhaoxian 2 years ago
parent
commit
78214aa4b9

+ 17 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouOperationReportMapper.xml

@@ -220,16 +220,31 @@
     <select id="getManageChargeCommission" resultType="java.math.BigDecimal">
     <select id="getManageChargeCommission" resultType="java.math.BigDecimal">
         SELECT IFNULL(ROUND(t1.totalCharge - t2.JLCharge - t2.KFCharge, 3), 0.0)
         SELECT IFNULL(ROUND(t1.totalCharge - t2.JLCharge - t2.KFCharge, 3), 0.0)
         FROM (
         FROM (
-                 SELECT SUM(charge) as 'totalCharge'
+                 SELECT SUM(charge) AS 'totalCharge'
                  FROM application.kuaishou_operation_performance_base
                  FROM application.kuaishou_operation_performance_base
                  WHERE leader_id = #{userId}
                  WHERE leader_id = #{userId}
+                   AND user_id NOT IN (
+                     SELECT assistant_id
+                     FROM sys_operate_rel
+                     WHERE operate_id = #{userId}
+                       AND stat_month >= DATE_FORMAT(#{startDate}, '%Y-%m')
+                       AND stat_month &lt;= DATE_FORMAT(#{endDate}, '%Y-%m')
+                 )
                    AND stat_date >= #{startDate}
                    AND stat_date >= #{startDate}
                    AND stat_date &lt;= #{endDate}
                    AND stat_date &lt;= #{endDate}
              ) t1
              ) t1
                  LEFT JOIN (
                  LEFT JOIN (
-            SELECT SUM(contract_rebate_real_charged_in_yuan) as 'KFCharge', SUM(direct_rebate_real_charged_in_yuan) as 'JLCharge'
+            SELECT SUM(contract_rebate_real_charged_in_yuan) as 'KFCharge', SUM(direct_rebate_real_charged_in_yuan) as
+        'JLCharge'
             FROM application.kuaishou_operation_performance_back_charge_base
             FROM application.kuaishou_operation_performance_back_charge_base
             WHERE leader_id = #{userId}
             WHERE leader_id = #{userId}
+              AND user_id NOT IN (
+                SELECT assistant_id
+                FROM sys_operate_rel
+                WHERE operate_id = #{userId}
+                  AND stat_month >= DATE_FORMAT(#{startDate}, '%Y-%m')
+                  AND stat_month &lt;= DATE_FORMAT(#{endDate}, '%Y-%m')
+            )
               AND stat_date >= #{startDate}
               AND stat_date >= #{startDate}
               AND stat_date &lt;= #{endDate}
               AND stat_date &lt;= #{endDate}
         ) t2 ON 1 = 1
         ) t2 ON 1 = 1