|
@@ -531,24 +531,28 @@
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="getKuaishouAccountInfoByProjectId" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO">
|
|
<select id="getKuaishouAccountInfoByProjectId" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO">
|
|
|
|
+ select * from
|
|
|
|
+ (
|
|
select
|
|
select
|
|
|
|
+ #{yn} as 'yn',
|
|
concat(#{startDate}, '~' ,#{endDate}) as 'statDate',
|
|
concat(#{startDate}, '~' ,#{endDate}) as 'statDate',
|
|
a.account_id as 'accountId',
|
|
a.account_id as 'accountId',
|
|
b.auth_name as 'authName',
|
|
b.auth_name as 'authName',
|
|
b.project_id as 'projectId',
|
|
b.project_id as 'projectId',
|
|
b.project_name as 'projectName',
|
|
b.project_name as 'projectName',
|
|
round(sum(a.charge),2) as 'charge',
|
|
round(sum(a.charge),2) as 'charge',
|
|
- sum(a.photo_show) as 'photoShow', -- 封面曝光数
|
|
|
|
|
|
+ sum(a.photo_show) as 'photoShow', -- 封面曝光数
|
|
sum(a.photo_click) as 'photoClick', -- 封面点击数
|
|
sum(a.photo_click) as 'photoClick', -- 封面点击数
|
|
- sum(a.aclick) as 'aclick', -- 素材曝光数
|
|
|
|
- sum(a.bclick) as 'bclick', -- 行为数
|
|
|
|
- sum(a.activation) as 'activation', -- 激活数
|
|
|
|
- sum(a.submit) as 'submit', -- 提交按钮点击数
|
|
|
|
- sum(a.event_register) as 'eventRegister', -- 注册数
|
|
|
|
- sum(a.event_next_day_stay) as 'eventNextDayStay', -- 次日留存数
|
|
|
|
- ROUND(IFNULL(sum(a.charge)/sum(a.activation),0),2) as 'activationCost', -- 激活成本
|
|
|
|
- case when photo_show!=0 then concat(round(sum(a.photo_click)/sum(a.photo_show) * 100 ,2),'%') else 0 end as 'photoClickRatio', -- 封面点击率
|
|
|
|
- case when aclick!=0 then concat(round(sum(a.bclick)/sum(a.aclick) * 100 ,2),'%') else 0 end as 'actionRate', -- 行为率
|
|
|
|
|
|
+ sum(a.aclick) as 'aclick', -- 素材曝光数
|
|
|
|
+ sum(a.bclick) as 'bclick', -- 行为数
|
|
|
|
+ sum(a.activation) as 'activation', -- 激活数
|
|
|
|
+ sum(a.submit) as 'submit', -- 提交按钮点击数
|
|
|
|
+ sum(a.event_register) as 'eventRegister', -- 注册数
|
|
|
|
+ sum(a.event_next_day_stay) as 'eventNextDayStay', -- 次日留存数
|
|
|
|
+ ROUND(IFNULL(sum(a.charge)/sum(a.activation),0),2) as 'activationCost', -- 激活成本
|
|
|
|
+ case when photo_show!=0 then concat(round(sum(a.photo_click)/sum(a.photo_show) * 100 ,2),'%') else 0 end as
|
|
|
|
+ 'photoClickRatio', -- 封面点击率
|
|
|
|
+ case when aclick!=0 then concat(round(sum(a.bclick)/sum(a.aclick) * 100 ,2),'%') else 0 end as 'actionRate', -- 行为率
|
|
(case
|
|
(case
|
|
when sum(a.photo_show) != 0
|
|
when sum(a.photo_show) != 0
|
|
then round((sum(a.charge) / sum(a.photo_show)) * 1000,2)
|
|
then round((sum(a.charge) / sum(a.photo_show)) * 1000,2)
|
|
@@ -567,7 +571,7 @@
|
|
ELSE 0
|
|
ELSE 0
|
|
end
|
|
end
|
|
) as 'actionCost', -- 平均行为单价
|
|
) as 'actionCost', -- 平均行为单价
|
|
- sum(a.photo_share) as 'photoShare', -- 分享数
|
|
|
|
|
|
+ sum(a.photo_share) as 'photoShare', -- 分享数
|
|
sum(a.photo_comment) as 'photoComment', -- 评论数
|
|
sum(a.photo_comment) as 'photoComment', -- 评论数
|
|
sum(a.photo_like) as 'photoLike', -- 点赞数
|
|
sum(a.photo_like) as 'photoLike', -- 点赞数
|
|
sum(a.follow) as 'follow', -- 新增关注数
|
|
sum(a.follow) as 'follow', -- 新增关注数
|
|
@@ -575,14 +579,14 @@
|
|
sum(a.cancel_follow) as 'cancelFollow', -- 取消关注数
|
|
sum(a.cancel_follow) as 'cancelFollow', -- 取消关注数
|
|
sum(a.block) as 'block', -- 拉黑数
|
|
sum(a.block) as 'block', -- 拉黑数
|
|
sum(a.negative) as 'nagative', -- 减少此类作品数
|
|
sum(a.negative) as 'nagative', -- 减少此类作品数
|
|
- sum(a.download_started) as 'downloadStarted', -- 应用下载数据-安卓下载开始数
|
|
|
|
- sum(a.download_completed) as 'downloadCompleted', -- 应用下载数据-安卓下载完成数
|
|
|
|
|
|
+ sum(a.download_started) as 'downloadStarted', -- 应用下载数据-安卓下载开始数
|
|
|
|
+ sum(a.download_completed) as 'downloadCompleted', -- 应用下载数据-安卓下载完成数
|
|
(CASE
|
|
(CASE
|
|
WHEN sum(a.event_next_day_stay) != 0
|
|
WHEN sum(a.event_next_day_stay) != 0
|
|
THEN round(sum(a.charge) / sum(a.event_next_day_stay),2)
|
|
THEN round(sum(a.charge) / sum(a.event_next_day_stay),2)
|
|
ELSE 0
|
|
ELSE 0
|
|
end
|
|
end
|
|
- ) as 'eventNextDayStayCost' -- 次日留存成本
|
|
|
|
|
|
+ ) as 'eventNextDayStayCost' -- 次日留存成本
|
|
from
|
|
from
|
|
ctop_kuaishou_report_daily_account a
|
|
ctop_kuaishou_report_daily_account a
|
|
left join (select * from ctop_user_allocation group by account_id) b on a.account_id = b.account_id
|
|
left join (select * from ctop_user_allocation group by account_id) b on a.account_id = b.account_id
|
|
@@ -590,6 +594,7 @@
|
|
a.stat_date >= #{startDate}
|
|
a.stat_date >= #{startDate}
|
|
and
|
|
and
|
|
a.stat_date <= #{endDate}
|
|
a.stat_date <= #{endDate}
|
|
|
|
+
|
|
<if test="projectId!=null and projectId != '' ">
|
|
<if test="projectId!=null and projectId != '' ">
|
|
and
|
|
and
|
|
b.project_id = #{projectId}
|
|
b.project_id = #{projectId}
|
|
@@ -603,87 +608,101 @@
|
|
</if>
|
|
</if>
|
|
group by a.account_id
|
|
group by a.account_id
|
|
order by sum(a.charge) desc
|
|
order by sum(a.charge) desc
|
|
|
|
+ )m
|
|
|
|
+ <if test="yn=1">
|
|
|
|
+ where
|
|
|
|
+ m.charge != 0
|
|
|
|
+ </if>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="getKuaishouProjectInfo" resultType="cn.com.ctop.kuaishou.modules.report.entity.ProjectAccountDTO">
|
|
<select id="getKuaishouProjectInfo" resultType="cn.com.ctop.kuaishou.modules.report.entity.ProjectAccountDTO">
|
|
- select
|
|
|
|
- concat(#{startDate}, '~' , #{endDate}) as 'statDate',
|
|
|
|
- (select project_id from ctop_user_allocation where account_id = a.account_id limit 1) as 'projectId',
|
|
|
|
- (select project_name from ctop_user_allocation where account_id = a.account_id limit 1) as 'projectName',
|
|
|
|
- (select advertiser_name from ctop_project where id = (select project_id from ctop_user_allocation where
|
|
|
|
- account_id = a.account_id limit 1
|
|
|
|
- )) as 'advertiserName',
|
|
|
|
- (select responsible_name from ctop_project where id = (select project_id from ctop_user_allocation where
|
|
|
|
- account_id = a.account_id limit 1
|
|
|
|
- )) as 'responsibleName',
|
|
|
|
- (select design_responsible_name from ctop_project where id = (select project_id from ctop_user_allocation where account_id = a.account_id limit 1
|
|
|
|
- )) as 'designResponsibleName',
|
|
|
|
- ifnull(round(sum(a.charge),2),0) as 'charge',
|
|
|
|
- ifnull(sum(a.photo_show),0) as 'photoShow', -- 封面曝光数
|
|
|
|
- ifnull(sum(a.photo_click),0) as 'photoClick', -- 封面点击数
|
|
|
|
- ifnull(sum(a.aclick),0) as 'aclick', -- 素材曝光数
|
|
|
|
- ifnull(sum(a.bclick),0) as 'bclick', -- 行为数
|
|
|
|
- ifnull(sum(a.activation),0) as 'activation', -- 激活数
|
|
|
|
- ifnull(sum(a.submit),0) as 'submit', -- 提交按钮点击数
|
|
|
|
- ifnull(sum(a.event_register),0) as 'eventRegister', -- 注册数
|
|
|
|
- ifnull(sum(event_next_day_stay),0) as 'eventNextDayStay', -- 次日留存数
|
|
|
|
- ROUND(IFNULL(sum(a.charge)/sum(a.activation),0),2) as 'activationCost', -- 激活成本
|
|
|
|
- case when (sum(a.photo_show) is not null and sum(a.photo_show)!=0) then concat(round(ifnull(sum(a.photo_click),0)/sum(a.photo_show) * 100 ,2),'%') else 0 end as 'photoClickRate', -- 封面点击率
|
|
|
|
- case when (sum(a.aclick) is not null and sum(a.aclick)!=0) then concat(round(ifnull(sum(a.bclick),0)/sum(a.aclick) * 100 ,2),'%') else 0 end as 'bclickRate', -- 行为率
|
|
|
|
- (case
|
|
|
|
- when (sum(a.photo_show) is not null and sum(a.photo_show) != 0)
|
|
|
|
- then round((ifnull(sum(a.charge),0) / sum(a.photo_show)) * 1000,2)
|
|
|
|
- else 0
|
|
|
|
- end
|
|
|
|
- ) as 'impression1kCost', -- 均千次封面曝光花费
|
|
|
|
- (case
|
|
|
|
- when (sum(a.photo_click) is not null and sum(a.photo_click) != 0)
|
|
|
|
- then round( ifnull(sum(a.charge),0) / sum(a.photo_click),2)
|
|
|
|
- else 0
|
|
|
|
- end
|
|
|
|
- ) as 'photoClickCost', -- 平均封面点击单价
|
|
|
|
- (CASE
|
|
|
|
- WHEN ( sum(a.photo_click) is not null and sum(a.photo_click) != 0)
|
|
|
|
- THEN round(sum(a.charge) / sum(a.photo_click),2)
|
|
|
|
- ELSE 0
|
|
|
|
- end
|
|
|
|
- ) as 'actionCost', -- 平均行为单价
|
|
|
|
- ifnull(sum(a.photo_share),0) as 'photoShare', -- 分享数
|
|
|
|
- ifnull(sum(a.photo_comment),0) as 'photoComment', -- 评论数
|
|
|
|
- ifnull(sum(a.photo_like),0) as 'photoLike', -- 点赞数
|
|
|
|
- ifnull(sum(a.follow),0) as 'follow', -- 新增关注数
|
|
|
|
- ifnull(sum(a.report),0) as 'report', -- 举报数
|
|
|
|
- ifnull(sum(a.cancel_follow),0) as 'cancelFollow', -- 取消关注数
|
|
|
|
- ifnull(sum(a.block),0) as 'block', -- 拉黑数
|
|
|
|
- ifnull(sum(a.negative),0) as 'nagative', -- 减少此类作品数
|
|
|
|
- ifnull(sum(a.download_started),0) as 'downloadStarted', -- 应用下载数据-安卓下载开始数
|
|
|
|
- ifnull(sum(a.download_completed),0) as 'downloadCompleted', -- 应用下载数据-安卓下载完成数
|
|
|
|
- (CASE
|
|
|
|
- WHEN ( sum(a.event_next_day_stay) is not null and sum(a.event_next_day_stay) != 0)
|
|
|
|
- THEN round( ifnull(sum(a.charge),0) / sum(a.event_next_day_stay) ,2)
|
|
|
|
- ELSE 0
|
|
|
|
- end
|
|
|
|
- ) as 'eventNextDayStayCost' -- 次日留存成本
|
|
|
|
- from
|
|
|
|
- ctop_kuaishou_report_daily_account a
|
|
|
|
- left join (select * from ctop_user_allocation group by account_id) b on a.account_id = b.account_id
|
|
|
|
- -- left join ctop_project c on b.project_id = c.id
|
|
|
|
|
|
+ select* from (
|
|
|
|
+ select
|
|
|
|
+ #{yn} as 'yn',
|
|
|
|
+ concat(#{startDate}, '~' , #{endDate}) as 'statDate',
|
|
|
|
+ (select project_id from ctop_user_allocation where account_id = a.account_id limit 1) as 'projectId',
|
|
|
|
+ (select project_name from ctop_user_allocation where account_id = a.account_id limit 1) as 'projectName',
|
|
|
|
+ (select advertiser_name from ctop_project where id = (select project_id from ctop_user_allocation where
|
|
|
|
+ account_id = a.account_id limit 1
|
|
|
|
+ )) as 'advertiserName',
|
|
|
|
+ (select responsible_name from ctop_project where id = (select project_id from ctop_user_allocation where
|
|
|
|
+ account_id = a.account_id limit 1
|
|
|
|
+ )) as 'responsibleName',
|
|
|
|
+ (select design_responsible_name from ctop_project where id = (select project_id from ctop_user_allocation where account_id = a.account_id limit 1
|
|
|
|
+ )) as 'designResponsibleName',
|
|
|
|
+ ifnull(round(sum(a.charge),2),0) as 'charge',
|
|
|
|
+ ifnull(sum(a.photo_show),0) as 'photoShow', -- 封面曝光数
|
|
|
|
+ ifnull(sum(a.photo_click),0) as 'photoClick', -- 封面点击数
|
|
|
|
+ ifnull(sum(a.aclick),0) as 'aclick', -- 素材曝光数
|
|
|
|
+ ifnull(sum(a.bclick),0) as 'bclick', -- 行为数
|
|
|
|
+ ifnull(sum(a.activation),0) as 'activation', -- 激活数
|
|
|
|
+ ifnull(sum(a.submit),0) as 'submit', -- 提交按钮点击数
|
|
|
|
+ ifnull(sum(a.event_register),0) as 'eventRegister', -- 注册数
|
|
|
|
+ ifnull(sum(event_next_day_stay),0) as 'eventNextDayStay', -- 次日留存数
|
|
|
|
+ ROUND(IFNULL(sum(a.charge)/sum(a.activation),0),2) as 'activationCost', -- 激活成本
|
|
|
|
+ case when (sum(a.photo_show) is not null and sum(a.photo_show)!=0) then concat(round(ifnull(sum(a.photo_click),0)/sum(a.photo_show) * 100 ,2),'%') else 0 end as 'photoClickRate', -- 封面点击率
|
|
|
|
+ case when (sum(a.aclick) is not null and sum(a.aclick)!=0) then concat(round(ifnull(sum(a.bclick),0)/sum(a.aclick) * 100 ,2),'%') else 0 end as 'bclickRate', -- 行为率
|
|
|
|
+ (case
|
|
|
|
+ when (sum(a.photo_show) is not null and sum(a.photo_show) != 0)
|
|
|
|
+ then round((ifnull(sum(a.charge),0) / sum(a.photo_show)) * 1000,2)
|
|
|
|
+ else 0
|
|
|
|
+ end
|
|
|
|
+ ) as 'impression1kCost', -- 均千次封面曝光花费
|
|
|
|
+ (case
|
|
|
|
+ when (sum(a.photo_click) is not null and sum(a.photo_click) != 0)
|
|
|
|
+ then round( ifnull(sum(a.charge),0) / sum(a.photo_click),2)
|
|
|
|
+ else 0
|
|
|
|
+ end
|
|
|
|
+ ) as 'photoClickCost', -- 平均封面点击单价
|
|
|
|
+ (CASE
|
|
|
|
+ WHEN ( sum(a.photo_click) is not null and sum(a.photo_click) != 0)
|
|
|
|
+ THEN round(sum(a.charge) / sum(a.photo_click),2)
|
|
|
|
+ ELSE 0
|
|
|
|
+ end
|
|
|
|
+ ) as 'actionCost', -- 平均行为单价
|
|
|
|
+ ifnull(sum(a.photo_share),0) as 'photoShare', -- 分享数
|
|
|
|
+ ifnull(sum(a.photo_comment),0) as 'photoComment', -- 评论数
|
|
|
|
+ ifnull(sum(a.photo_like),0) as 'photoLike', -- 点赞数
|
|
|
|
+ ifnull(sum(a.follow),0) as 'follow', -- 新增关注数
|
|
|
|
+ ifnull(sum(a.report),0) as 'report', -- 举报数
|
|
|
|
+ ifnull(sum(a.cancel_follow),0) as 'cancelFollow', -- 取消关注数
|
|
|
|
+ ifnull(sum(a.block),0) as 'block', -- 拉黑数
|
|
|
|
+ ifnull(sum(a.negative),0) as 'nagative', -- 减少此类作品数
|
|
|
|
+ ifnull(sum(a.download_started),0) as 'downloadStarted', -- 应用下载数据-安卓下载开始数
|
|
|
|
+ ifnull(sum(a.download_completed),0) as 'downloadCompleted', -- 应用下载数据-安卓下载完成数
|
|
|
|
+ (CASE
|
|
|
|
+ WHEN ( sum(a.event_next_day_stay) is not null and sum(a.event_next_day_stay) != 0)
|
|
|
|
+ THEN round( ifnull(sum(a.charge),0) / sum(a.event_next_day_stay) ,2)
|
|
|
|
+ ELSE 0
|
|
|
|
+ end
|
|
|
|
+ ) as 'eventNextDayStayCost' -- 次日留存成本
|
|
|
|
+ from
|
|
|
|
+ ctop_kuaishou_report_daily_account a
|
|
|
|
+ left join (select * from ctop_user_allocation group by account_id) b on a.account_id = b.account_id
|
|
|
|
+ -- left join ctop_project c on b.project_id = c.id
|
|
|
|
+ where
|
|
|
|
+ a.stat_date >= #{startDate}
|
|
|
|
+ and
|
|
|
|
+ a.stat_date <= #{endDate}
|
|
|
|
+ and
|
|
|
|
+ b.project_id in
|
|
|
|
+ <foreach collection="projectList" item="item" separator=","
|
|
|
|
+ open="(" close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ group by b.project_id
|
|
|
|
+ ) m
|
|
|
|
+ <if test="yn = 1">
|
|
where
|
|
where
|
|
- a.stat_date >= #{startDate}
|
|
|
|
- and
|
|
|
|
- a.stat_date <= #{endDate}
|
|
|
|
- and
|
|
|
|
- b.project_id = #{projectId}
|
|
|
|
-<!-- <foreach collection="projectList" item="item" separator=","-->
|
|
|
|
-<!-- open="(" close=")">-->
|
|
|
|
-<!-- #{item}-->
|
|
|
|
-<!-- </foreach>-->
|
|
|
|
-<!-- group by b.project_id-->
|
|
|
|
|
|
+ m.charge != 0
|
|
|
|
+ </if>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<!-- 计划汇总 -->
|
|
<!-- 计划汇总 -->
|
|
<select id="getKuaishouCampaignInfoByAccountId" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO">
|
|
<select id="getKuaishouCampaignInfoByAccountId" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO">
|
|
- select
|
|
|
|
|
|
+ select * from
|
|
|
|
+ (select
|
|
|
|
+ #{yn} as 'yn',
|
|
concat(#{startDate}, '~' ,#{endDate}) as 'statDate',
|
|
concat(#{startDate}, '~' ,#{endDate}) as 'statDate',
|
|
b.project_id as 'projectId',
|
|
b.project_id as 'projectId',
|
|
b.project_name as 'projectName',
|
|
b.project_name as 'projectName',
|
|
@@ -757,32 +776,41 @@
|
|
</if>
|
|
</if>
|
|
|
|
|
|
group by a.campaign_id
|
|
group by a.campaign_id
|
|
|
|
+ ) m
|
|
|
|
+
|
|
|
|
+ <if test="yn = 1">
|
|
|
|
+ where
|
|
|
|
+ m.charge != 0
|
|
|
|
+ </if>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<!-- 根据计划id获取组信息 -->
|
|
<!-- 根据计划id获取组信息 -->
|
|
<select id="getKuaishouUnitInfoByCampaignId" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO">
|
|
<select id="getKuaishouUnitInfoByCampaignId" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO">
|
|
|
|
+ select * from (
|
|
select
|
|
select
|
|
|
|
+ #{yn} as 'yn',
|
|
concat(#{startDate}, '~' ,#{endDate}) as 'statDate',
|
|
concat(#{startDate}, '~' ,#{endDate}) as 'statDate',
|
|
b.project_id as 'projectId',
|
|
b.project_id as 'projectId',
|
|
b.project_name as 'projectName',
|
|
b.project_name as 'projectName',
|
|
a.account_id as 'accountId',
|
|
a.account_id as 'accountId',
|
|
b.auth_name as 'authName',
|
|
b.auth_name as 'authName',
|
|
- a.campaign_id as 'campaignId', -- 计划id
|
|
|
|
- a.campaign_name as 'campaignName', -- 计划名称
|
|
|
|
- a.unit_id as 'unitId', -- 组id,
|
|
|
|
- a.unit_name as 'unitName', -- 组名称
|
|
|
|
|
|
+ a.campaign_id as 'campaignId', -- 计划id
|
|
|
|
+ a.campaign_name as 'campaignName', -- 计划名称
|
|
|
|
+ a.unit_id as 'unitId', -- 组id,
|
|
|
|
+ a.unit_name as 'unitName', -- 组名称
|
|
round(sum(a.charge),2) as 'charge',
|
|
round(sum(a.charge),2) as 'charge',
|
|
- sum(a.photo_show) as 'photoShow', -- 封面曝光数
|
|
|
|
|
|
+ sum(a.photo_show) as 'photoShow', -- 封面曝光数
|
|
sum(a.photo_click) as 'photoClick', -- 封面点击数
|
|
sum(a.photo_click) as 'photoClick', -- 封面点击数
|
|
- sum(a.aclick) as 'aclick', -- 素材曝光数
|
|
|
|
- sum(a.bclick) as 'bclick', -- 行为数
|
|
|
|
- sum(a.activation) as 'activation', -- 激活数
|
|
|
|
- sum(a.submit) as 'submit', -- 提交按钮点击数
|
|
|
|
- sum(a.event_register) as 'eventRegister', -- 注册数
|
|
|
|
- sum(event_next_day_stay) as 'eventNextDayStay', -- 次日留存数
|
|
|
|
- ROUND(IFNULL(sum(a.charge)/sum(a.activation),0),2) as 'activationCost', -- 激活成本
|
|
|
|
- case when photo_show!=0 then concat(round(sum(a.photo_click)/sum(a.photo_show) * 100 ,2),'%') else 0 end as 'photoClickRatio', -- 封面点击率
|
|
|
|
- case when aclick!=0 then concat(round(sum(a.bclick)/sum(a.aclick) * 100 ,2),'%') else 0 end as 'actionRate', -- 行为率
|
|
|
|
|
|
+ sum(a.aclick) as 'aclick', -- 素材曝光数
|
|
|
|
+ sum(a.bclick) as 'bclick', -- 行为数
|
|
|
|
+ sum(a.activation) as 'activation', -- 激活数
|
|
|
|
+ sum(a.submit) as 'submit', -- 提交按钮点击数
|
|
|
|
+ sum(a.event_register) as 'eventRegister', -- 注册数
|
|
|
|
+ sum(event_next_day_stay) as 'eventNextDayStay', -- 次日留存数
|
|
|
|
+ ROUND(IFNULL(sum(a.charge)/sum(a.activation),0),2) as 'activationCost', -- 激活成本
|
|
|
|
+ case when photo_show!=0 then concat(round(sum(a.photo_click)/sum(a.photo_show) * 100 ,2),'%') else 0 end as
|
|
|
|
+ 'photoClickRatio', -- 封面点击率
|
|
|
|
+ case when aclick!=0 then concat(round(sum(a.bclick)/sum(a.aclick) * 100 ,2),'%') else 0 end as 'actionRate', -- 行为率
|
|
(case
|
|
(case
|
|
when sum(a.photo_show) != 0
|
|
when sum(a.photo_show) != 0
|
|
then round((sum(a.charge) / sum(a.photo_show)) * 1000,2)
|
|
then round((sum(a.charge) / sum(a.photo_show)) * 1000,2)
|
|
@@ -801,7 +829,7 @@
|
|
ELSE 0
|
|
ELSE 0
|
|
end
|
|
end
|
|
) as 'actionCost', -- 平均行为单价
|
|
) as 'actionCost', -- 平均行为单价
|
|
- sum(a.photo_share) as 'photoShare', -- 分享数
|
|
|
|
|
|
+ sum(a.photo_share) as 'photoShare', -- 分享数
|
|
sum(a.photo_comment) as 'photoComment', -- 评论数
|
|
sum(a.photo_comment) as 'photoComment', -- 评论数
|
|
sum(a.photo_like) as 'photoLike', -- 点赞数
|
|
sum(a.photo_like) as 'photoLike', -- 点赞数
|
|
sum(a.follow) as 'follow', -- 新增关注数
|
|
sum(a.follow) as 'follow', -- 新增关注数
|
|
@@ -809,45 +837,49 @@
|
|
sum(a.cancel_follow) as 'cancelFollow', -- 取消关注数
|
|
sum(a.cancel_follow) as 'cancelFollow', -- 取消关注数
|
|
sum(a.block) as 'block', -- 拉黑数
|
|
sum(a.block) as 'block', -- 拉黑数
|
|
sum(a.negative) as 'nagative', -- 减少此类作品数
|
|
sum(a.negative) as 'nagative', -- 减少此类作品数
|
|
- sum(a.download_started) as 'downloadStarted', -- 应用下载数据-安卓下载开始数
|
|
|
|
- sum(a.download_completed) as 'downloadCompleted', -- 应用下载数据-安卓下载完成数
|
|
|
|
|
|
+ sum(a.download_started) as 'downloadStarted', -- 应用下载数据-安卓下载开始数
|
|
|
|
+ sum(a.download_completed) as 'downloadCompleted', -- 应用下载数据-安卓下载完成数
|
|
(CASE
|
|
(CASE
|
|
WHEN sum(a.event_next_day_stay) != 0
|
|
WHEN sum(a.event_next_day_stay) != 0
|
|
THEN round(sum(a.charge) / sum(a.event_next_day_stay),2)
|
|
THEN round(sum(a.charge) / sum(a.event_next_day_stay),2)
|
|
ELSE 0
|
|
ELSE 0
|
|
end
|
|
end
|
|
- ) as 'eventNextDayStayCost' -- 次日留存成本
|
|
|
|
|
|
+ ) as 'eventNextDayStayCost' -- 次日留存成本
|
|
from
|
|
from
|
|
ctop_kuaishou_report_daily_group a
|
|
ctop_kuaishou_report_daily_group a
|
|
left join (select * from ctop_user_allocation group by account_id) b on a.account_id = b.account_id
|
|
left join (select * from ctop_user_allocation group by account_id) b on a.account_id = b.account_id
|
|
|
|
+ -- left join ctop_kuaishou_campaign c on a.campaign_id = c.campaign_id
|
|
where
|
|
where
|
|
a.stat_date >= #{startDate}
|
|
a.stat_date >= #{startDate}
|
|
and
|
|
and
|
|
a.stat_date <= #{endDate}
|
|
a.stat_date <= #{endDate}
|
|
- <if test="campaignId != null and campaignId != ''">
|
|
|
|
- and
|
|
|
|
- a.campaign_id = #{campaignId}
|
|
|
|
- </if>
|
|
|
|
- <if test="accountIds !=null">
|
|
|
|
- and a.account_id in
|
|
|
|
- <foreach collection="accountIds" item="item" separator=","
|
|
|
|
- open="(" close=")">
|
|
|
|
- #{item}
|
|
|
|
- </foreach>
|
|
|
|
|
|
+ <if test="campaignId != null and campaignId != ''">and
|
|
|
|
+ a.campaign_id = #{campaignId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="accountIds !=null">
|
|
|
|
+ and a.account_id in
|
|
|
|
+ <foreach collection="accountIds" item="item" separator=","
|
|
|
|
+ open="(" close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ group by unit_id
|
|
|
|
+ ) m
|
|
|
|
+ <if test="yn = 1">
|
|
|
|
+ where
|
|
|
|
+ m.charge != 0
|
|
</if>
|
|
</if>
|
|
- group by unit_id
|
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
- <select id="queryProjectMemberByUserId" resultType="cn.com.ctop.kuaishou.modules.report.entity.ProjectAccountDTO">
|
|
|
|
|
|
+ <select id="queryProjectMemberByUserId" resultType="long">
|
|
select
|
|
select
|
|
- distinct a.project_id as projectId,
|
|
|
|
- a.project_name as projectName,
|
|
|
|
|
|
+ distinct a.project_id as projectId
|
|
|
|
+ -- a.project_name as projectName,
|
|
-- a.advertiser_id as advertiserId,
|
|
-- a.advertiser_id as advertiserId,
|
|
- a.advertiser_name as advertiserName,
|
|
|
|
|
|
+ -- a.advertiser_name as advertiserName,
|
|
-- (SELECT media_id from ctop_project c where c.id=a.project_id limit 1) as mediaId,
|
|
-- (SELECT media_id from ctop_project c where c.id=a.project_id limit 1) as mediaId,
|
|
- c.responsible_name as responsibleName,
|
|
|
|
- c.design_responsible_name as designResponsibleName
|
|
|
|
|
|
+ -- c.responsible_name as responsibleName,
|
|
|
|
+ -- c.design_responsible_name as designResponsibleName
|
|
from
|
|
from
|
|
ctop_user_allocation a
|
|
ctop_user_allocation a
|
|
left join ctop_project_member b on a.project_id = b.project_id
|
|
left join ctop_project_member b on a.project_id = b.project_id
|
|
@@ -861,17 +893,17 @@
|
|
order by c.create_time desc
|
|
order by c.create_time desc
|
|
</select>
|
|
</select>
|
|
|
|
|
|
- <select id="queryProjectInfoBySaleId" resultType="cn.com.ctop.kuaishou.modules.report.entity.ProjectAccountDTO">
|
|
|
|
|
|
+ <select id="queryProjectInfoBySaleId" resultType="long">
|
|
select
|
|
select
|
|
- distinct c.id as projectId,
|
|
|
|
- c.project_name as projectName,
|
|
|
|
|
|
+ distinct c.id as projectId
|
|
|
|
+ -- c.project_name as projectName,
|
|
-- a.advertiser_id as advertiserId,
|
|
-- a.advertiser_id as advertiserId,
|
|
- c.advertiser_name as advertiserName,
|
|
|
|
|
|
+ -- c.advertiser_name as advertiserName,
|
|
-- (SELECT media_id from ctop_project c where c.id=a.project_id limit 1) as mediaId,
|
|
-- (SELECT media_id from ctop_project c where c.id=a.project_id limit 1) as mediaId,
|
|
- c.responsible_name as responsibleName,
|
|
|
|
- c.design_responsible_name as designResponsibleName,
|
|
|
|
- c.sale_id as saleId,
|
|
|
|
- u.realname as saleName
|
|
|
|
|
|
+ -- c.responsible_name as responsibleName,
|
|
|
|
+ -- c.design_responsible_name as designResponsibleName,
|
|
|
|
+ -- c.sale_id as saleId,
|
|
|
|
+ -- u.realname as saleName
|
|
from
|
|
from
|
|
ctop_project c
|
|
ctop_project c
|
|
left join sys_user u on c.sale_id = u.id
|
|
left join sys_user u on c.sale_id = u.id
|
|
@@ -913,13 +945,13 @@
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<!-- 设计师展示所有自己的角色下制作的视频 -->
|
|
<!-- 设计师展示所有自己的角色下制作的视频 -->
|
|
- <select id="queryProjectMemberByAdmins" resultType="cn.com.ctop.kuaishou.modules.report.entity.ProjectAccountDTO">
|
|
|
|
|
|
+ <select id="queryProjectMemberByAdmins" resultType="long">
|
|
select
|
|
select
|
|
- id as projectId,
|
|
|
|
- project_name as projectName,
|
|
|
|
- advertiser_name as advertiserName ,
|
|
|
|
- responsible_name as responsibleName,
|
|
|
|
- design_responsible_name as designResponsibleName
|
|
|
|
|
|
+ id as projectId
|
|
|
|
+ -- project_name as projectName,
|
|
|
|
+ -- advertiser_name as advertiserName ,
|
|
|
|
+ -- responsible_name as responsibleName,
|
|
|
|
+ -- design_responsible_name as designResponsibleName
|
|
from
|
|
from
|
|
ctop_project
|
|
ctop_project
|
|
where
|
|
where
|
|
@@ -931,13 +963,10 @@
|
|
order by create_time desc
|
|
order by create_time desc
|
|
</select>
|
|
</select>
|
|
|
|
|
|
- <select id="getKuaishouCreativeInfoByUnitId2" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO">
|
|
|
|
- select
|
|
|
|
- a.*,
|
|
|
|
- b.photo_id as 'photoId'
|
|
|
|
- from
|
|
|
|
- (
|
|
|
|
|
|
+ <select id="getKuaishouCreativeInfoByUnitId" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO">
|
|
|
|
+ select * from (
|
|
select
|
|
select
|
|
|
|
+ #{yn} as 'yn',
|
|
concat(#{startDate}, '~' ,#{endDate}) as 'statDate',
|
|
concat(#{startDate}, '~' ,#{endDate}) as 'statDate',
|
|
b.project_id as 'projectId',
|
|
b.project_id as 'projectId',
|
|
b.project_name as 'projectName',
|
|
b.project_name as 'projectName',
|
|
@@ -994,104 +1023,34 @@
|
|
THEN round(sum(a.charge) / sum(a.event_next_day_stay),2)
|
|
THEN round(sum(a.charge) / sum(a.event_next_day_stay),2)
|
|
ELSE 0
|
|
ELSE 0
|
|
end
|
|
end
|
|
- ) as 'eventNextDayStayCost' -- 次日留存成本
|
|
|
|
|
|
+ ) as 'eventNextDayStayCost', -- 次日留存成本
|
|
|
|
+ (select url from ctop_kuaishou_video_get where photo_id = c.photo_id limit 1) as url,
|
|
|
|
+ (select cover_url from ctop_kuaishou_video_get where photo_id = c.photo_id limit 1) as coverUrl
|
|
from
|
|
from
|
|
ctop_kuaishou_report_daily_creative a
|
|
ctop_kuaishou_report_daily_creative a
|
|
left join (select * from ctop_user_allocation group by account_id) b on a.account_id = b.account_id
|
|
left join (select * from ctop_user_allocation group by account_id) b on a.account_id = b.account_id
|
|
|
|
+ left join ctop_kuaishou_creative c on a.creative_id = c.creative_id
|
|
where
|
|
where
|
|
a.stat_date >= #{startDate}
|
|
a.stat_date >= #{startDate}
|
|
and
|
|
and
|
|
a.stat_date <= #{endDate}
|
|
a.stat_date <= #{endDate}
|
|
|
|
+
|
|
<if test="unitId != null and unitId !='' ">
|
|
<if test="unitId != null and unitId !='' ">
|
|
and
|
|
and
|
|
a.unit_id = #{unitId}
|
|
a.unit_id = #{unitId}
|
|
</if>
|
|
</if>
|
|
- group by creative_id
|
|
|
|
- ) a
|
|
|
|
- left join ctop_kuaishou_creative b on a.creativeId = b.creative_id
|
|
|
|
- </select>
|
|
|
|
-
|
|
|
|
- <select id="getKuaishouCreativeInfoByUnitId" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO">
|
|
|
|
- select
|
|
|
|
- concat(#{startDate}, '~' ,#{endDate}) as 'statDate',
|
|
|
|
- b.project_id as 'projectId',
|
|
|
|
- b.project_name as 'projectName',
|
|
|
|
- a.account_id as 'accountId',
|
|
|
|
- b.auth_name as 'authName',
|
|
|
|
- a.creative_id as 'creativeId',
|
|
|
|
- a.creative_name as 'creativeName',
|
|
|
|
- a.campaign_id as 'campaignId', -- 计划id
|
|
|
|
- a.campaign_name as 'campaignName', -- 计划名称
|
|
|
|
- a.unit_id as 'unitId', -- 组id,
|
|
|
|
- a.unit_name as 'unitName', -- 组名称
|
|
|
|
- round(sum(a.charge),2) as 'charge',
|
|
|
|
- sum(a.photo_show) as 'photoShow', -- 封面曝光数
|
|
|
|
- sum(a.photo_click) as 'photoClick', -- 封面点击数
|
|
|
|
- sum(a.aclick) as 'aclick', -- 素材曝光数
|
|
|
|
- sum(a.bclick) as 'bclick', -- 行为数
|
|
|
|
- sum(a.activation) as 'activation', -- 激活数
|
|
|
|
- sum(a.submit) as 'submit', -- 提交按钮点击数
|
|
|
|
- sum(a.event_register) as 'eventRegister', -- 注册数
|
|
|
|
- sum(event_next_day_stay) as 'eventNextDayStay', -- 次日留存数
|
|
|
|
- ROUND(IFNULL(sum(a.charge)/sum(a.activation),0),2) as 'activationCost', -- 激活成本
|
|
|
|
- case when photo_show!=0 then concat(round(sum(a.photo_click)/sum(a.photo_show) * 100 ,2),'%') else 0 end as 'photoClickRatio', -- 封面点击率
|
|
|
|
- case when aclick!=0 then concat(round(sum(a.bclick)/sum(a.aclick) * 100 ,2),'%') else 0 end as 'actionRate', -- 行为率
|
|
|
|
- (case
|
|
|
|
- when sum(a.photo_show) != 0 and sum(a.photo_show) is not null
|
|
|
|
- then round((sum(a.charge) / sum(a.photo_show)) * 1000,2)
|
|
|
|
- else 0
|
|
|
|
- end
|
|
|
|
- ) as 'impression1kCost', -- 均千次封面曝光花费
|
|
|
|
- (case
|
|
|
|
- when sum(a.photo_click) != 0
|
|
|
|
- then round(sum(a.charge) / sum(a.photo_click),2)
|
|
|
|
- else 0
|
|
|
|
- end
|
|
|
|
- ) as 'photoClickCost', -- 平均封面点击单价
|
|
|
|
- (CASE
|
|
|
|
- WHEN sum(a.photo_click) != 0
|
|
|
|
- THEN round(sum(a.charge) / sum(a.photo_click),2)
|
|
|
|
- ELSE 0
|
|
|
|
- end
|
|
|
|
- ) as 'actionCost', -- 平均行为单价
|
|
|
|
- sum(a.photo_share) as 'photoShare', -- 分享数
|
|
|
|
- sum(a.photo_comment) as 'photoComment', -- 评论数
|
|
|
|
- sum(a.photo_like) as 'photoLike', -- 点赞数
|
|
|
|
- sum(a.follow) as 'follow', -- 新增关注数
|
|
|
|
- sum(a.report) as 'report', -- 举报数
|
|
|
|
- sum(a.cancel_follow) as 'cancelFollow', -- 取消关注数
|
|
|
|
- sum(a.block) as 'block', -- 拉黑数
|
|
|
|
- sum(a.negative) as 'nagative', -- 减少此类作品数
|
|
|
|
- sum(a.download_started) as 'downloadStarted', -- 应用下载数据-安卓下载开始数
|
|
|
|
- sum(a.download_completed) as 'downloadCompleted', -- 应用下载数据-安卓下载完成数
|
|
|
|
- (CASE
|
|
|
|
- WHEN sum(a.event_next_day_stay) != 0
|
|
|
|
- THEN round(sum(a.charge) / sum(a.event_next_day_stay),2)
|
|
|
|
- ELSE 0
|
|
|
|
- end
|
|
|
|
- ) as 'eventNextDayStayCost', -- 次日留存成本
|
|
|
|
- (select url from ctop_kuaishou_video_get where photo_id = c.photo_id limit 1) as url,
|
|
|
|
- (select cover_url from ctop_kuaishou_video_get where photo_id = c.photo_id limit 1) as coverUrl
|
|
|
|
- from
|
|
|
|
- ctop_kuaishou_report_daily_creative a
|
|
|
|
- left join (select * from ctop_user_allocation group by account_id) b on a.account_id = b.account_id
|
|
|
|
- left join ctop_kuaishou_creative c on a.creative_id = c.creative_id
|
|
|
|
- where
|
|
|
|
- a.stat_date >= #{startDate}
|
|
|
|
- and
|
|
|
|
- a.stat_date <= #{endDate}
|
|
|
|
- <if test="unitId != null and unitId !='' ">
|
|
|
|
- and
|
|
|
|
- a.unit_id = #{unitId}
|
|
|
|
- </if>
|
|
|
|
- <if test="accountIds !=null">
|
|
|
|
- and a.account_id in
|
|
|
|
- <foreach collection="accountIds" item="item" separator=","
|
|
|
|
- open="(" close=")">
|
|
|
|
- #{item}
|
|
|
|
- </foreach>
|
|
|
|
|
|
+ <if test="accountIds !=null">
|
|
|
|
+ and a.account_id in
|
|
|
|
+ <foreach collection="accountIds" item="item" separator=","
|
|
|
|
+ open="(" close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ group by a.creative_id
|
|
|
|
+ )m
|
|
|
|
+ <if test="yn=1">
|
|
|
|
+ where m.charge != 0
|
|
</if>
|
|
</if>
|
|
- group by a.creative_id
|
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<!-- 获取项目成员所在所有项目下的所有账户id -->
|
|
<!-- 获取项目成员所在所有项目下的所有账户id -->
|