Explorar el Código

盯盘-项目、账户维度数据格式修改

yangzian hace 3 años
padre
commit
3f6103004e

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

@@ -203,21 +203,21 @@
         d.project_name AS projectName,
         COUNT( DISTINCT d.user_id ) AS userNum,
         IFNULL(SUM( d.activation ),0)  AS activation,
-        IFNULL(ROUND( SUM( d.charge ) / SUM( d.activation ), 2 ),0) AS activationPrice,
-        IFNULL(CONCAT(ROUND(SUM( d.event_next_day_stay ) / SUM( d.activation ) * 100, 2 ),'%'),0) AS leave,
+        IF(SUM( d.charge ) / SUM( d.activation ) > 0.0001,ROUND( SUM( d.charge ) / SUM( d.activation ), 2 ),0) AS activationPrice,
+        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 leave,
         IFNULL(SUM( d.event_pay ),0)  AS eventPay,
-        IFNULL(ROUND( SUM( d.charge ) / SUM( d.event_pay ), 2 ),0) AS eventPayCost,
-        IFNULL( CONCAT(ROUND( SUM( d.event_pay ) / ( SUM( d.activation ) + SUM( d.form_count )) * 100, 2 ),'%'),0) AS eventPayRate,
+        IF(SUM( d.charge ) / SUM( d.event_pay ) > 0.0001,ROUND( SUM( d.charge ) / SUM( d.event_pay ), 2 ),0) AS eventPayCost,
+        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 eventPayRate,
         IFNULL(SUM( d.event_new_user_pay ),0)  AS eventNewUserPay,
-        IFNULL(ROUND( SUM( d.charge ) / SUM( d.event_new_user_pay ), 2 ),0) AS eventNewUserPayCost,
-        IFNULL(CONCAT(ROUND( SUM( d.event_new_user_pay ) / ( SUM( d.activation ) + SUM( d.form_count )) * 100, 2 ),'%'),0) AS eventNewUserPayRate,
+        IF(SUM( d.charge ) / SUM( d.event_new_user_pay) > 0.0001,ROUND( SUM( d.charge ) / SUM( d.event_new_user_pay ), 2 ),0)AS eventNewUserPayCost,
+        IF(SUM( d.event_new_user_pay ) / ( SUM( d.activation ) + SUM( d.form_count )) > 0.0001 ,CONCAT(ROUND( SUM( d.event_new_user_pay ) / ( SUM( d.activation ) + SUM( d.form_count )) * 100, 2 ),'%'),0 ) AS eventNewUserPayRate,
         IFNULL(SUM( d.event_app_invoked ),0)  AS eventAppInvoked,
         IFNULL(ROUND( SUM( d.charge ) / SUM( d.event_app_invoked ), 2 ),0) AS eventAppInvokedCost,
         IFNULL(SUM( d.event_register ),0)  AS eventRegister,
         IFNULL(ROUND( SUM( d.charge ) / SUM( d.event_register ), 2 ),0) AS eventRegisterCost,
         IFNULL(SUM( d.key_action ),0)  AS keyAction,
         IFNULL(ROUND( SUM( d.charge ) / SUM( d.key_action ), 2 ),0) AS keyActionCost,
-        IFNULL(CONCAT( ROUND( SUM( d.key_action )/ SUM( d.activation )* 100, 2 ), '%' ),0) AS keyActionRate,
+        IF(SUM( d.key_action )/ SUM( d.activation ) > 0.0001,CONCAT( ROUND(SUM( d.key_action )/ SUM( d.activation ) * 100 , 2 ), '%' ),0) AS keyActionRate,
         IFNULL(SUM( d.event_pay_purchase_amount_first_day ),0)  AS eventPayPurchaseAmountFirstDay,
         IFNULL(SUM( d.event_pay_first_day_roi ),0)  AS eventPayFirstDayRoi,
         IFNULL(SUM( d.form_count ),0) AS formCount,
@@ -282,10 +282,10 @@
         ( SELECT u.realname FROM `jeecg-boot`.sys_user u WHERE u.id = d.user_id ) AS userName,
         IFNULL(SUM( d.activation ),0) AS activation,
         IFNULL(ROUND( SUM( d.charge ) / SUM( d.activation ), 2 ),0) AS activationPrice,
-        IFNULL(CONCAT(ROUND(SUM( d.event_next_day_stay ) / SUM( d.activation ) * 100, 2 ),'%'),0) AS 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 leave,
         IFNULL(SUM( d.event_pay ),0) AS eventPay,
         IFNULL(ROUND( SUM( d.charge ) / SUM( d.event_pay ), 2 ),0) AS eventPayCost,
-        IFNULL(CONCAT(ROUND( SUM( d.event_pay ) / ( SUM( d.activation ) + SUM( d.form_count )) * 100, 2 ),'%'),0) AS 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 eventPayRate,
         IFNULL(SUM( d.event_new_user_pay ),0) AS eventNewUserPay,
         IFNULL(ROUND( SUM( d.charge ) / SUM( d.event_new_user_pay ), 2 ),0) AS eventNewUserPayCost,
         IFNULL(ROUND( SUM( d.event_new_user_pay ) / ( SUM( d.activation ) + SUM( d.form_count )), 2 ),0) AS eventNewUserPayRate,
@@ -295,7 +295,7 @@
         IFNULL(ROUND( SUM( d.charge ) / SUM( d.event_register ), 2 ),0) AS eventRegisterCost,
         IFNULL(SUM( d.key_action ),0) AS keyAction,
         IFNULL(ROUND( SUM( d.charge ) / SUM( d.key_action ), 2 ),0) AS keyActionCost,
-        IFNULL(CONCAT( ROUND( SUM( d.key_action )/ SUM( d.activation )* 100, 2 ), '%' ),0) AS keyActionRate,
+        IF(SUM( d.key_action )/ SUM( d.activation ) > 0.0001,CONCAT( ROUND(SUM( d.key_action )/ SUM( d.activation ) * 100 , 2 ), '%' ),0) AS keyActionRate,
         IFNULL(SUM( d.event_pay_purchase_amount_first_day ),0) AS eventPayPurchaseAmountFirstDay,
         IFNULL(SUM( d.event_pay_first_day_roi ),0) AS eventPayFirstDayRoi,
         IFNULL(SUM( d.form_count ),0) AS formCount,