Browse Source

盯盘-账户余额

yangzian 3 years ago
parent
commit
41fbd588c4

+ 23 - 28
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/MaterialStareMapper.xml

@@ -361,7 +361,7 @@
             advertiser_id as accountId,
             balance
         FROM media_api.kuaishou_advertiser_fund_get
-        where d.account_id = #{accountId}
+        where advertiser_id = #{accountId}
 
     </select>
 
@@ -369,22 +369,17 @@
     <!-- 快手 账户 余额 以及状态 -->
     <select id="getKuaiShouAccountTotalCost" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-        SUM(h.charge) todayCost,
-        u.account_status as accountStatus,
         u.account_id as accountId,
-        u.auth_name as accountName
-        from
-        application.kuaishou_account_report_hourly_dw h
-        LEFT JOIN `jeecg-boot`.`ctop_user_allocation` u
-        on u.account_id = h.account_id
-        <where>
-            <if test="accountId != null and accountId != '' ">
-                and h.account_id = #{accountId}
-            </if>
-            <if test="statDate != null and statDate != '' ">
-                and h.stat_date = #{statDate}
-            </if>
-        </where>
+        u.auth_name as accountName,
+        u.account_status as accountStatus,
+        SUM( h.charge ) todayCost
+        FROM
+        `jeecg-boot`.`ctop_user_allocation` u
+        LEFT JOIN application.kuaishou_account_report_hourly_dw h
+        ON u.account_id = h.account_id
+        and h.account_id = #{accountId}
+        and h.stat_date = #{statDate}
+
     </select>
 
 
@@ -406,7 +401,7 @@
                         IFNULL(ROUND( (h.charge  /  h.activation) , 2 ),0) AS tData,
                     </if>
                     <if test='type == "leave"'>
-                        IF(( h.event_next_day_stay  /  h.activation ) > 0.0001,CONCAT(ROUND(( h.event_next_day_stay  / h.activation ) * 100, 2 ),'%'),0) AS tData,
+                        IF(( h.event_next_day_stay  /  h.activation ) > 0.0001,ROUND(( h.event_next_day_stay  / h.activation ) * 100, 2 ),0) AS tData,
                     </if>
                     <if test='type == "eventPay"'>
                         IFNULL( h.event_pay ,0) AS tData,
@@ -415,7 +410,7 @@
                         IFNULL(ROUND(  (h.charge  /  h.event_pay ), 2 ),0) AS tData,
                     </if>
                     <if test='type == "eventPayRate"'>
-                        IF(( h.event_pay  /   h.activation  +  h.form_count ) > 0.0001,CONCAT(ROUND( ( h.event_pay  /  h.activation  +  h.form_count ) * 100, 2 ),'%'),0) AS tData,
+                        IF(( h.event_pay  /   h.activation  +  h.form_count ) > 0.0001,ROUND( ( h.event_pay  /  h.activation  +  h.form_count ) * 100, 2 ),0) AS tData,
                     </if>
                     <if test='type == "eventNewUserPay"'>
                         IFNULL( h.event_new_user_pay ,0) AS tData,
@@ -424,7 +419,7 @@
                         IFNULL(ROUND( ( h.charge  /  h.event_new_user_pay ), 2 ),0) AS tData,
                     </if>
                     <if test='type == "eventNewUserPayRate"'>
-                        IFNULL(ROUND( ( h.event_new_user_pay  /   h.activation  +  h.form_count ), 2 ),0) AS tData,
+                        IFNULL(ROUND( ( h.event_new_user_pay  /   (h.activation  +  h.form_count) ) * 100, 2 ),0) AS tData,
                     </if>
                     <if test='type == "eventAppInvoked"'>
                         IFNULL( h.event_app_invoked ,0) AS tData,
@@ -445,7 +440,7 @@
                         IFNULL(ROUND( ( h.charge  /  h.key_action ), 2 ),0) AS tData,
                     </if>
                     <if test='type == "keyActionRate"'>
-                        IF(( h.key_action /  h.activation ) > 0.0001,CONCAT( ROUND(( h.key_action / h.activation ) * 100 , 2 ), '%' ),0) AS tData,
+                        IF(( h.key_action /  h.activation ) > 0.0001,CONCAT( ( h.key_action / h.activation ) * 100 , 2 ),0) AS tData,
                     </if>
                     <if test='type == "eventPayPurchaseAmountFirstDay"'>
                         IFNULL( h.event_pay_purchase_amount_first_day ,0) AS tData,
@@ -493,7 +488,7 @@
                         IFNULL(ROUND( (h.charge  /  h.activation) , 2 ),0) AS yData,
                     </if>
                     <if test='type == "leave"'>
-                        IF(( h.event_next_day_stay  /  h.activation ) > 0.0001,CONCAT(ROUND(( h.event_next_day_stay  / h.activation ) * 100, 2 ),'%'),0) AS yData,
+                        IF(( h.event_next_day_stay  /  h.activation ) > 0.0001,ROUND(( h.event_next_day_stay  / h.activation ) * 100, 2 ),0) AS yData,
                     </if>
                     <if test='type == "eventPay"'>
                         IFNULL( h.event_pay ,0) AS yData,
@@ -502,7 +497,7 @@
                         IFNULL(ROUND(  (h.charge  /  h.event_pay ), 2 ),0) AS yData,
                     </if>
                     <if test='type == "eventPayRate"'>
