|
@@ -6,7 +6,7 @@
|
|
|
<select id="getKuaiShouCostHourlyByUserIdList" resultType="Map">
|
|
|
SELECT
|
|
|
t.`hour`,
|
|
|
- ROUND( SUM( charge ), 3 ) AS totalCost
|
|
|
+ ROUND( SUM( charge ), 2 ) AS totalCost
|
|
|
FROM
|
|
|
application.kuaishou_account_report_hourly_dw t
|
|
|
where
|
|
@@ -53,7 +53,7 @@
|
|
|
<!--快手 -日报 -->
|
|
|
<select id="getKuaiShouCostDailyByUserIdList" resultType="Map">
|
|
|
SELECT DATE_FORMAT(t.stat_date,'%Y-%m-%d') as dateTime,
|
|
|
- ROUND(SUM(charge),3) as totalCost
|
|
|
+ ROUND(SUM(charge),2) as totalCost
|
|
|
FROM application.kuaishou_account_report_daily_dw t
|
|
|
WHERE
|
|
|
t.stat_date >= #{startDate}
|
|
@@ -96,7 +96,7 @@
|
|
|
<!-- 快手 时报总消耗 及 账户数量 -->
|
|
|
<select id="getKuaiShouTotalCost" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
SELECT
|
|
|
- ROUND( SUM( charge ), 3 ) AS totalCost,
|
|
|
+ ROUND( SUM( charge ), 2 ) AS totalCost,
|
|
|
COUNT(DISTINCT account_id) accountNum
|
|
|
FROM
|
|
|
application.kuaishou_account_report_hourly_dw
|
|
@@ -182,20 +182,20 @@
|
|
|
COUNT( DISTINCT d.user_id ) AS userNum,
|
|
|
SUM( d.activation ) AS activation,
|
|
|
ROUND( SUM( d.charge ) / SUM( d.activation ), 2 ) AS activationPrice,
|
|
|
- ROUND( SUM( d.event_next_day_stay ) / SUM( d.activation ), 2 ) AS leave,
|
|
|
+ CONCAT(ROUND(SUM( d.event_next_day_stay ) / SUM( d.activation ) * 100, 2 ),'%') AS leave,
|
|
|
SUM( d.event_pay ) AS eventPay,
|
|
|
ROUND( SUM( d.charge ) / SUM( d.event_pay ), 2 ) AS eventPayCost,
|
|
|
- ROUND( SUM( d.event_pay ) / ( SUM( d.activation ) + SUM( d.form_count )), 2 ) AS eventPayRate,
|
|
|
+ CONCAT(ROUND( SUM( d.event_pay ) / ( SUM( d.activation ) + SUM( d.form_count )) * 100, 2 ),'%') 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,
|
|
|
+ CONCAT(ROUND( SUM( d.event_new_user_pay ) / ( SUM( d.activation ) + SUM( d.form_count )) * 100, 2 ),'%') AS eventNewUserPayRate,
|
|
|
SUM( d.event_app_invoked ) AS eventAppInvoked,
|
|
|
ROUND( SUM( d.charge ) / SUM( d.event_app_invoked ), 2 ) AS eventAppInvokedCost,
|
|
|
SUM( d.event_register ) AS eventRegister,
|
|
|
ROUND( SUM( d.charge ) / SUM( d.event_register ), 2 ) 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,
|
|
|
+ CONCAT( ROUND( SUM( d.charge )/ SUM( d.key_action )* 100, 2 ), '%' ) 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,
|
|
@@ -253,16 +253,17 @@
|
|
|
SELECT
|
|
|
SUM( d.charge ) AS totalCost,
|
|
|
d.account_id as accountId,
|
|
|
+ d.account_name as accountName,
|
|
|
d.project_id AS projectId,
|
|
|
d.project_name AS projectName,
|
|
|
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,
|
|
|
- ROUND( SUM( d.event_next_day_stay ) / SUM( d.activation ), 2 ) AS leave,
|
|
|
+ CONCAT(ROUND(SUM( d.event_next_day_stay ) / SUM( d.activation ) * 100, 2 ),'%') AS leave,
|
|
|
SUM( d.event_pay ) AS eventPay,
|
|
|
ROUND( SUM( d.charge ) / SUM( d.event_pay ), 2 ) AS eventPayCost,
|
|
|
- ROUND( SUM( d.event_pay ) / ( SUM( d.activation ) + SUM( d.form_count )), 2 ) AS eventPayRate,
|
|
|
+ CONCAT(ROUND( SUM( d.event_pay ) / ( SUM( d.activation ) + SUM( d.form_count )) * 100, 2 ),'%') 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,
|
|
@@ -351,7 +352,9 @@
|
|
|
<select id="getKuaiShouAccountTotalCost" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
SELECT
|
|
|
SUM(h.charge) todayCost,
|
|
|
- u.account_status as accountStatus
|
|
|
+ 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
|
|
@@ -405,8 +408,8 @@
|
|
|
<if test="accountId != null and accountId != '' ">
|
|
|
and h.account_id = #{accountId}
|
|
|
</if>
|
|
|
- <if test="statDate != null and statDate != '' ">
|
|
|
- and h.stat_date = #{statDate}
|
|
|
+ <if test="endDate != null and endDate != '' ">
|
|
|
+ and h.stat_date = #{endDate}
|
|
|
</if>
|
|
|
</where>
|
|
|
ORDER BY
|
|
@@ -419,6 +422,7 @@
|
|
|
<!-- 快手 账户趋势图-日报 -->
|
|
|
<select id="getKuaiShouAccountInfoBrokenLineDaily" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
SELECT
|
|
|
+ DATE_FORMAT(d.stat_date,'%Y-%m-%d') as dateTime,
|
|
|
SUM( d.charge ) as cost,
|
|
|
IFNULL( ROUND( SUM( d.charge ) / SUM( d.activation ), 2 ), 0 ) AS activationPrice,
|
|
|
IFNULL( ROUND( SUM( d.charge ) / SUM( d.event_new_user_pay ), 2 ), 0 ) AS eventNewUserPayCost,
|
|
@@ -443,14 +447,72 @@
|
|
|
</select>
|
|
|
|
|
|
<!-- 快手 账户 素材上新-有效-爆款 searchType: 0-全部 1-上新 2-有效 3-爆款-->
|
|
|
+ <select id="getKuaiShouAccountPieScene" resultType="org.jeecg.ctop.material.entity.vo.KuaiShouAccountPieVo">
|
|
|
+ SELECT
|
|
|
+ <if test='type == "cost"'>
|
|
|
+ SUM( d.charge ) AS cost,
|
|
|
+ </if>
|
|
|
+ <if test='type == "activation"'>
|
|
|
+ SUM( d.activation ) AS activation,
|
|
|
+ </if>
|
|
|
+ <if test='type == "activationPrice"'>
|
|
|
+ IFNULL( ROUND( SUM( d.charge ) / SUM( d.activation ), 2 ), 0 ) AS activationPrice,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventPayRoi"'>
|
|
|
+ SUM( d.event_pay_roi ) AS eventPayRoi,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventPay"'>
|
|
|
+ SUM( d.event_pay ) AS eventPay,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventPayCost"'>
|
|
|
+ IFNULL( ROUND( SUM( d.charge ) / SUM( d.event_pay ), 2 ), 0 ) AS eventPayCost,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventPayPurchaseAmountFirstDay"'>
|
|
|
+ SUM( d.event_pay_purchase_amount_first_day ) AS eventPayPurchaseAmountFirstDay,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventNextDayStay"'>
|
|
|
+ SUM( d.event_next_day_stay ) AS eventNextDayStay,
|
|
|
+ </if>
|
|
|
+ <if test='type == "leave"'>
|
|
|
+ IFNULL( ROUND( SUM( d.event_next_day_stay ) / SUM( d.activation ), 2 ), 0 ) AS leave,
|
|
|
+ </if>
|
|
|
+ d.ad_scene AS adScene
|
|
|
+ FROM
|
|
|
+ application.app_kuaishou_account_ad_scene_report_d d
|
|
|
+ <where>
|
|
|
+ <if test="accountId != null and accountId != '' ">
|
|
|
+ and d.account_id = #{accountId}
|
|
|
+ </if>
|
|
|
+ <if test="startDate != null and startDate != '' ">
|
|
|
+ and d.stat_date >= #{startDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != '' ">
|
|
|
+ and d.stat_date <= #{endDate}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY
|
|
|
+ d.ad_scene
|
|
|
+ ORDER BY
|
|
|
+ d.ad_scene
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 快手 账户饼图图-分版位 -->
|
|
|
<select id="getKuaiShouAccountMaterialNewAndEffectAndFaddish" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
SELECT
|
|
|
+ DATE_FORMAT(m.media_time,'%Y-%m-%d') as dateTime,
|
|
|
vd.signature,
|
|
|
+ m.material_name as videoName,
|
|
|
+ m.video_url as videoUrl,
|
|
|
SUM( vd.charge ) AS totalCost,
|
|
|
SUM( vd.activation ) AS activation,
|
|
|
ROUND(( SUM( vd.charge ) / SUM( vd.activation ) ), 2 ) AS activationPrice,
|
|
|
vd.stat_date AS statDate,
|
|
|
- m.media_time AS mediaTime
|
|
|
+ m.media_time AS mediaTime,
|
|
|
+ SUM(vd.show) as showNum
|
|
|
FROM
|
|
|
application.kuaishou_material_video_report_daily_dw vd,
|
|
|
application.app_kuaishou_material_info m
|
|
@@ -479,55 +541,37 @@
|
|
|
</select>
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- <!-- 快手 账户饼图图-分版位 -->
|
|
|
- <select id="getKuaiShouAccountPieScene" resultType="org.jeecg.ctop.material.entity.vo.KuaiShouAccountPieVo">
|
|
|
- SELECT
|
|
|
- d.ad_scene AS adScene,
|
|
|
- SUM( d.charge ) AS cost,
|
|
|
- SUM( d.activation ) AS activation,
|
|
|
- IFNULL( ROUND( SUM( d.charge ) / SUM( d.activation ), 2 ), 0 ) AS activationPrice,
|
|
|
- SUM( d.event_pay_roi ) AS eventPayRoi,
|
|
|
- SUM( d.event_pay ) AS eventPay,
|
|
|
- IFNULL( ROUND( SUM( d.charge ) / SUM( d.event_pay ), 2 ), 0 ) AS eventPayCost,
|
|
|
- SUM( d.event_pay_purchase_amount_first_day ) AS eventPayPurchaseAmountFirstDay,
|
|
|
- SUM( d.event_next_day_stay ) AS event_next_day_stay,
|
|
|
- IFNULL( ROUND( SUM( d.event_next_day_stay ) / SUM( d.activation ), 2 ), 0 ) AS leave
|
|
|
- FROM
|
|
|
- application.app_kuaishou_account_ad_scene_report_d d
|
|
|
- <where>
|
|
|
- <if test="accountId != null and accountId != '' ">
|
|
|
- and d.account_id = #{accountId}
|
|
|
- </if>
|
|
|
- <if test="startDate != null and startDate != '' ">
|
|
|
- and d.stat_date >= #{startDate}
|
|
|
- </if>
|
|
|
- <if test="endDate != null and endDate != '' ">
|
|
|
- and d.stat_date <= #{endDate}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- GROUP BY
|
|
|
- d.ad_scene
|
|
|
- ORDER BY
|
|
|
- d.ad_scene
|
|
|
- </select>
|
|
|
-
|
|
|
-
|
|
|
<!-- 快手 账户饼图图-分年龄 -->
|
|
|
<select id="getKuaiShouAccountPieAge" resultType="org.jeecg.ctop.material.entity.vo.KuaiShouAccountPieVo">
|
|
|
SELECT
|
|
|
- d.age_segment AS ageSegment,
|
|
|
- SUM( d.charge ) AS cost,
|
|
|
- SUM( d.activation ) AS activation,
|
|
|
- IFNULL( ROUND( SUM( d.charge ) / SUM( d.activation ), 2 ), 0 ) AS activationPrice,
|
|
|
- SUM( d.event_pay_roi ) AS eventPayRoi,
|
|
|
- SUM( d.event_pay ) AS eventPay,
|
|
|
- IFNULL( ROUND( SUM( d.charge ) / SUM( d.event_pay ), 2 ), 0 ) AS eventPayCost,
|
|
|
- SUM( d.event_pay_purchase_amount_first_day ) AS eventPayPurchaseAmountFirstDay,
|
|
|
- SUM( d.event_next_day_stay ) AS event_next_day_stay,
|
|
|
- IFNULL( ROUND( SUM( d.event_next_day_stay ) / SUM( d.activation ), 2 ), 0 ) AS leave
|
|
|
+ <if test='type == "cost"'>
|
|
|
+ SUM( d.charge ) AS cost,
|
|
|
+ </if>
|
|
|
+ <if test='type == "activation"'>
|
|
|
+ SUM( d.activation ) AS activation,
|
|
|
+ </if>
|
|
|
+ <if test='type == "activationPrice"'>
|
|
|
+ IFNULL( ROUND( SUM( d.charge ) / SUM( d.activation ), 2 ), 0 ) AS activationPrice,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventPayRoi"'>
|
|
|
+ SUM( d.event_pay_roi ) AS eventPayRoi,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventPay"'>
|
|
|
+ SUM( d.event_pay ) AS eventPay,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventPayCost"'>
|
|
|
+ IFNULL( ROUND( SUM( d.charge ) / SUM( d.event_pay ), 2 ), 0 ) AS eventPayCost,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventPayPurchaseAmountFirstDay"'>
|
|
|
+ SUM( d.event_pay_purchase_amount_first_day ) AS eventPayPurchaseAmountFirstDay,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventNextDayStay"'>
|
|
|
+ SUM( d.event_next_day_stay ) AS eventNextDayStay,
|
|
|
+ </if>
|
|
|
+ <if test='type == "leave"'>
|
|
|
+ IFNULL( ROUND( SUM( d.event_next_day_stay ) / SUM( d.activation ), 2 ), 0 ) AS leave,
|
|
|
+ </if>
|
|
|
+ d.age_segment AS ageSegment
|
|
|
FROM
|
|
|
media_api.kuaishou_audience_age_report_daily d
|
|
|
<where>
|
|
@@ -551,16 +595,34 @@
|
|
|
<!-- 快手 账户饼图图-分性别 -->
|
|
|
<select id="getKuaiShouAccountPieGender" resultType="org.jeecg.ctop.material.entity.vo.KuaiShouAccountPieVo">
|
|
|
SELECT
|
|
|
- d.gender AS gender,
|
|
|
- SUM( d.charge ) AS cost,
|
|
|
- SUM( d.activation ) AS activation,
|
|
|
- IFNULL( ROUND( SUM( d.charge ) / SUM( d.activation ), 2 ), 0 ) AS activationPrice,
|
|
|
- SUM( d.event_pay_roi ) AS eventPayRoi,
|
|
|
- SUM( d.event_pay ) AS eventPay,
|
|
|
- IFNULL( ROUND( SUM( d.charge ) / SUM( d.event_pay ), 2 ), 0 ) AS eventPayCost,
|
|
|
- SUM( d.event_pay_purchase_amount_first_day ) AS eventPayPurchaseAmountFirstDay,
|
|
|
- SUM( d.event_next_day_stay ) AS event_next_day_stay,
|
|
|
- IFNULL( ROUND( SUM( d.event_next_day_stay ) / SUM( d.activation ), 2 ), 0 ) AS leave
|
|
|
+ <if test='type == "cost"'>
|
|
|
+ SUM( d.charge ) AS cost,
|
|
|
+ </if>
|
|
|
+ <if test='type == "activation"'>
|
|
|
+ SUM( d.activation ) AS activation,
|
|
|
+ </if>
|
|
|
+ <if test='type == "activationPrice"'>
|
|
|
+ IFNULL( ROUND( SUM( d.charge ) / SUM( d.activation ), 2 ), 0 ) AS activationPrice,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventPayRoi"'>
|
|
|
+ SUM( d.event_pay_roi ) AS eventPayRoi,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventPay"'>
|
|
|
+ SUM( d.event_pay ) AS eventPay,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventPayCost"'>
|
|
|
+ IFNULL( ROUND( SUM( d.charge ) / SUM( d.event_pay ), 2 ), 0 ) AS eventPayCost,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventPayPurchaseAmountFirstDay"'>
|
|
|
+ SUM( d.event_pay_purchase_amount_first_day ) AS eventPayPurchaseAmountFirstDay,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventNextDayStay"'>
|
|
|
+ SUM( d.event_next_day_stay ) AS eventNextDayStay,
|
|
|
+ </if>
|
|
|
+ <if test='type == "leave"'>
|
|
|
+ IFNULL( ROUND( SUM( d.event_next_day_stay ) / SUM( d.activation ), 2 ), 0 ) AS leave,
|
|
|
+ </if>
|
|
|
+ d.gender AS gender
|
|
|
FROM
|
|
|
media_api.kuaishou_audience_gender_report_daily d
|
|
|
<where>
|