Commit f618a1e5 authored by 王志伟's avatar 王志伟

新统计需求

parent af4a2985
......@@ -202,6 +202,8 @@ object coincidence_xinyang {
|select '${data}' as stat_date,count(distinct(device_id)) as yesterday_coincidence_num
|from device_id_coincidence
|where stat_date = '${data}'
|and device_id not in (select device_id from bl_device_list)
|and device_id not in (select device_id from blacklist)
""".stripMargin
)
//2.每日活跃总用户数(采用曝光计算)
......@@ -211,6 +213,8 @@ object coincidence_xinyang {
|from data_feed_exposure
|where stat_date = '${yesterday}'
|and device_type !='App Store'
|and device_id not in (select device_id from bl_device_list)
|and device_id not in (select device_id from blacklist)
""".stripMargin
)
......@@ -222,6 +226,8 @@ object coincidence_xinyang {
|select '${data}' as stat_date,count(distinct(device_id)) as week_coincidence_num
|from device_id_coincidence
|where stat_date > '${week_day}'
|and device_id not in (select device_id from bl_device_list)
|and device_id not in (select device_id from blacklist)
""".stripMargin
)
//2.每周活跃总用户(采用曝光计算)
......@@ -231,6 +237,8 @@ object coincidence_xinyang {
|from data_feed_exposure
|where stat_date > '${pre_weekday}'
|and device_type !='App Store'
|and device_id not in (select device_id from bl_device_list)
|and device_id not in (select device_id from blacklist)
""".stripMargin
)
......@@ -242,6 +250,8 @@ object coincidence_xinyang {
|select '${data}' as stat_date,count(distinct(device_id)) as month_coincidence_num
|from device_id_coincidence
|where stat_date > '${month_day}'
|and device_id not in (select device_id from bl_device_list)
|and device_id not in (select device_id from blacklist)
""".stripMargin
)
//2.0 每月活跃总用户(采用曝光计算)
......@@ -251,6 +261,8 @@ object coincidence_xinyang {
|from data_feed_exposure
|where stat_date > '${pre_monthday}'
|and device_type !='App Store'
|and device_id not in (select device_id from bl_device_list)
|and device_id not in (select device_id from blacklist)
""".stripMargin
)
......@@ -260,9 +272,10 @@ object coincidence_xinyang {
.join(month_coincidence,"stat_date")
.join(month_expoure_num,"stat_date")
//GmeiConfig.writeToJDBCTable(result, "coincidence_xinyang", SaveMode.Append)
GmeiConfig.writeToJDBCTable(result, "coincidence_xinyang", SaveMode.Append)
/* //截止目前获得的与新氧重合的用户数计算美购情况
//截止目前获得的与新氧重合的用户数计算美购情况
//1.重合用户的美购数
val meigou_coincidence_num = sc.sql(
s"""
|select count(service_id) as meigou_coincidence_num
......@@ -271,10 +284,14 @@ object coincidence_xinyang {
|and pay_time is not null
|and pay_time >= '2017-11-18'
|and device_id in (select distinct(device_id) from device_id_coincidence)
|and device_id not in (select device_id from bl_device_list)
|and device_id not in (select device_id from blacklist)
""".stripMargin
)
meigou_coincidence_num.show()
//2.重合用户进行美购的用户数
val meigou_pay_device = sc.sql(
s"""
|select count(DISTINCT(device_id)) as meigou_pay_device
......@@ -283,18 +300,50 @@ object coincidence_xinyang {
|and pay_time is not null
|and pay_time >= '2017-11-18'
|and device_id in (select distinct(device_id) from device_id_coincidence)
|and device_id not in (select device_id from bl_device_list)
|and device_id not in (select device_id from blacklist)
""".stripMargin
)
meigou_pay_device.show()
*/
//3.所有用户的美购数
val meigou_pay_all = sc.sql(
s"""
|select count(DISTINCT(device_id)) as meigou_pay_device
|from online.ml_meigou_order_detail
|where partition_date = '20181118'
|and pay_time is not null
|and pay_time >= '2017-11-18'
|and device_id in (select distinct(device_id) from device_id_coincidence)
|and device_id not in (select device_id from bl_device_list)
|and device_id not in (select device_id from blacklist)
""".stripMargin
)
meigou_pay_all.show()
//4.所有进行美购的用户数
val meigou_pay_device_all = sc.sql(
s"""
|select count(DISTINCT(device_id)) as meigou_pay_device
|from online.ml_meigou_order_detail
|where partition_date = '20181118'
|and pay_time is not null
|and pay_time >= '2017-11-18'
|and device_id in (select distinct(device_id) from device_id_coincidence)
|and device_id not in (select device_id from bl_device_list)
|and device_id not in (select device_id from blacklist)
""".stripMargin
)
meigou_pay_device_all.show()
//截止目前获得的与新氧重合的用户数咨询统计
val zixun_num_all = sc.sql(
s"""
|select count(cl_id) as zixun_num_all
|from online.tl_hdfs_maidian_view
|where partition_date > '20171118'
|where partition_date > '20180101'
|and action = 'welfare_detail_click_message'
|and cl_id not in (select device_id from bl_device_list)
|and cl_id not in (select device_id from blacklist)
""".stripMargin
)
zixun_num_all.show()
......@@ -303,8 +352,10 @@ object coincidence_xinyang {
s"""
|select count(distinct(cl_id)) zixun_device_all
|from online.tl_hdfs_maidian_view
|where partition_date > '20171118'
|where partition_date > '20180101'
|and action = 'welfare_detail_click_message'
|and cl_id not in (select device_id from bl_device_list)
|and cl_id not in (select device_id from blacklist)
""".stripMargin
)
zixun_device_all.show()
......@@ -313,9 +364,11 @@ object coincidence_xinyang {
s"""
|select count(cl_id) as zixun_num_co
|from online.tl_hdfs_maidian_view
|where partition_date > '20171118'
|where partition_date > '20180101'
|and action = 'welfare_detail_click_message'
|and cl_id in (select distinct(device_id) from device_id_coincidence)
|and cl_id not in (select device_id from bl_device_list)
|and cl_id not in (select device_id from blacklist)
""".stripMargin
)
zixun_num_co.show()
......@@ -324,9 +377,11 @@ object coincidence_xinyang {
s"""
|select count(distinct(cl_id)) as zixun_num_co_dis
|from online.tl_hdfs_maidian_view
|where partition_date > '20171118'
|where partition_date > '20180101'
|and action = 'welfare_detail_click_message'
|and cl_id in (select distinct(device_id) from device_id_coincidence)
|and cl_id not in (select device_id from bl_device_list)
|and cl_id not in (select device_id from blacklist)
""".stripMargin
)
zixun_num_co_dis.show()
......
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