|
@@ -199,7 +199,15 @@
|
|
|
t4.mall_logistics_score as 'mallLogisticsScore',
|
|
|
t4.shop_score as 'shopScore',
|
|
|
t4.mall_service_score as 'mallServiceScore',
|
|
|
- t4.mall_quality_score as 'mallQualityScore'
|
|
|
+ t4.mall_quality_score as 'mallQualityScore',
|
|
|
+ (
|
|
|
+ case when t5.is_presale = 1
|
|
|
+ then '否'
|
|
|
+ when t5.is_presale = 2
|
|
|
+ then '是'
|
|
|
+ else '-'
|
|
|
+ end
|
|
|
+ ) as 'isPresale'
|
|
|
from kuaishou_supply_chain t1
|
|
|
left join kuaishou_item_bind_user t2
|
|
|
on t1.item_id = t2.item_id
|
|
@@ -207,6 +215,8 @@
|
|
|
on t1.item_id = t3.item_id
|
|
|
left join kuaishou_activity_open_item_list t4
|
|
|
on t1.item_id = t4.item_id
|
|
|
+ left join kuaishou_item_list t5
|
|
|
+ on t1.item_id = t5.item_id
|
|
|
where 1 = 1
|
|
|
<if test="start != null and start != ''">
|
|
|
and t1.order_create_time >= #{start}
|
|
@@ -231,6 +241,14 @@
|
|
|
|
|
|
<select id="itemBindList" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
select t1.*,t2.*,
|
|
|
+ (
|
|
|
+ case when t4.is_presale = 1
|
|
|
+ then '否'
|
|
|
+ when t4.is_presale = 2
|
|
|
+ then '是'
|
|
|
+ else '-'
|
|
|
+ end
|
|
|
+ ) as 'isPresale',
|
|
|
t3.shop_star as 'shopStar',
|
|
|
t3.mall_logistics_score as 'mallLogisticsScore',
|
|
|
t3.shop_score as 'shopScore',
|
|
@@ -280,6 +298,8 @@
|
|
|
group by item_id) t2 on t1.itemId = t2.itemId
|
|
|
left join kuaishou_activity_open_item_list t3
|
|
|
on t1.itemId = t3.item_id
|
|
|
+ left join kuaishou_item_list t4
|
|
|
+ on t1.itemId = t4.item_id
|
|
|
|
|
|
where 1 = 1
|
|
|
<if test="itemId != null and itemId != ''">
|
|
@@ -885,7 +905,15 @@
|
|
|
t4.mall_logistics_score as 'mallLogisticsScore',
|
|
|
t4.shop_score as 'shopScore',
|
|
|
t4.mall_service_score as 'mallServiceScore',
|
|
|
- t4.mall_quality_score as 'mallQualityScore'
|
|
|
+ t4.mall_quality_score as 'mallQualityScore',
|
|
|
+ (
|
|
|
+ case when t5.is_presale = 1
|
|
|
+ then '否'
|
|
|
+ when t5.is_presale = 2
|
|
|
+ then '是'
|
|
|
+ else '-'
|
|
|
+ end
|
|
|
+ ) as 'isPresale'
|
|
|
from kuaishou_supply_chain t1
|
|
|
left join kuaishou_item_bind_user t2
|
|
|
on t1.item_id = t2.item_id
|
|
@@ -893,6 +921,8 @@
|
|
|
on t1.item_id = t3.item_id
|
|
|
left join kuaishou_activity_open_item_list t4
|
|
|
on t1.item_id = t4.item_id
|
|
|
+ left join kuaishou_item_list t5
|
|
|
+ on t1.item_id = t5.item_id
|
|
|
where 1 = 1
|
|
|
<if test="start != null and start != ''">
|
|
|
and t1.order_create_time >= #{start}
|
|
@@ -1575,12 +1605,20 @@
|
|
|
|
|
|
|
|
|
<select id="getMonthOrderAmount" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
+ select t.* ,t2.valid_order_rate as 'validOrderRate',
|
|
|
+ t2.valid_gmv_rate as 'validGmvRate'
|
|
|
+ from (
|
|
|
SELECT
|
|
|
FROM_UNIXTIME(order_create_time / 1000, '%Y-%m-%d') as 'date',
|
|
|
+ FROM_UNIXTIME(order_create_time / 1000, '%Y%m%d') as 'dateInt',
|
|
|
count(1) AS 'orderCount',
|
|
|
IFNULL(SUM(CASE WHEN order_status != 80 THEN 1 ELSE 0 END), 0) AS 'validOrderCount',
|
|
|
IFNULL(SUM(order_amount),0) AS 'orderAmount',
|
|
|
IFNULL(SUM(CASE WHEN order_status != 80 THEN order_amount ELSE 0 END),0) AS 'validOrderAmount',
|
|
|
+ concat( round(IFNULL(SUM(CASE WHEN order_status != 80 THEN 1 ELSE 0 END), 0) / count(1) * 100,2 ),'%') as
|
|
|
+ 'validOrderCountRate',
|
|
|
+ concat( round(IFNULL(SUM(CASE WHEN order_status != 80 THEN order_amount ELSE 0 END), 0) /IFNULL(SUM(
|
|
|
+ order_amount),0) * 100,2 ),'%') as 'validOrderAmountRate',
|
|
|
IFNULL(SUM(CASE WHEN order_status != 80 THEN regimental_promotion_amount ELSE 0 END),0) AS
|
|
|
'regimentalPromotionAmount',
|
|
|
COUNT(DISTINCT promoter_id) as 'promoterCount'
|
|
@@ -1593,15 +1631,27 @@
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
- GROUP BY FROM_UNIXTIME(order_create_time / 1000, '%Y-%m-%d')
|
|
|
+ GROUP BY FROM_UNIXTIME(order_create_time / 1000, '%Y-%m-%d')) t left join valid_order_gmv_rate t2
|
|
|
+ on t.dateInt = t2.stat_date
|
|
|
+
|
|
|
</select>
|
|
|
|
|
|
<select id="getMonthOrderAmountBytedance" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
+ select t.*,t2.valid_order_rate as 'validOrderRate', t2.valid_gmv_rate as 'validGmvRate'
|
|
|
+ from(
|
|
|
SELECT
|
|
|
DATE_FORMAT(pay_success_time, '%Y-%m-%d') as 'date',
|
|
|
+ pay_success_time as 'dateInt',
|
|
|
count(1) AS 'orderCount',
|
|
|
IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END), 0) AS 'validOrderCount',
|
|
|
- IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN total_pay_amount ELSE 0 END),0) AS 'orderAmount',
|
|
|
+
|
|
|
+ IFNULL(SUM( total_pay_amount),0) AS 'orderAmount',
|
|
|
+ IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN total_pay_amount ELSE 0 END),0) AS 'validOrderAmount',
|
|
|
+
|
|
|
+ concat( round(IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END), 0) / count(1) * 100,2 ),'%') as
|
|
|
+ 'validOrderCountRate',
|
|
|
+ concat( round(IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN total_pay_amount ELSE 0 END), 0) /IFNULL(SUM(
|
|
|
+ total_pay_amount),0) * 100,2 ),'%') as 'validOrderAmountRate',
|
|
|
IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END) * 0.9 ,0) AS
|
|
|
'regimentalPromotionAmount',
|
|
|
COUNT(DISTINCT author_short_id) as 'promoterCount'
|
|
@@ -1614,16 +1664,25 @@
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
- GROUP BY pay_success_time
|
|
|
+ GROUP BY pay_success_time) t left join bytedance_valid_order_gmv_rate t2
|
|
|
+ on t.dateInt = t2.stat_date
|
|
|
</select>
|
|
|
|
|
|
<select id="getMonthOrderAmountByItems" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
+ select t.*,t2.valid_order_rate as 'validOrderRate',
|
|
|
+ t2.valid_gmv_rate as 'validGmvRate'
|
|
|
+ from (
|
|
|
SELECT
|
|
|
FROM_UNIXTIME(order_create_time / 1000, '%Y-%m-%d') as 'date',
|
|
|
+ FROM_UNIXTIME(order_create_time / 1000, '%Y%m%d') as 'dateInt',
|
|
|
count(1) AS 'orderCount',
|
|
|
IFNULL(SUM(CASE WHEN order_status != 80 THEN 1 ELSE 0 END), 0) AS 'validOrderCount',
|
|
|
IFNULL(SUM(order_amount),0) AS 'orderAmount',
|
|
|
IFNULL(SUM(CASE WHEN order_status != 80 THEN order_amount ELSE 0 END),0) AS 'validOrderAmount',
|
|
|
+ concat( round(IFNULL(SUM(CASE WHEN order_status != 80 THEN 1 ELSE 0 END), 0) / count(1) * 100,2 ),'%') as
|
|
|
+ 'validOrderCountRate',
|
|
|
+ concat( round(IFNULL(SUM(CASE WHEN order_status != 80 THEN order_amount ELSE 0 END), 0) /IFNULL(SUM(
|
|
|
+ order_amount),0) * 100,2 ),'%') as 'validOrderAmountRate',
|
|
|
IFNULL(SUM(CASE WHEN order_status != 80 THEN regimental_promotion_amount ELSE 0 END),0) AS
|
|
|
'regimentalPromotionAmount'
|
|
|
FROM kuaishou_supply_chain
|
|
@@ -1636,15 +1695,26 @@
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
- GROUP BY FROM_UNIXTIME(order_create_time / 1000, '%Y-%m-%d')
|
|
|
+ GROUP BY FROM_UNIXTIME(order_create_time / 1000, '%Y-%m-%d')) t left join valid_order_gmv_rate t2
|
|
|
+ on t.dateInt = t2.stat_date
|
|
|
</select>
|
|
|
|
|
|
<select id="getMonthOrderAmountByItemsBytedance" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
+ select t.*, t2.valid_order_rate as 'validOrderRate',
|
|
|
+ t2.valid_gmv_rate as 'validGmvRate'
|
|
|
+ from (
|
|
|
SELECT
|
|
|
DATE_FORMAT(pay_success_time, '%Y-%m-%d') as 'date',
|
|
|
+ pay_success_time as 'dateInt',
|
|
|
count(1) AS 'orderCount',
|
|
|
IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END), 0) AS 'validOrderCount',
|
|
|
IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN total_pay_amount ELSE 0 END),0) AS 'orderAmount',
|
|
|
+
|
|
|
+ concat( round(IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END), 0) / count(1) * 100,2 ),'%') as
|
|
|
+ 'validOrderCountRate',
|
|
|
+
|
|
|
+ concat( round(IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN total_pay_amount ELSE 0 END), 0) /IFNULL(SUM(
|
|
|
+ total_pay_amount),0) * 100,2 ),'%') as 'validOrderAmountRate',
|
|
|
IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END) * 0.9,0) AS
|
|
|
'regimentalPromotionAmount'
|
|
|
FROM bytedance_order_list
|
|
@@ -1657,7 +1727,8 @@
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
- GROUP BY pay_success_time
|
|
|
+ GROUP BY pay_success_time) t left join bytedance_valid_order_gmv_rate t2
|
|
|
+ on t.dateInt = t2.stat_date
|
|
|
</select>
|
|
|
|
|
|
<select id="getMonthOrderAmountTotal" resultType="com.alibaba.fastjson.JSONObject">
|
|
@@ -2545,7 +2616,15 @@
|
|
|
t4.mall_logistics_score as 'mallLogisticsScore',
|
|
|
t4.shop_score as 'shopScore',
|
|
|
t4.mall_service_score as 'mallServiceScore',
|
|
|
- t4.mall_quality_score as 'mallQualityScore'
|
|
|
+ t4.mall_quality_score as 'mallQualityScore',
|
|
|
+ (
|
|
|
+ case when t5.is_presale = 1
|
|
|
+ then '否'
|
|
|
+ when t5.is_presale = 2
|
|
|
+ then '是'
|
|
|
+ else '-'
|
|
|
+ end
|
|
|
+ ) as 'isPresale'
|
|
|
from (select item_id as 'itemId', item_title as 'itemTitle', user_id as 'userId', user_name as 'userName'
|
|
|
from kuaishou_item_list
|
|
|
where
|
|
@@ -2573,8 +2652,8 @@
|
|
|
on t1.itemId = t3.item_id
|
|
|
left join kuaishou_activity_open_item_list t4
|
|
|
on t1.itemId = t4.item_id
|
|
|
-
|
|
|
-
|
|
|
+ left join kuaishou_item_list t5
|
|
|
+ on t1.itemId = t5.item_id
|
|
|
where 1 = 1
|
|
|
<if test="itemId != null and itemId != ''">
|
|
|
and t1.item_id = #{itemId}
|