|
@@ -25,9 +25,12 @@
|
|
|
round(sum(case when order_status != 80 then 1 else 0 end) / count(oid),4) as 'validRadio',
|
|
|
sum(pay_amount) as 'payAmount',
|
|
|
sum(case when order_status != 80 then pay_amount else 0 end) as 'validPayAmount',
|
|
|
- sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'deliveryNum',
|
|
|
- sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
|
|
|
+ sum(case when send_status = 1 then 1 else 0 end) as 'deliveryNum',
|
|
|
round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when order_status != 80
|
|
|
+ then 1 else 0 end),4) as 'shippingGreen',
|
|
|
+ sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'effDeliveryNum',
|
|
|
+ sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
|
|
|
+ round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when send_status = 1
|
|
|
then 1 else 0 end),4) as 'deliveryRadio',
|
|
|
sum(case when order_status != 80 then regimental_promotion_amount else 0 end) as 'regimentalPromotionAmount'
|
|
|
from kuaishou_supply_chain
|
|
@@ -88,9 +91,12 @@
|
|
|
round(sum(case when order_status != 80 then 1 else 0 end) / count(oid),4) as 'validRadio',
|
|
|
sum(case when order_status != 80 then pay_amount else 0 end) as 'payAmount',
|
|
|
regimental_promotion_rate as 'regimentalPromotionRate',
|
|
|
- sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'deliveryNum',
|
|
|
- sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
|
|
|
+ sum(case when send_status = 1 then 1 else 0 end) as 'deliveryNum',
|
|
|
round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when order_status != 80
|
|
|
+ then 1 else 0 end),4) as 'shippingGreen',
|
|
|
+ sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'effDeliveryNum',
|
|
|
+ sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
|
|
|
+ round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when send_status = 1
|
|
|
then 1 else 0 end),4) as 'deliveryRadio'
|
|
|
from kuaishou_supply_chain
|
|
|
where 1= 1
|
|
@@ -149,10 +155,13 @@
|
|
|
count(t1.oid) as 'orderNum',
|
|
|
sum(case when t1.order_status != 80 then 1 else 0 end) as 'validOrderNUm',
|
|
|
round(sum(case when t1.order_status != 80 then 1 else 0 end) / count(t1.oid), 4) as 'validRadio',
|
|
|
- sum(case when t1.send_status = 1 and t1.order_status != 80 then 1 else 0 end) as 'deliveryNum',
|
|
|
+ sum(case when t1.send_status = 1 then 1 else 0 end) as 'deliveryNum',
|
|
|
+ round(sum(case when t1.send_status = 1 and t1.order_status != 80 then 1 else 0 end) / sum(case when t1.order_status != 80
|
|
|
+ then 1 else 0 end),4) as 'shippingGreen',
|
|
|
+ sum(case when t1.send_status = 1 and t1.order_status != 80 then 1 else 0 end) as 'effDeliveryNum',
|
|
|
sum(case when t1.send_status = 0 and t1.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
|
|
|
round(sum(case when t1.send_status = 1 and t1.order_status != 80 then 1 else 0 end) / sum(case when
|
|
|
- t1.order_status != 80 then 1 else 0 end), 4) as 'deliveryRadio',
|
|
|
+ send_status = 1 then 1 else 0 end), 4) as 'deliveryRadio',
|
|
|
t1.item_commission_rate as 'itemCommissionRate'
|
|
|
from kuaishou_supply_chain t1
|
|
|
left join kuaishou_item_bind_user t2
|
|
@@ -199,11 +208,14 @@
|
|
|
sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
|
|
|
round(sum(case when order_status != 80 then 1 else 0 end) / count(oid),
|
|
|
4) as 'validRadio',
|
|
|
- sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'deliveryNum',
|
|
|
+ sum(case when send_status = 1 then 1 else 0 end) as 'deliveryNum',
|
|
|
+ round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when order_status != 80
|
|
|
+ then 1 else 0 end),4) as 'shippingGreen',
|
|
|
+ sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'effDeliveryNum',
|
|
|
sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
|
|
|
round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case
|
|
|
when
|
|
|
- order_status != 80
|
|
|
+ send_status = 1
|
|
|
then 1
|
|
|
else 0 end),
|
|
|
4) as 'deliveryRadio',
|
|
@@ -256,9 +268,12 @@
|
|
|
regimental_promotion_rate as 'regimentalPromotionRate',
|
|
|
sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
|
|
|
round(sum(case when order_status != 80 then 1 else 0 end) / count(oid),4) as 'validRadio',
|
|
|
- sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'deliveryNum',
|
|
|
- sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
|
|
|
+ sum(case when send_status = 1 then 1 else 0 end) as 'deliveryNum',
|
|
|
round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when order_status != 80
|
|
|
+ then 1 else 0 end),4) as 'shippingGreen',
|
|
|
+ sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'effDeliveryNum',
|
|
|
+ sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
|
|
|
+ round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when send_status = 1
|
|
|
then 1 else 0 end),4) as 'deliveryRadio'
|
|
|
from kuaishou_supply_chain
|
|
|
where 1= 1
|
|
@@ -292,9 +307,12 @@
|
|
|
count(oid) as 'orderNum',
|
|
|
sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
|
|
|
round(sum(case when order_status != 80 then 1 else 0 end) / count(oid),4) as 'validRadio',
|
|
|
- sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'deliveryNum',
|
|
|
- sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
|
|
|
+ sum(case when send_status = 1 then 1 else 0 end) as 'deliveryNum',
|
|
|
round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when order_status != 80
|
|
|
+ then 1 else 0 end),4) as 'shippingGreen',
|
|
|
+ sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'effDeliveryNum',
|
|
|
+ sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
|
|
|
+ round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when send_status = 1
|
|
|
then 1 else 0 end),4) as 'deliveryRadio',
|
|
|
sum(case when order_status = 80 then 1 else 0 end) as 'invalidOrderNUm',
|
|
|
regimental_promotion_rate as 'regimentalPromotionRate',
|
|
@@ -869,10 +887,13 @@
|
|
|
count(t2.oid) as 'orderNum',
|
|
|
sum(case when t2.order_status != 80 then 1 else 0 end) as 'validOrderNUm',
|
|
|
round(sum(case when t2.order_status != 80 then 1 else 0 end) / count(t2.oid),4) as 'validRadio',
|
|
|
- sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) as 'deliveryNum',
|
|
|
+ sum(case when t2.send_status = 1 then 1 else 0 end) as 'deliveryNum',
|
|
|
+ round(sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) / sum(case when t2.order_status != 80
|
|
|
+ then 1 else 0 end),4) as 'shippingGreen',
|
|
|
+ sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) as 'effDeliveryNum',
|
|
|
sum(case when t2.send_status = 0 and t2.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
|
|
|
round(sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) / sum(case
|
|
|
- when t2.order_status != 80
|
|
|
+ when send_status = 1
|
|
|
then 1
|
|
|
else 0 end),
|
|
|
4) as 'deliveryRadio',
|
|
@@ -937,10 +958,21 @@
|
|
|
sum(
|
|
|
CASE
|
|
|
WHEN t2.send_status = 1
|
|
|
- AND t2.order_status != 80 THEN 1
|
|
|
+ THEN 1
|
|
|
ELSE 0
|
|
|
END
|
|
|
) AS 'deliveryNum',
|
|
|
+
|
|
|
+ round(sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) / sum(case when t2.order_status != 80
|
|
|
+ then 1 else 0 end),4) as 'shippingGreen',
|
|
|
+
|
|
|
+ sum(
|
|
|
+ CASE
|
|
|
+ WHEN t2.send_status = 1
|
|
|
+ AND t2.order_status != 80 THEN 1
|
|
|
+ ELSE 0
|
|
|
+ END
|
|
|
+ ) AS 'effDeliveryNum',
|
|
|
sum(case when t2.send_status = 0 and t2.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
|
|
|
round(
|
|
|
sum(
|
|
@@ -951,7 +983,7 @@
|
|
|
END
|
|
|
) / sum(
|
|
|
CASE
|
|
|
- WHEN t2.order_status != 80 THEN 1
|
|
|
+ WHEN t2.send_status = 1 THEN 1
|
|
|
ELSE 0
|
|
|
END
|
|
|
),
|
|
@@ -1099,10 +1131,21 @@
|
|
|
sum(
|
|
|
CASE
|
|
|
WHEN t2.send_status = 1
|
|
|
- AND t2.order_status != 80 THEN 1
|
|
|
+ THEN 1
|
|
|
ELSE 0
|
|
|
END
|
|
|
) AS 'deliveryNum',
|
|
|
+
|
|
|
+ round(sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) / sum(case when t2.order_status != 80
|
|
|
+ then 1 else 0 end),4) as 'shippingGreen',
|
|
|
+
|
|
|
+ sum(
|
|
|
+ CASE
|
|
|
+ WHEN t2.send_status = 1
|
|
|
+ AND t2.order_status != 80 THEN 1
|
|
|
+ ELSE 0
|
|
|
+ END
|
|
|
+ ) AS 'effDeliveryNum',
|
|
|
sum(case when t2.send_status = 0 and t2.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
|
|
|
round(
|
|
|
sum(
|
|
@@ -1113,7 +1156,7 @@
|
|
|
END
|
|
|
) / sum(
|
|
|
CASE
|
|
|
- WHEN t2.order_status != 80 THEN 1
|
|
|
+ WHEN t2.send_status != 80 THEN 1
|
|
|
ELSE 0
|
|
|
END
|
|
|
),
|
|
@@ -1289,7 +1332,7 @@
|
|
|
COUNT(order_id) as 'allNumber',
|
|
|
IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END), 0) AS 'validOrderNUm',
|
|
|
IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN total_pay_amount ELSE 0 END), 0) AS 'orderAmount',
|
|
|
- IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END),0) AS
|
|
|
+ IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END) * 0.9,0) AS
|
|
|
'regimentalPromotionAmount'
|
|
|
FROM bytedance_order_list
|
|
|
WHERE pay_success_time >= #{startDate}
|
|
@@ -1335,7 +1378,7 @@
|
|
|
COUNT(order_id) as 'allNumber',
|
|
|
IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END), 0) AS 'validOrderNUm',
|
|
|
IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN total_pay_amount ELSE 0 END)/100, 0) AS 'orderAmount',
|
|
|
- IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END)/100,0) AS
|
|
|
+ IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END) * 0.9 /100,0) AS
|
|
|
'regimentalPromotionAmount'
|
|
|
FROM bytedance_order_list
|
|
|
WHERE pay_success_time >= #{startDate}
|
|
@@ -1429,7 +1472,7 @@
|
|
|
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(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END),0) AS
|
|
|
+ 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'
|
|
|
FROM bytedance_order_list
|
|
@@ -1472,7 +1515,7 @@
|
|
|
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(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END),0) AS
|
|
|
+ IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END) * 0.9,0) AS
|
|
|
'regimentalPromotionAmount'
|
|
|
FROM bytedance_order_list
|
|
|
WHERE pay_success_time >= #{startLong}
|
|
@@ -1537,7 +1580,7 @@
|
|
|
(
|
|
|
SELECT
|
|
|
IFNULL(SUM(total_pay_amount),0) AS 'orderAmount',
|
|
|
- IFNULL(SUM(colonel_estimated_commission),0) AS 'regimentalPromotionAmount'
|
|
|
+ IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END) * 0.9,0) AS 'regimentalPromotionAmount'
|
|
|
FROM bytedance_order_list t1
|
|
|
WHERE flow_point != 'REFUND'
|
|
|
<if test='promoterIds != null and promoterIds.size() > 0'>
|
|
@@ -1552,7 +1595,7 @@
|
|
|
(
|
|
|
SELECT
|
|
|
IFNULL(SUM(total_pay_amount),0) AS 'orderAmount',
|
|
|
- IFNULL(SUM(colonel_estimated_commission),0) AS 'regimentalPromotionAmount'
|
|
|
+ IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END) * 0.9,0) AS 'regimentalPromotionAmount'
|
|
|
FROM bytedance_order_list t1
|
|
|
WHERE flow_point != 'REFUND'
|
|
|
<if test='promoterIds != null and promoterIds.size() > 0'>
|
|
@@ -1625,7 +1668,7 @@
|
|
|
(
|
|
|
SELECT
|
|
|
IFNULL(SUM(total_pay_amount),0) AS 'orderAmount',
|
|
|
- IFNULL(SUM(colonel_estimated_commission),0) AS 'regimentalPromotionAmount',
|
|
|
+ IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END) * 0.9,0) AS 'regimentalPromotionAmount',
|
|
|
COUNT(order_id) as 'orderCount'
|
|
|
FROM bytedance_order_list t1
|
|
|
WHERE flow_point != 'REFUND'
|
|
@@ -1643,7 +1686,7 @@
|
|
|
(
|
|
|
SELECT
|
|
|
IFNULL(SUM(total_pay_amount),0) AS 'orderAmount',
|
|
|
- IFNULL(SUM(colonel_estimated_commission),0) AS 'regimentalPromotionAmount',
|
|
|
+ IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END) * 0.9,0) AS 'regimentalPromotionAmount',
|
|
|
COUNT(order_id) as 'orderCount'
|
|
|
FROM bytedance_order_list t1
|
|
|
WHERE flow_point != 'REFUND'
|
|
@@ -2049,10 +2092,13 @@
|
|
|
count(t2.oid) as 'orderNum',
|
|
|
sum(case when t2.order_status != 80 then 1 else 0 end) as 'validOrderNUm',
|
|
|
round(sum(case when t2.order_status != 80 then 1 else 0 end) / count(t2.oid), 4) as 'validRadio',
|
|
|
- sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) as 'deliveryNum',
|
|
|
+ sum(case when t2.send_status = 1 then 1 else 0 end) as 'deliveryNum',
|
|
|
+ round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when order_status != 80
|
|
|
+ then 1 else 0 end),4) as 'shippingGreen',
|
|
|
+ sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) as 'effDeliveryNum',
|
|
|
sum(case when t2.send_status = 0 and t2.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
|
|
|
round(sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) / sum(case
|
|
|
- when t2.order_status != 80
|
|
|
+ when t2.send_status = 1
|
|
|
then 1
|
|
|
else 0 end),
|
|
|
4) as 'deliveryRadio',
|
|
@@ -2202,7 +2248,7 @@
|
|
|
from user_promoters_count
|
|
|
where media_id = 2) ttttt
|
|
|
on t.collectSampleId = ttttt.user_id
|
|
|
- where t.orderNum > 0
|
|
|
+ where t.orderNum > 0
|
|
|
order by t.orderNum desc
|
|
|
</select>
|
|
|
<select id="bdTotalV2" resultType="com.alibaba.fastjson.JSONObject">
|