Browse Source

盯盘-数据格式修改

yangzian 3 years ago
parent
commit
71bb4b5857

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

@@ -96,7 +96,7 @@
     <!-- 快手 时报总消耗 及 账户数量 -->
     <select id="getKuaiShouTotalCost" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-        ROUND( SUM( charge ), 2 ) AS totalCost,
+        ROUND( SUM( charge ), 3 ) AS totalCost,
         COUNT(DISTINCT account_id) accountNum
         FROM
         application.kuaishou_account_report_hourly_dw
@@ -152,9 +152,9 @@
         COUNT(DISTINCT d.account_id) accountNum,
         d.user_id as userId,
         (SELECT u.realname from `jeecg-boot`.sys_user u where u.id = d.user_id) as userName,
-        m.newEffectNum,
-        m.newCampaignNum,
-        m.newUnitNum
+        IFNULL(m.newEffectNum,0) as newEffectNum,
+        IFNULL(m.newCampaignNum,0) as newCampaignNum,
+        IFNULL(m.newUnitNum,0) as newUnitNum
         FROM
         application.kuaishou_account_report_daily_dw d
         LEFT JOIN
@@ -203,28 +203,28 @@
         d.project_name AS projectName,
         COUNT( DISTINCT d.user_id ) AS userNum,
         SUM( d.activation ) AS activation,
-        ROUND( SUM( d.charge ) / SUM( d.activation ), 2 ) AS activationPrice,
-        CONCAT(ROUND(SUM( d.event_next_day_stay ) / SUM( d.activation ) * 100, 2 ),'%') AS leave,
+        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,
         SUM( d.event_pay ) AS eventPay,
-        ROUND( SUM( d.charge ) / SUM( d.event_pay ), 2 ) AS eventPayCost,
-        CONCAT(ROUND( SUM( d.event_pay ) / ( SUM( d.activation ) + SUM( d.form_count )) * 100, 2 ),'%') AS eventPayRate,
+        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,
         SUM( d.event_new_user_pay ) AS eventNewUserPay,
-        ROUND( SUM( d.charge ) / SUM( d.event_new_user_pay ), 2 ) AS eventNewUserPayCost,
-        CONCAT(ROUND( SUM( d.event_new_user_pay ) / ( SUM( d.activation ) + SUM( d.form_count )) * 100, 2 ),'%') AS eventNewUserPayRate,
+        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,
         SUM( d.event_app_invoked ) AS eventAppInvoked,
-        ROUND( SUM( d.charge ) / SUM( d.event_app_invoked ), 2 ) AS eventAppInvokedCost,
+        IFNULL(ROUND( SUM( d.charge ) / SUM( d.event_app_invoked ), 2 ),0) AS eventAppInvokedCost,
         SUM( d.event_register ) AS eventRegister,
-        ROUND( SUM( d.charge ) / SUM( d.event_register ), 2 ) AS eventRegisterCost,
+        IFNULL(ROUND( SUM( d.charge ) / SUM( d.event_register ), 2 ),0) AS eventRegisterCost,
         SUM( d.key_action ) AS keyAction,
-        ROUND( SUM( d.charge ) / SUM( d.key_action ), 2 ) AS keyActionCost,
-        CONCAT( ROUND( SUM( d.charge )/ SUM( d.key_action )* 100, 2 ), '%' ) AS keyActionRate,
+        IFNULL(ROUND( SUM( d.charge ) / SUM( d.key_action ), 2 ),0) AS keyActionCost,
+        IFNULL(CONCAT( ROUND( SUM( d.charge )/ SUM( d.key_action )* 100, 2 ), '%' ),0) AS keyActionRate,
         SUM( d.event_pay_purchase_amount_first_day ) AS eventPayPurchaseAmountFirstDay,
         SUM( d.event_pay_first_day_roi ) AS eventPayFirstDayRoi,
         SUM( d.form_count ) AS formCount,