-                        IF(( h.event_pay  /   h.activation  +  h.form_count ) > 0.0001,CONCAT(ROUND( ( h.event_pay  /  h.activation  +  h.form_count ) * 100, 2 ),'%'),0) AS yData,
+                        IF(( h.event_pay  /   h.activation  +  h.form_count ) > 0.0001,ROUND( ( h.event_pay  /  h.activation  +  h.form_count ) * 100, 2 ),0) AS yData,
                     </if>
                     <if test='type == "eventNewUserPay"'>
                         IFNULL( h.event_new_user_pay ,0) AS yData,
@@ -511,7 +506,7 @@
                         IFNULL(ROUND( ( h.charge  /  h.event_new_user_pay ), 2 ),0) AS yData,
                     </if>
                     <if test='type == "eventNewUserPayRate"'>
-                        IFNULL(ROUND( ( h.event_new_user_pay  /   h.activation  +  h.form_count ), 2 ),0) AS yData,
+                        IFNULL(ROUND( ( h.event_new_user_pay  /   (h.activation  +  h.form_count) ) * 100, 2 ),0) AS yData,
                     </if>
                     <if test='type == "eventAppInvoked"'>
                         IFNULL( h.event_app_invoked ,0) AS yData,
@@ -532,7 +527,7 @@
                         IFNULL(ROUND( ( h.charge  /  h.key_action ), 2 ),0) AS yData,
                     </if>
                     <if test='type == "keyActionRate"'>
-                        IF(( h.key_action /  h.activation ) > 0.0001,CONCAT( ROUND(( h.key_action / h.activation ) * 100 , 2 ), '%' ),0) AS yData,
+                        IF(( h.key_action /  h.activation ) > 0.0001, ROUND(( h.key_action / h.activation ) * 100 , 2 ),0) AS yData,
                     </if>
                     <if test='type == "eventPayPurchaseAmountFirstDay"'>
                         IFNULL( h.event_pay_purchase_amount_first_day ,0) AS yData,
@@ -584,7 +579,7 @@
                 IFNULL(ROUND( SUM( d.charge ) / SUM( d.activation ), 2 ),0) AS data,
             </if>
             <if test='type == "leave"'>
-                IF(SUM( d.event_next_day_stay ) / SUM( d.activation ) > 0.0001,CONCAT(ROUND(SUM( d.event_next_day_stay ) / SUM( d.activation ) * 100, 2 ),'%'),0) AS data,
+                IF(SUM( d.event_next_day_stay ) / SUM( d.activation ) > 0.0001,ROUND(SUM( d.event_next_day_stay ) / SUM( d.activation ) * 100, 2 ),0) AS data,
             </if>
             <if test='type == "eventPay"'>
                 IFNULL(SUM( d.event_pay ),0) AS data,
@@ -593,7 +588,7 @@
                 IFNULL(ROUND( SUM( d.charge ) / SUM( d.event_pay ), 2 ),0) AS data,
             </if>
             <if test='type == "eventPayRate"'>
-                IF(SUM( d.event_pay ) / ( SUM( d.activation ) + SUM( d.form_count )) > 0.0001,CONCAT(ROUND( SUM( d.event_pay ) / ( SUM( d.activation ) + SUM( d.form_count )) * 100, 2 ),'%'),0) AS data,
+                IF(SUM( d.event_pay ) / ( SUM( d.activation ) + SUM( d.form_count )) > 0.0001,ROUND( SUM( d.event_pay ) / ( SUM( d.activation ) + SUM( d.form_count )) * 100, 2 ),0) AS data,
             </if>
             <if test='type == "eventNewUserPay"'>
                 IFNULL(SUM( d.event_new_user_pay ),0) AS data,
@@ -602,7 +597,7 @@
                 IFNULL(ROUND( SUM( d.charge ) / SUM( d.event_new_user_pay ), 2 ),0) AS data,
             </if>
             <if test='type == "eventNewUserPayRate"'>
-                IFNULL(ROUND( SUM( d.event_new_user_pay ) / ( SUM( d.activation ) + SUM( d.form_count )), 2 ),0) AS data,
+                IFNULL(ROUND( (SUM( d.event_new_user_pay ) / ( SUM( d.activation ) + SUM( d.form_count ))) * 100, 2 ),0) AS data,
             </if>
             <if test='type == "eventAppInvoked"'>
                 IFNULL(SUM( d.event_app_invoked ),0) AS data,
@@ -623,7 +618,7 @@
                 IFNULL(ROUND( SUM( d.charge ) / SUM( d.key_action ), 2 ),0) AS data,
             </if>
             <if test='type == "keyActionRate"'>
-                IF(SUM( d.key_action )/ SUM( d.activation ) > 0.0001,CONCAT( ROUND(SUM( d.key_action )/ SUM( d.activation ) * 100 , 2 ), '%' ),0) AS data,
+                IF(SUM( d.key_action )/ SUM( d.activation ) > 0.0001, ROUND(SUM( d.key_action )/ SUM( d.activation ) * 100 , 2 ),0) AS data,
             </if>
             <if test='type == "eventPayPurchaseAmountFirstDay"'>
                 IFNULL(SUM( d.event_pay_purchase_amount_first_day ),0) AS data,