Commit 8ceb9182 authored by 王志伟's avatar 王志伟

修改统计参数

parent d34f924a
......@@ -100,7 +100,7 @@ object app_list {
|select distinct(cl_id) as device_id, user_id as user_id, params['installed_app_info'] as app_list
|from online.tl_hdfs_maidian_view ov left join agency_id
|on ov.cl_id = agency_id.device_id
|where action="user_installed_all_app_info"
|where ov.action="user_installed_all_app_info"
|and ov.partition_date = '${partition_date}'
|and agency_id.device_id is null
|and ov.cl_id not in (select distinct(device_id) from blacklist)
......@@ -134,7 +134,7 @@ object app_list {
|from online.tl_hdfs_maidian_view ov left join agency_id
|on ov.cl_id = agency_id.device_id
|where action="user_installed_all_app_info"
|and agency_id.device_id is null
|and ov.agency_id.device_id is null
|and ov.partition_date = '${partition_date}'
|and ov.cl_id not in (select distinct(device_id) from blacklist)
""".stripMargin
......@@ -234,20 +234,20 @@ object coincidence_xinyang {
//获取每日活跃用户中与新氧重合用户占比
//1.每日活跃中与新氧重合用户数
val data = yesterday.replace("-","")
val yesterday_data = yesterday.replace("-","")
val yesterday_coincidence = sc.sql(
s"""
|select '${data}' as stat_date,count(distinct(device_id)) as yesterday_coincidence_num
|select '${yesterday_data}' as stat_date,count(distinct(device_id)) as yesterday_coincidence_num
|from device_id_coincidence
|where stat_date = '${data}'
|where stat_date = '${yesterday_data}'
""".stripMargin
)
//2.获得应用列表的每日活跃总用户数
val yesterday_expoure_num = sc.sql(
s"""
|select '${data}' as stat_date,count(distinct(device_id)) as yesterday_expoure_num
|select '${yesterday_data}' as stat_date,count(distinct(device_id)) as yesterday_expoure_num
|from device_id_applist
|where stat_date = '${data}'
|where stat_date = '${yesterday_data}'
""".stripMargin
)
......@@ -257,7 +257,7 @@ object coincidence_xinyang {
val week_day = pre_weekday.replace("-","")
val week_coincidence = sc.sql(
s"""
|select '${data}' as stat_date,count(distinct(device_id)) as week_coincidence_num
|select '${yesterday_data}' as stat_date,count(distinct(device_id)) as week_coincidence_num
|from device_id_coincidence
|where stat_date >= '${week_day}'
""".stripMargin
......@@ -265,7 +265,7 @@ object coincidence_xinyang {
//2.获得应用列表的每周活跃总用户
val week_expoure_num = sc.sql(
s"""
|select '${data}' as stat_date,count(distinct(cl_id)) as week_expoure_num
|select '${yesterday_data}' as stat_date,count(distinct(cl_id)) as week_expoure_num
|from device_id_applist
|where stat_date >= '${week_day}'
""".stripMargin
......@@ -299,60 +299,86 @@ object coincidence_xinyang {
GmeiConfig.writeToJDBCTable(result, "coincidence_xinyang", SaveMode.Append)
/* //获取到的应用列表用户中截止目前获得的与新氧重合的用户数计算美购情况
//获取到的应用列表用户中截止目前获得的与新氧重合的用户数计算美购情况
//* 重合用户的id
val coincidence_id = sc.sql(
s"""
|select distinct(device_id) as coincidence_id
|from device_id_coincidence
""".stripMargin
)
coincidence_id.createOrReplaceTempView("coincidence_id")
//获取应用列表的所有用户id
val all_id = sc.sql(
s"""
|select distinct(device_id) as all_id
|from device_id_applist
""".stripMargin
)
all_id.createOrReplaceTempView("all_id")
//* 所有获得用户列表的用户id
//1.重合用户的美购数
val meigou_coincidence_num = sc.sql(
s"""
|select count(service_id) as meigou_coincidence_num
|from online.ml_meigou_order_detail
|from online.ml_meigou_order_detail ov left join coincidence_id
|on ov.device_id = coincidence_id.device_id
|where partition_date = '20181120'
|and coincidence_id.device_id is not null
|and pay_time is not null
|and pay_time >= '2017-11-18'
|and device_id in (select distinct(device_id) from device_id_coincidence)
""".stripMargin
).repartition(100)
)
meigou_coincidence_num.show()
//2.重合用户进行美购的用户数
val meigou_pay_device = sc.sql(
s"""
|select count(DISTINCT(device_id)) as meigou_pay_device
|from online.ml_meigou_order_detail
|select count(distinct(service_id)) as meigou_coincidence_num
|from online.ml_meigou_order_detail ov left join coincidence_id
|on ov.device_id = coincidence_id.device_id
|where partition_date = '20181120'
|and coincidence_id.device_id is not null
|and pay_time is not null
|and pay_time >= '2017-11-18'
|and device_id in (select distinct(device_id) from device_id_coincidence)
""".stripMargin
).repartition(100)
)
meigou_pay_device.show()
//3.获得应用列表的用户的美购数
//3.所有获得应用列表的用户的美购数
val meigou_pay_all = sc.sql(
s"""
|select count(device_id) as meigou_pay_device
|from online.ml_meigou_order_detail od inner join all_device_id
|on od.device_id=all_device_id.device_id
|from online.ml_meigou_order_detail od inner join all_id
|on od.device_id = all_id.device_id
|where partition_date = '20181120'
|and all_id.device_id is not null
|and pay_time is not null
|and pay_time >= '2017-11-18'
""".stripMargin
).repartition(100)
)
meigou_pay_all.show()
//4.获得应用列表用户进行美购的用户数
//4.所有获得应用列表用户进行美购的用户数
val meigou_pay_device_all = sc.sql(
s"""
|select count(distinct(device_id)) as meigou_pay_device
|from online.ml_meigou_order_detail od inner join all_device_id
|on od.device_id=all_device_id.device_id
|from online.ml_meigou_order_detail od inner join all_id
|on od.device_id = all_id.device_id
|where partition_date = '20181120'
|and all_id.device_id is not null
|and pay_time is not null
|and pay_time >= '2017-11-18'
""".stripMargin
).repartition(100)
)
meigou_pay_device_all.show()
//截止目前获得的与新氧重合的用户数咨询统计
/* //截止目前获得的与新氧重合的用户数咨询统计
val zixun_num_all = sc.sql(
s"""
|select count(cl_id) as zixun_num_all
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment