Commit 59964e3a authored by 王志伟's avatar 王志伟

统计用户消费金额及占比曲线

parent 0cb01f1a
......@@ -467,13 +467,38 @@ object meigou_xiaofei_renshu {
final_id.createOrReplaceTempView("final_id")
// val meigou_price = sc.sql(
// s"""
// |select md.user_id,sum(md.gengmei_price) as pay_all
// |from online.ml_meigou_order_detail md left join final_id
// |on md.device_id = final_id.device_id
// |where md.status= 2
// |and final_id.device_id is null
// |and md.partition_date = '20181223'
// |and md.pay_time is not null
// |and md.validate_time>'2017-01-01 00:00:00.0'
// |group by md.user_id
// |order by sum(md.gengmei_price)
// """.stripMargin
// )
// meigou_price.show(80)
val meigou_price = sc.sql(
s"""
|select md.user_id,sum(md.gengmei_price) as pay_all
|from online.ml_meigou_order_detail md left join final_id
|on md.device_id = final_id.device_id
|from online.ml_meigou_order_detail md
|left join
|(
| SELECT
| order_id
| FROM mining.ml_order_spam_recognize
| WHERE partition_date='20181223' AND
| self_support=0 AND dayBitsGetW1(predict_result,'20181223')=0
|)spam
|on md.order_id = spam.order_id
|where md.status= 2
|and final_id.device_id is null
|and spam.order_id is null
|and md.partition_date = '20181223'
|and md.pay_time is not null
|and md.validate_time>'2017-01-01 00:00:00.0'
......
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