|
@@ -160,9 +160,9 @@
|
|
|
LEFT JOIN
|
|
|
(
|
|
|
SELECT abi.account_id ,
|
|
|
- COUNT(abi.new_effect_num) as newEffectNum,
|
|
|
- COUNT(abi.new_campaign_num) as newCampaignNum,
|
|
|
- COUNT(abi.new_unit_num) as newUnitNum
|
|
|
+ SUM(abi.new_effect_num) as newEffectNum,
|
|
|
+ SUM(abi.new_campaign_num) as newCampaignNum,
|
|
|
+ SUM(abi.new_unit_num) as newUnitNum
|
|
|
from application.app_kuaishou_account_base_info_d abi
|
|
|
<where>
|
|
|
<if test="startDate != null and startDate != '' ">
|
|
@@ -230,9 +230,9 @@
|
|
|
LEFT JOIN (
|
|
|
SELECT
|
|
|
abi.account_id,
|
|
|
- COUNT( abi.new_effect_num ) AS newEffectNum,
|
|
|
- COUNT( abi.new_video_num ) AS newVideoNum,
|
|
|
- COUNT( abi.new_hot_num ) AS newHotNum
|
|
|
+ SUM( abi.new_effect_num ) AS newEffectNum,
|
|
|
+ SUM( abi.new_video_num ) AS newVideoNum,
|
|
|
+ SUM( abi.new_hot_num ) AS newHotNum
|
|
|
FROM
|
|
|
application.app_kuaishou_account_base_info_d abi
|
|
|
<where>
|
|
@@ -312,9 +312,9 @@
|
|
|
LEFT JOIN (
|
|
|
SELECT
|
|
|
abi.account_id,
|
|
|
- COUNT( abi.new_effect_num ) AS newEffectNum,
|
|
|
- COUNT( abi.new_video_num ) AS newVideoNum,
|
|
|
- COUNT( abi.new_hot_num ) AS newHotNum
|
|
|
+ SUM( abi.new_effect_num ) AS newEffectNum,
|
|
|
+ SUM( abi.new_video_num ) AS newVideoNum,
|
|
|
+ SUM( abi.new_hot_num ) AS newHotNum
|
|
|
FROM
|
|
|
application.app_kuaishou_account_base_info_d abi
|
|
|
<where>
|
|
@@ -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,37 @@
|
|
|
<!-- 快手 账户 余额 以及状态 -->
|
|
|
<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
|
|
|
+ u.account_id as accountId,
|
|
|
+ u.auth_name as accountName,
|
|
|
+ u.account_status as accountStatus,
|
|
|
+ IFNULL((SELECT SUM( h.charge ) from application.kuaishou_account_report_hourly_dw h where u.account_id = h.account_id and h.stat_date = #{statDate}),0) as todayCost
|
|
|
+ FROM
|
|
|
+ `jeecg-boot`.`ctop_user_allocation` u
|
|
|
+ WHERE u.account_id = #{accountId}
|
|
|
+
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 快手-运营 月总消耗 -->
|
|
|
+ <select id="getKuaiShouAccountCostMonth" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
+ SELECT
|
|
|
+ SUM( d.charge ) cost,
|
|
|
+ (SELECT realname from `jeecg-boot`.sys_user u where u.id = d.user_id) as userName
|
|
|
+ FROM
|
|
|
+ application.kuaishou_account_report_daily_dw d
|
|
|
<where>
|
|
|
- <if test="accountId != null and accountId != '' ">
|
|
|
- and h.account_id = #{accountId}
|
|
|
+ <if test="userId != null and userId != '' ">
|
|
|
+ and d.user_id = #{userId}
|
|
|
</if>
|
|
|
<if test="statDate != null and statDate != '' ">
|
|
|
- and h.stat_date = #{statDate}
|
|
|
+ and d.stat_date >= #{statDate}
|
|
|
</if>
|
|
|
+ <if test="endDate != null and endDate != '' ">
|
|
|
+ and d.stat_date <= #{endDate}
|
|
|
+ </if>
|
|
|
+
|
|
|
</where>
|
|
|
+
|
|
|
</select>
|
|
|
|
|
|
|
|
@@ -396,10 +411,77 @@
|
|
|
(
|
|
|
SELECT
|
|
|
h.`hour` as tHour,
|
|
|
- h.charge AS tCost,
|
|
|
- IFNULL( ROUND(( h.charge / h.activation ), 2 ), 0 ) AS tActivationPrice,
|
|
|
- IFNULL( ROUND(( h.charge / h.event_new_user_pay ), 2 ), 0 ) AS tEventNewUserPayCost,
|
|
|
- IFNULL( ROUND( ( h.event_next_day_stay / h.activation ), 2 ), 0 ) AS tLeave
|
|
|
+ <if test='type == "cost"'>
|
|
|
+ h.charge AS tData,
|
|
|
+ </if>
|
|
|
+ <if test='type == "activation"'>
|
|
|
+ IFNULL(h.activation,0) AS tData ,
|
|
|
+ </if>
|
|
|
+ <if test='type == "activationPrice"'>
|
|
|
+ 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,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,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventPayCost"'>
|
|
|
+ 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,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,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventNewUserPayCost"'>
|
|
|
+ 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) ) * 100, 2 ),0) AS tData,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventAppInvoked"'>
|
|
|
+ IFNULL( h.event_app_invoked ,0) AS tData,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventAppInvokedCost"'>
|
|
|
+ IFNULL(ROUND( ( h.charge / h.event_app_invoked ), 2 ),0) AS tData,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventRegister"'>
|
|
|
+ IFNULL( h.event_register ,0) AS tData,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventRegisterCost"'>
|
|
|
+ IFNULL(ROUND( ( h.charge / h.event_register) , 2 ),0) AS tData,
|
|
|
+ </if>
|
|
|
+ <if test='type == "keyAction"'>
|
|
|
+ IFNULL( h.key_action ,0) AS tData,
|
|
|
+ </if>
|
|
|
+ <if test='type == "keyActionCost"'>
|
|
|
+ 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( ( 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,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventPayFirstDayRoi"'>
|
|
|
+ IFNULL( h.event_pay_first_day_roi ,0) AS tData,
|
|
|
+ </if>
|
|
|
+ <if test='type == "formCount"'>
|
|
|
+ IFNULL( h.form_count ,0) AS tData,
|
|
|
+ </if>
|
|
|
+ <if test='type == "formCountPrice"'>
|
|
|
+ IFNULL(ROUND( ( h.charge / h.form_count ), 2 ),0) AS tData,
|
|
|
+ </if>
|
|
|
+ <if test='type == "photoShow"'>
|
|
|
+ IFNULL(h.`show`,0) as tData,
|
|
|
+ </if>
|
|
|
+ <if test='type == "photoClick"'>
|
|
|
+ IFNULL(h.photo_click,0) as tData,
|
|
|
+ </if>
|
|
|
+ h.account_id as tAccountId
|
|
|
+
|
|
|
FROM
|
|
|
application.kuaishou_account_report_hourly_dw h
|
|
|
<where>
|
|
@@ -416,10 +498,76 @@
|
|
|
(
|
|
|
SELECT
|
|
|
h.`hour` as yHour,
|
|
|
- h.charge AS yCost,
|
|
|
- IFNULL( ROUND(( h.charge / h.activation ), 2 ), 0 ) AS yActivationPrice,
|
|
|
- IFNULL( ROUND(( h.charge / h.event_new_user_pay ), 2 ), 0 ) AS yEventNewUserPayCost,
|
|
|
- IFNULL( ROUND( ( h.event_next_day_stay / h.activation ), 2 ), 0 ) AS yLeave
|
|
|
+ <if test='type == "cost"'>
|
|
|
+ h.charge AS yData,
|
|
|
+ </if>
|
|
|
+ <if test='type == "activation"'>
|
|
|
+ IFNULL(h.activation,0) AS yData ,
|
|
|
+ </if>
|
|
|
+ <if test='type == "activationPrice"'>
|
|
|
+ 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,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,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventPayCost"'>
|
|
|
+ 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,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,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventNewUserPayCost"'>
|
|
|
+ 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) ) * 100, 2 ),0) AS yData,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventAppInvoked"'>
|
|
|
+ IFNULL( h.event_app_invoked ,0) AS yData,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventAppInvokedCost"'>
|
|
|
+ IFNULL(ROUND( ( h.charge / h.event_app_invoked ), 2 ),0) AS yData,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventRegister"'>
|
|
|
+ IFNULL( h.event_register ,0) AS yData,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventRegisterCost"'>
|
|
|
+ IFNULL(ROUND( ( h.charge / h.event_register) , 2 ),0) AS yData,
|
|
|
+ </if>
|
|
|
+ <if test='type == "keyAction"'>
|
|
|
+ IFNULL( h.key_action ,0) AS yData,
|
|
|
+ </if>
|
|
|
+ <if test='type == "keyActionCost"'>
|
|
|
+ IFNULL(ROUND( ( h.charge / h.key_action ), 2 ),0) AS yData,
|
|
|
+ </if>
|
|
|
+ <if test='type == "keyActionRate"'>
|
|
|
+ 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,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventPayFirstDayRoi"'>
|
|
|
+ IFNULL( h.event_pay_first_day_roi ,0) AS yData,
|
|
|
+ </if>
|
|
|
+ <if test='type == "formCount"'>
|
|
|
+ IFNULL( h.form_count ,0) AS yData,
|
|
|
+ </if>
|
|
|
+ <if test='type == "formCountPrice"'>
|
|
|
+ IFNULL(ROUND( ( h.charge / h.form_count ), 2 ),0) AS yData,
|
|
|
+ </if>
|
|
|
+ <if test='type == "photoShow"'>
|
|
|
+ IFNULL(h.`show`,0) as yData,
|
|
|
+ </if>
|
|
|
+ <if test='type == "photoClick"'>
|
|
|
+ IFNULL(h.photo_click,0) as yData,
|
|
|
+ </if>
|
|
|
+ h.account_id as yAccountId
|
|
|
FROM
|
|
|
application.kuaishou_account_report_hourly_dw h
|
|
|
<where>
|
|
@@ -441,10 +589,73 @@
|
|
|
<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,
|
|
|
- IFNULL( ROUND( SUM( d.event_next_day_stay ) / SUM( d.activation ), 2 ), 0 ) AS leave
|
|
|
+ <if test='type == "cost"'>
|
|
|
+ SUM( d.charge ) as data,
|
|
|
+ </if>
|
|
|
+ <if test='type == "activation"'>
|
|
|
+ IFNULL(SUM( d.activation ),0) AS data,
|
|
|
+ </if>
|
|
|
+ <if test='type == "activationPrice"'>
|
|
|
+ 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,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,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventPayCost"'>
|
|
|
+ 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,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,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventNewUserPayCost"'>
|
|
|
+ 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 ))) * 100, 2 ),0) AS data,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventAppInvoked"'>
|
|
|
+ IFNULL(SUM( d.event_app_invoked ),0) AS data,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventAppInvokedCost"'>
|
|
|
+ IFNULL(ROUND( SUM( d.charge ) / SUM( d.event_app_invoked ), 2 ),0) AS data,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventRegister"'>
|
|
|
+ IFNULL(SUM( d.event_register ),0) AS data,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventRegisterCost"'>
|
|
|
+ IFNULL(ROUND( SUM( d.charge ) / SUM( d.event_register ), 2 ),0) AS data,
|
|
|
+ </if>
|
|
|
+ <if test='type == "keyAction"'>
|
|
|
+ IFNULL(SUM( d.key_action ),0) AS data,
|
|
|
+ </if>
|
|
|
+ <if test='type == "keyActionCost"'>
|
|
|
+ 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, 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,
|
|
|
+ </if>
|
|
|
+ <if test='type == "eventPayFirstDayRoi"'>
|
|
|
+ IFNULL(SUM( d.event_pay_first_day_roi ),0) AS data,
|
|
|
+ </if>
|
|
|
+ <if test='type == "formCount"'>
|
|
|
+ IFNULL(SUM( d.form_count ),0) AS data,
|
|
|
+ </if>
|
|
|
+ <if test='type == "formCountPrice"'>
|
|
|
+ IFNULL(ROUND( SUM( d.charge ) / SUM( d.form_count ), 2 ),0) AS data,
|
|
|
+ </if>
|
|
|
+ <if test='type == "photoShow"'>
|
|
|
+ IFNULL(SUM(d.`show`),0) as data
|
|
|
+ </if>
|
|
|
+ d.account_id as accountId
|
|
|
FROM
|
|
|
application.kuaishou_account_report_daily_dw d
|
|
|
<where>
|
|
@@ -521,6 +732,7 @@
|
|
|
<!-- 快手 账户饼图图-分版位 -->
|
|
|
<select id="getKuaiShouAccountMaterialNewAndEffectAndFaddish" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
SELECT
|
|
|
+ m.cover_url as coverUrl,
|
|
|
DATE_FORMAT(m.media_time,'%Y-%m-%d') as dateTime,
|
|
|
vd.signature,
|
|
|
m.material_name as videoName,
|