|
@@ -697,10 +697,38 @@
|
|
|
d.project_id AS projectId,
|
|
|
d.project_name AS projectName,
|
|
|
SUM( d.cost ) AS totalCost,
|
|
|
+ t2.inventory,
|
|
|
( SELECT realname FROM `jeecg-boot`.sys_user u WHERE u.id = d.user_id ) AS userName
|
|
|
FROM
|
|
|
application.bytedance_advertiser_report_hourly_dw d
|
|
|
- WHERE
|
|
|
+ LEFT JOIN (select project_id,
|
|
|
+ group_concat(concat(inventory_name,':',cost)) as 'inventory'
|
|
|
+ from (
|
|
|
+ select project_id,inventory_name,sum(cost) as cost from
|
|
|
+ application.bytedance_advertiser_inventory_report_daily_dw
|
|
|
+ where cost > 0
|
|
|
+ <if test="startDate != null and startDate != '' ">
|
|
|
+ and stat_datetime >= #{startDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != '' ">
|
|
|
+ and stat_datetime <= #{endDate}
|
|
|
+ </if>
|
|
|
+ <if test="projectId != null and projectId != '' ">
|
|
|
+ and project_id = #{projectId}
|
|
|
+ </if>
|
|
|
+ <if test='list!=null and list.size()>0'>
|
|
|
+ AND user_id IN
|
|
|
+ <foreach collection="list" item="item" separator=","
|
|
|
+ open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+
|
|
|
+ group by project_id, inventory_name
|
|
|
+ ORDER BY cost desc
|
|
|
+ )t
|
|
|
+ group by project_id
|
|
|
+ ) t2 on d.project_id = t2.project_id WHERE
|
|
|
d.cost > 0
|
|
|
<if test="startDate != null and startDate != '' ">
|
|
|
and d.stat_datetime >= #{startDate}
|
|
@@ -1552,42 +1580,42 @@
|
|
|
) a
|
|
|
RIGHT JOIN
|
|
|
(
|
|
|
- SELECT d.advertiser_id dAccountId,
|
|
|
- d.campaign_id campaignId,
|
|
|
- d.campaign_name campaignName,
|
|
|
- d.unit_id dunit_id,
|
|
|
- d.unit_name unitName,
|
|
|
- IFNULL(SUM(d.charge), 0) AS charge,
|
|
|
- IFNULL(SUM(d.activation), 0) AS activation,
|
|
|
- IFNULL(ROUND(SUM(d.charge) / SUM(d.activation), 2), 0) AS activationPrice,
|
|
|
- IFNULL(ROUND(SUM(d.charge) / SUM(d.activation), 2), 0) AS activationCost,
|
|
|
+ SELECT d.advertiser_id dAccountId,
|
|
|
+ d.campaign_id campaignId,
|
|
|
+ d.campaign_name campaignName,
|
|
|
+ d.unit_id dunit_id,
|
|
|
+ d.unit_name unitName,
|
|
|
+ IFNULL(SUM(d.charge), 0) AS charge,
|
|
|
+ IFNULL(SUM(d.activation), 0) AS activation,
|
|
|
+ IFNULL(ROUND(SUM(d.charge) / SUM(d.activation), 2), 0) AS activationPrice,
|
|
|
+ IFNULL(ROUND(SUM(d.charge) / SUM(d.activation), 2), 0) AS activationCost,
|
|
|
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,
|
|
|
+ 0) AS `leave`,
|
|
|
+ IFNULL(SUM(d.event_pay), 0) AS eventPay,
|
|
|
+ IFNULL(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,
|
|
|
+ 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,
|
|
|
- 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,
|
|
|
+ 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,
|
|
|
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,
|
|
|
- IFNULL(ROUND(SUM(d.charge) / SUM(d.form_count), 2), 0) AS formCountPrice,
|
|
|
- SUM(d.bclick) bClick
|
|
|
+ 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,
|
|
|
+ IFNULL(ROUND(SUM(d.charge) / SUM(d.form_count), 2), 0) AS formCountPrice,
|
|
|
+ SUM(d.bclick) bClick
|
|
|
FROM media_api.kuaishou_unit_report_hourly d
|
|
|
WHERE d.advertiser_id = #{accountId}
|
|
|
AND d.stat_date = #{nowDate}
|