Commit 596782ff authored by 王志伟's avatar 王志伟

新需求

parent 3a2ce602
...@@ -92,9 +92,8 @@ object app_list { ...@@ -92,9 +92,8 @@ object app_list {
agency_id.show() agency_id.show()
agency_id.createOrReplaceTempView("agency_id") agency_id.createOrReplaceTempView("agency_id")
//获取与新氧用户重合的用户device_id //获取与新氧用户重合的用户device_id
/* val app_list = sc.sql( val app_list = sc.sql(
s""" s"""
|select distinct(cl_id) as device_id, user_id as user_id, params['installed_app_info'] as app_list,channel |select distinct(cl_id) as device_id, user_id as user_id, params['installed_app_info'] as app_list,channel
|from online.tl_hdfs_maidian_view ov left join agency_id |from online.tl_hdfs_maidian_view ov left join agency_id
...@@ -140,7 +139,7 @@ object app_list { ...@@ -140,7 +139,7 @@ object app_list {
) )
val tempp_list=app_list_all.withColumn("stat_date",addCol(app_list_all("device_id"))) val tempp_list=app_list_all.withColumn("stat_date",addCol(app_list_all("device_id")))
GmeiConfig.writeToJDBCTable(tempp_list, "device_id_applist", SaveMode.Append) */ GmeiConfig.writeToJDBCTable(tempp_list, "device_id_applist", SaveMode.Append)
//在更美有消费的用户列表 //在更美有消费的用户列表
...@@ -350,51 +349,51 @@ object coincidence_xinyang { ...@@ -350,51 +349,51 @@ object coincidence_xinyang {
//* 所有获得用户列表的用户id //* 所有获得用户列表的用户id
//1.重合用户的美购数 //1.重合用户的美购数
val meigou_coincidence_num = sc.sql( val meigou_1 = sc.sql(
s""" s"""
|select count(ov.device_id) as meigou_coincidence_num |select count(ov.device_id) as meigou_1
|from online.ml_meigou_order_detail ov left join coincidence_id |from online.ml_meigou_order_detail ov left join coincidence_id
|on ov.device_id = coincidence_id.device_id |on ov.device_id = coincidence_id.device_id
|where partition_date = '20181120' |where ov.partition_date = '20181120'
|and coincidence_id.device_id is not null |and coincidence_id.device_id is not null
|and ov.pay_time is not null |and ov.pay_time is not null
|and ov.pay_time >= '2017-11-18' |and ov.pay_time >= '2017-11-18'
""".stripMargin """.stripMargin
) )
meigou_coincidence_num.show() meigou_1.show()
//2.重合用户进行美购的用户数 //2.重合用户进行美购的用户数
val meigou_pay_device = sc.sql( val meigou_2 = sc.sql(
s""" s"""
|select count(distinct(ov.device_id)) as meigou_coincidence_num |select count(distinct(ov.device_id)) as meigou_2
|from online.ml_meigou_order_detail ov left join coincidence_id |from online.ml_meigou_order_detail ov left join coincidence_id
|on ov.device_id = coincidence_id.device_id |on ov.device_id = coincidence_id.device_id
|where partition_date = '20181120' |where ov.partition_date = '20181120'
|and coincidence_id.device_id is not null |and coincidence_id.device_id is not null
|and ov.pay_time is not null |and ov.pay_time is not null
|and ov.pay_time >= '2017-11-18' |and ov.pay_time >= '2017-11-18'
""".stripMargin """.stripMargin
) )
meigou_pay_device.show() meigou_2.show()
//3.所有获得应用列表的用户的美购数 //3.所有获得应用列表的用户的美购数
val meigou_pay_all = sc.sql( val meigou_3 = sc.sql(
s""" s"""
|select count(od.device_id) as meigou_pay_device |select count(od.device_id) as meigou_3
|from online.ml_meigou_order_detail od inner join all_id |from online.ml_meigou_order_detail od inner join all_id
|on od.device_id = all_id.device_id |on od.device_id = all_id.device_id
|where partition_date = '20181120' |where od.partition_date = '20181120'
|and all_id.device_id is not null |and all_id.device_id is not null
|and od.pay_time is not null |and od.pay_time is not null
|and od.pay_time >= '2017-11-18' |and od.pay_time >= '2017-11-18'
""".stripMargin """.stripMargin
) )
meigou_pay_all.show() meigou_3.show()
//4.所有获得应用列表用户进行美购的用户数 //4.所有获得应用列表用户进行美购的用户数
val meigou_pay_device_all = sc.sql( val meigou_4 = sc.sql(
s""" s"""
|select count(distinct(od.device_id)) as meigou_pay_device |select count(distinct(od.device_id)) as meigou_4
|from online.ml_meigou_order_detail od inner join all_id |from online.ml_meigou_order_detail od inner join all_id
|on od.device_id = all_id.device_id |on od.device_id = all_id.device_id
|where partition_date = '20181120' |where partition_date = '20181120'
...@@ -403,12 +402,37 @@ object coincidence_xinyang { ...@@ -403,12 +402,37 @@ object coincidence_xinyang {
|and od.pay_time >= '2017-11-18' |and od.pay_time >= '2017-11-18'
""".stripMargin """.stripMargin
) )
meigou_pay_device_all.show() meigou_4.show()
// 5.所有用户过去一年的美购数
val meigou_5 = sc.sql(
s"""
|select count(device_id) as meigou_5
|from online.ml_meigou_order_detail
|where partition_date = '20181120'
|and pay_time is not null
|and pay_time >= '2017-11-18'
""".stripMargin
)
meigou_5.show()
// 56.所有用户过去一年的美购用户数
val meigou_6 = sc.sql(
s"""
|select count(distinct(device_id)) as meigou_6
|from online.ml_meigou_order_detail
|where partition_date = '20181120'
|and pay_time is not null
|and pay_time >= '2017-11-18'
""".stripMargin
)
meigou_6.show()
//截止目前获得的与新氧重合的用户数咨询统计 //截止目前获得的与新氧重合的用户数咨询统计
/* val zixun_num_all = sc.sql( //1.与新氧重合用户的美购咨询数
val zixun_1 = sc.sql(
s""" s"""
|select count(ov.cl_id) as zixun_num_all |select count(ov.cl_id) as zixun_1
|from online.tl_hdfs_maidian_view ov left join coincidence_id |from online.tl_hdfs_maidian_view ov left join coincidence_id
|on ov.cl_id = coincidence_id.device_id |on ov.cl_id = coincidence_id.device_id
|where partition_date >= '20180501' |where partition_date >= '20180501'
...@@ -416,11 +440,11 @@ object coincidence_xinyang { ...@@ -416,11 +440,11 @@ object coincidence_xinyang {
|and action = 'welfare_detail_click_message' |and action = 'welfare_detail_click_message'
""".stripMargin """.stripMargin
) )
zixun_num_all.show() zixun_1.show()
//2.与新氧重合用户的美购咨询用户数
val zixun_device_all = sc.sql( val zixun_2 = sc.sql(
s""" s"""
|select count(distinct(ov.cl_id)) as zixun_num_all |select count(distinct(ov.cl_id)) as zixun_2
|from online.tl_hdfs_maidian_view ov left join coincidence_id |from online.tl_hdfs_maidian_view ov left join coincidence_id
|on ov.cl_id = coincidence_id.device_id |on ov.cl_id = coincidence_id.device_id
|where partition_date >= '20180501' |where partition_date >= '20180501'
...@@ -428,31 +452,52 @@ object coincidence_xinyang { ...@@ -428,31 +452,52 @@ object coincidence_xinyang {
|and action = 'welfare_detail_click_message' |and action = 'welfare_detail_click_message'
""".stripMargin """.stripMargin
) )
zixun_device_all.show() zixun_2.show()
*/ //3.已经获得应用列表用户的美购咨询次数
val zixun_num_co = sc.sql( val zixun_3 = sc.sql(
s""" s"""
|select count(ov.cl_id) as zixun_num_all |select count(ov.cl_id) as zixun_3
|from online.tl_hdfs_maidian_view ov left join all_id |from online.tl_hdfs_maidian_view ov left join all_id
|on ov.cl_id = all_id.device_id |on ov.cl_id = all_id.device_id
|where partition_date >= '20180501' |where partition_date >= '20180501'
|and all_id.device_id is not null |and all_id.device_id is not null
|and action = 'welfare_detail_click_message' |and ov.action = 'welfare_detail_click_message'
""".stripMargin """.stripMargin
) )
zixun_num_co.show() zixun_3.show()
//4.已经获得应用列表用户的美购咨询用户数
val zixun_num_co_dis = sc.sql( val zixun_4 = sc.sql(
s""" s"""
|select count(distinct(ov.cl_id)) as zixun_num_all |select count(distinct(ov.cl_id)) as zixun_4
|from online.tl_hdfs_maidian_view ov left join all_id |from online.tl_hdfs_maidian_view ov left join all_id
|on ov.cl_id = all_id.device_id |on ov.cl_id = all_id.device_id
|where partition_date >= '20180501' |where partition_date >= '20180501'
|and all_id.device_id is not null |and all_id.device_id is not null
|and ov.action = 'welfare_detail_click_message'
""".stripMargin
)
zixun_4.show()
//5.所有用户的美购咨询数
val zixun_5 = sc.sql(
s"""
|select count(cl_id) as zixun_5
|from online.tl_hdfs_maidian_view
|where partition_date >= '20180501'
|and action = 'welfare_detail_click_message'
""".stripMargin
)
zixun_5.show()
//6.所有用户的美购咨询用户数
val zixun_6 = sc.sql(
s"""
|select count(distinct(cl_id)) as zixun_6
|from online.tl_hdfs_maidian_view
|where partition_date >= '20180501'
|and action = 'welfare_detail_click_message' |and action = 'welfare_detail_click_message'
""".stripMargin """.stripMargin
) )
zixun_num_co_dis.show() zixun_6.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