| FROM (SELECT DISTINCT T.partition_date,T.person_id,
| T.service_id AS service_id
| FROM online.tl_meigou_shopcart_view T
| WHERE T.partition_date = '${partition_date}'
| AND from_unixtime(unix_timestamp(to_date(T.added_at), 'yyyy-MM-dd'), 'yyyyMMdd') = '${partition_date}') T5_1 --加入购物车的时间
| LEFT JOIN (SELECT T.person_id AS person_id,
| T5_3.device_id AS device_id
| FROM online.ml_user_updates T
| LATERAL VIEW explode(T.device_list) T5_3 AS device_id
| WHERE T.partition_date = '${partition_date}') T5_2
| ON T5_1.person_id = T5_2.person_id
""".stripMargin
)
// meigou_jiache.show()
//美购订单数据
// 百科点击数据
valmegou_order=sc.sql(
s"""
|SELECT partition_date,device_id,service_id
|from online.ml_meigou_order_detail
|where partition_date='${partition_date}'
|and device_id is not null
""".stripMargin
)
// megou_order.show()
//咨询美购数据
valwiki_click=sc.sql(
valzixun_meigou=sc.sql(
s"""
s"""
|SELECT cl_id as device_id,params['service_id'] as service_id
|SELECT cl_id as device_id,params['business_id'] as wiki_id
|from online.tl_hdfs_maidian_view
|from online.tl_hdfs_maidian_view
|where partition_date='${partition_date}'
|where partition_date='${partition_date}'
|and (action='welfare_detail_click_phone' or action='welfare_detail_click_consult' or action='welfare_detail_click_message' or action='welfare_detail_click_curearea_contact')
|and (action='Search_result_wiki_click_item' or action='search_result_click_infomation_item' or action='search_result_wiki_click_recommend_wiki')
""".stripMargin
""".stripMargin
)
)
zixun_meigou.show()
wiki_click.createOrReplaceTempView("wiki_click")
// 百科点击数据
valwiki_tag=sc.sql(
valwiki_click=sc.sql(
s"""
s"""
|SELECT cl_id,params['business_id'] as wiki_id
|SELECT item_id,tag_id
|from online.tl_hdfs_maidian_view
|from online.tl_hdfs_wiki_item_tag_view
|where partition_date='20190523'
|where partition_date='${partition_date}'
|and (action='Search_result_wiki_click_item' or action='search_result_click_infomation_item' or action='search_result_wiki_click_recommend_wiki')
""".stripMargin
""".stripMargin
)
)
wiki_click.show()
wiki_tag.createOrReplaceTempView("wiki_tag")
// 补单美购数据
valbudan_click=sc.sql(
valwiki_device_tag=sc.sql(
s"""
s"""
|SELECT cl_id,params['business_id'] as wiki_id
|SELECT a.device_id,b.tag_id
|from online.tl_hdfs_maidian_view
|from wiki_click a
|where partition_date='20190523'
|left join wiki_tag b
|and (action='Search_result_wiki_click_item' or action='search_result_click_infomation_item' or action='search_result_wiki_click_recommend_wiki')