-        ROUND( SUM( d.charge ) / SUM( d.form_count ), 2 ) AS formCountPrice,
-        m.newEffectNum AS newEffectNum,
-        m.newVideoNum AS newVideoNum,
-        m.newHotNum AS newHotNum
+        IFNULL(ROUND( SUM( d.charge ) / SUM( d.form_count ), 2 ),0) AS formCountPrice,
+        IFNULL(m.newEffectNum,0) AS newEffectNum,
+        IFNULL(m.newVideoNum,0) AS newVideoNum,
+        IFNULL(m.newHotNum,0) AS newHotNum
         FROM
         application.kuaishou_account_report_daily_dw d
         LEFT JOIN (
@@ -281,30 +281,30 @@
         COUNT( DISTINCT d.user_id ) AS userNum,
         ( SELECT u.realname FROM `jeecg-boot`.sys_user u WHERE u.id = d.user_id ) AS userName,
         SUM( d.activation ) AS activation,
-        ROUND( SUM( d.charge ) / SUM( d.activation ), 2 ) AS activationPrice,
-        CONCAT(ROUND(SUM( d.event_next_day_stay ) / SUM( d.activation ) * 100, 2 ),'%') AS leave,
+        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,
         SUM( d.event_pay ) AS eventPay,
-        ROUND( SUM( d.charge ) / SUM( d.event_pay ), 2 ) AS eventPayCost,
-        CONCAT(ROUND( SUM( d.event_pay ) / ( SUM( d.activation ) + SUM( d.form_count )) * 100, 2 ),'%') AS eventPayRate,
+        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,
         SUM( d.event_new_user_pay ) AS eventNewUserPay,
-        ROUND( SUM( d.charge ) / SUM( d.event_new_user_pay ), 2 ) AS eventNewUserPayCost,
-        ROUND( SUM( d.event_new_user_pay ) / ( SUM( d.activation ) + SUM( d.form_count )), 2 ) AS eventNewUserPayRate,
+        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,
         SUM( d.event_app_invoked ) AS eventAppInvoked,
-        ROUND( SUM( d.charge ) / SUM( d.event_app_invoked ), 2 ) AS eventAppInvokedCost,
+        IFNULL(ROUND( SUM( d.charge ) / SUM( d.event_app_invoked ), 2 ),0) AS eventAppInvokedCost,
         SUM( d.event_register ) AS eventRegister,
-        ROUND( SUM( d.charge ) / SUM( d.event_register ), 2 ) AS eventRegisterCost,
+        IFNULL(ROUND( SUM( d.charge ) / SUM( d.event_register ), 2 ),0) AS eventRegisterCost,
         SUM( d.key_action ) AS keyAction,
-        ROUND( SUM( d.charge ) / SUM( d.key_action ), 2 ) AS keyActionCost,
-        CONCAT( ROUND( SUM( d.charge )/ SUM( d.activation )* 100, 2 ), '%' ) AS keyActionRate,
+        IFNULL(ROUND( SUM( d.charge ) / SUM( d.key_action ), 2 ),0) AS keyActionCost,
+        IFNULL(CONCAT( ROUND( SUM( d.charge )/ SUM( d.activation )* 100, 2 ), '%' ),0) AS keyActionRate,
         SUM( d.event_pay_purchase_amount_first_day ) AS eventPayPurchaseAmountFirstDay,
         SUM( d.event_pay_first_day_roi ) AS eventPayFirstDayRoi,
         SUM( d.form_count ) AS formCount,
-        ROUND( SUM( d.charge ) / SUM( d.form_count ), 2 ) AS formCountPrice,
+        IFNULL(ROUND( SUM( d.charge ) / SUM( d.form_count ), 2 ),0) AS formCountPrice,
         SUM(d.`show`) as photoShow,
         SUM(d.photo_click) as photoClick,
-        m.newEffectNum AS newEffectNum,
-        m.newVideoNum AS newVideoNum,
-        m.newHotNum AS newHotNum
+        IFNULL(m.newEffectNum,0) AS newEffectNum,
+        IFNULL(m.newVideoNum,0) AS newVideoNum,
+        IFNULL(m.newHotNum,0) AS newHotNum
         FROM
         application.kuaishou_account_report_daily_dw d
         LEFT JOIN (

+ 2 - 2
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/impl/MaterialStareServiceImpl.java

@@ -456,7 +456,7 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                 projectInfo.setYearOnYear(yearOnYear);
 
                 //同比 日期超过 7 天 则不显示
-                String equallyRate = null;
+                String equallyRate = "-";
                 if (daysBetween <= 7){
                     List<KuaiShouOperateProjectVo> projectEquallyInfo = materialStareMapper.getKuaiShouOperateProjectInfo(startEqually,endEqually,projectId,operatorUserIds);
                     if (!Check.isNull(projectEquallyInfo)){
@@ -530,7 +530,7 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                 accountInfo.setYearOnYear(yearOnYear);
 
                 //同比 日期超过 7 天 则不显示
-                String equallyRate = null;
+                String equallyRate = "-";
                 if (daysBetween <= 7){
                     List<KuaiShouOperateAccountVo> accountEquallyInfo = materialStareMapper.getKuaiShouOperateAccountInfo(startEqually,endEqually,projectId,accountId,operatorUserIds);
                     if (!Check.isNull(accountEquallyInfo)){