|
@@ -1078,7 +1078,7 @@
|
|
|
CONCAT(IFNULL(ROUND(sendCount / allNumber * 100, 2),0), '%') as 'sendRate'
|
|
|
FROM (
|
|
|
SELECT
|
|
|
- count(DISTINCT promoter_id) as 'promoterCount',
|
|
|
+ COUNT(DISTINCT promoter_id) as 'promoterCount',
|
|
|
COUNT(oid) as 'allNumber',
|
|
|
IFNULL(SUM(CASE WHEN order_status != 80 THEN 1 ELSE 0 END), 0) AS 'validOrderNUm',
|
|
|
IFNULL(SUM(CASE WHEN order_status != 80 THEN order_amount ELSE 0 END), 0) AS 'orderAmount',
|
|
@@ -1131,45 +1131,35 @@
|
|
|
<select id="getMonthOrderAmount" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
SELECT
|
|
|
FROM_UNIXTIME(order_create_time / 1000, '%Y-%m-%d') as 'date',
|
|
|
- IFNULL(SUM(CASE WHEN order_status != 80 THEN 1 ELSE 0 END), 0) AS 'orderCount',
|
|
|
- IFNULL(SUM(order_amount),0) AS 'orderAmount',
|
|
|
- IFNULL(SUM(regimental_promotion_amount),0) AS 'totalRegimentalSettleAmount',
|
|
|
- IFNULL(promoterCount,0) AS 'promoterCount'
|
|
|
+ count(1) AS 'orderCount',
|
|
|
+ IFNULL(SUM(CASE WHEN order_status != 80 THEN 1 ELSE 0 END), 0) AS 'validOrderCount',
|
|
|
+ IFNULL(SUM(CASE WHEN order_status != 80 THEN order_amount ELSE 0 END),0) AS 'orderAmount',
|
|
|
+ IFNULL(SUM(CASE WHEN order_status != 80 THEN regimental_promotion_amount ELSE 0 END),0) AS
|
|
|
+ 'regimentalPromotionAmount',
|
|
|
+ COUNT(DISTINCT promoter_id) as 'promoterCount'
|
|
|
FROM kuaishou_supply_chain t1
|
|
|
- LEFT JOIN (
|
|
|
- SELECT count(promoter_id) as 'promoterCount', DATE_FORMAT(create_time, '%Y-%m-%d') as 'date'
|
|
|
- FROM kuaishou_promoter
|
|
|
- WHERE DATE_FORMAT(create_time, '%Y-%m-%d') >= #{start}
|
|
|
- AND DATE_FORMAT(create_time, '%Y-%m-%d') <= #{end}
|
|
|
- <if test="userList != null and userList.size() > 0 ">
|
|
|
- AND user_id in
|
|
|
- <foreach collection="userList" item="item" separator=","
|
|
|
- open="(" close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- GROUP BY DATE_FORMAT(create_time, '%Y-%m-%d')
|
|
|
- ) t2 ON FROM_UNIXTIME(t1.order_create_time / 1000, '%Y-%m-%d') = t2.date
|
|
|
- WHERE order_status != 80
|
|
|
+ WHERE order_create_time >= #{startLong}
|
|
|
+ AND order_create_time <= #{endLong}
|
|
|
<if test='promoterIds != null and promoterIds.size() > 0'>
|
|
|
AND promoter_id in
|
|
|
<foreach collection="promoterIds" item="item" separator="," open="(" close=")">
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
- AND order_create_time >= #{startLong}
|
|
|
- AND order_create_time <= #{endLong}
|
|
|
GROUP BY FROM_UNIXTIME(order_create_time / 1000, '%Y-%m-%d')
|
|
|
</select>
|
|
|
|
|
|
<select id="getMonthOrderAmountByItems" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
SELECT
|
|
|
FROM_UNIXTIME(order_create_time / 1000, '%Y-%m-%d') as 'date',
|
|
|
- IFNULL(SUM(CASE WHEN order_status != 80 THEN 1 ELSE 0 END), 0) AS 'orderCount',
|
|
|
- IFNULL(SUM(order_amount),0) AS 'orderAmount',
|
|
|
- IFNULL(SUM(regimental_promotion_amount),0) AS 'totalRegimentalSettleAmount'
|
|
|
+ count(1) AS 'orderCount',
|
|
|
+ IFNULL(SUM(CASE WHEN order_status != 80 THEN 1 ELSE 0 END), 0) AS 'validOrderCount',
|
|
|
+ IFNULL(SUM(CASE WHEN order_status != 80 THEN order_amount ELSE 0 END),0) AS 'orderAmount',
|
|
|
+ IFNULL(SUM(CASE WHEN order_status != 80 THEN regimental_promotion_amount ELSE 0 END),0) AS
|
|
|
+ 'regimentalPromotionAmount'
|
|
|
FROM kuaishou_supply_chain
|
|
|
- WHERE order_status != 80
|
|
|
+ WHERE order_create_time >= #{startLong}
|
|
|
+ AND order_create_time <= #{endLong}
|
|
|
<if test='itemIds != null and itemIds.size() > 0'>
|
|
|
AND item_id in
|
|
|
<foreach collection="itemIds" item="item" separator=","
|
|
@@ -1177,23 +1167,21 @@
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
- AND order_create_time >= #{startLong}
|
|
|
- AND order_create_time <= #{endLong}
|
|
|
GROUP BY FROM_UNIXTIME(order_create_time / 1000, '%Y-%m-%d')
|
|
|
</select>
|
|
|
|
|
|
<select id="getMonthOrderAmountTotal" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
SELECT
|
|
|
t1.orderAmount,
|
|
|
- t1.totalRegimentalSettleAmount,
|
|
|
+ t1.regimentalPromotionAmount,
|
|
|
CONCAT(IFNULL(ROUND(t2.orderAmount/t1.orderAmount*100,2),0),'%') as 'orderAmountRate',
|
|
|
- CONCAT(IFNULL(ROUND(t2.totalRegimentalSettleAmount/t1.totalRegimentalSettleAmount*100,2),0),'%') as
|
|
|
- 'totalRegimentalSettleAmountRate'
|
|
|
+ CONCAT(IFNULL(ROUND(t2.regimentalPromotionAmount/t1.regimentalPromotionAmount*100,2),0),'%') as
|
|
|
+ 'regimentalPromotionAmountRate'
|
|
|
FROM
|
|
|
(
|
|
|
SELECT
|
|
|
IFNULL(SUM(order_amount),0) AS 'orderAmount',
|
|
|
- IFNULL(SUM(regimental_promotion_amount),0) AS 'totalRegimentalSettleAmount'
|
|
|
+ IFNULL(SUM(regimental_promotion_amount),0) AS 'regimentalPromotionAmount'
|
|
|
FROM kuaishou_supply_chain t1
|
|
|
WHERE order_status != 80
|
|
|
<if test='promoterIds != null and promoterIds.size() > 0'>
|
|
@@ -1208,7 +1196,7 @@
|
|
|
(
|
|
|
SELECT
|
|
|
IFNULL(SUM(order_amount),0) AS 'orderAmount',
|
|
|
- IFNULL(SUM(regimental_promotion_amount),0) AS 'totalRegimentalSettleAmount'
|
|
|
+ IFNULL(SUM(regimental_promotion_amount),0) AS 'regimentalPromotionAmount'
|
|
|
FROM kuaishou_supply_chain t1
|
|
|
WHERE order_status != 80
|
|
|
<if test='promoterIds != null and promoterIds.size() > 0'>
|
|
@@ -1224,17 +1212,17 @@
|
|
|
<select id="getMonthOrderAmountTotalByItems" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
SELECT
|
|
|
t1.orderAmount,
|
|
|
- t1.totalRegimentalSettleAmount,
|
|
|
+ t1.regimentalPromotionAmount,
|
|
|
t1.orderCount,
|
|
|
CONCAT(IFNULL(ROUND(t2.orderAmount/t1.orderAmount*100,2),0),'%') as 'orderAmountRate',
|
|
|
CONCAT(IFNULL(ROUND(t2.orderCount/t1.orderCount*100,2),0),'%') as 'orderCountRate',
|
|
|
- CONCAT(IFNULL(ROUND(t2.totalRegimentalSettleAmount/t1.totalRegimentalSettleAmount*100,2),0),'%') as
|
|
|
- 'totalRegimentalSettleAmountRate'
|
|
|
+ CONCAT(IFNULL(ROUND(t2.regimentalPromotionAmount/t1.regimentalPromotionAmount*100,2),0),'%') as
|
|
|
+ 'regimentalPromotionAmountRate'
|
|
|
FROM
|
|
|
(
|
|
|
SELECT
|
|
|
IFNULL(SUM(order_amount),0) AS 'orderAmount',
|
|
|
- IFNULL(SUM(regimental_promotion_amount),0) AS 'totalRegimentalSettleAmount',
|
|
|
+ IFNULL(SUM(regimental_promotion_amount),0) AS 'regimentalPromotionAmount',
|
|
|
COUNT(oid) as 'orderCount'
|
|
|
FROM kuaishou_supply_chain t1
|
|
|
WHERE order_status != 80
|
|
@@ -1252,7 +1240,7 @@
|
|
|
(
|
|
|
SELECT
|
|
|
IFNULL(SUM(order_amount),0) AS 'orderAmount',
|
|
|
- IFNULL(SUM(regimental_promotion_amount),0) AS 'totalRegimentalSettleAmount',
|
|
|
+ IFNULL(SUM(regimental_promotion_amount),0) AS 'regimentalPromotionAmount',
|
|
|
COUNT(oid) as 'orderCount'
|
|
|
FROM kuaishou_supply_chain t1
|
|
|
WHERE order_status != 80
|