|
@@ -516,7 +516,8 @@
|
|
|
then 1 else 0 end) * 100,2) as 'deliveryRadio',
|
|
|
round(sum(pay_amount) / 100,2) as 'payAmount',
|
|
|
round(sum(case when order_status != 80 then pay_amount else 0 end) / 100 , 2 ) as 'validPayAmount',
|
|
|
- round(sum(case when order_status != 80 then regimental_promotion_amount else 0 end) / 100, 2) as 'regimentalPromotionAmount'
|
|
|
+ round(sum(case when order_status != 80 then regimental_promotion_amount else 0 end) / 100, 2) as
|
|
|
+ 'regimentalPromotionAmount'
|
|
|
from kuaishou_supply_chain
|
|
|
where 1= 1
|
|
|
<if test="start != null and start != ''">
|
|
@@ -711,7 +712,13 @@
|
|
|
<if test="end != null and end != ''">
|
|
|
and t2.order_create_time <= #{end}
|
|
|
</if>
|
|
|
- group by t1.user_id) t
|
|
|
+ group by t1.user_id) t left join (
|
|
|
+ select item_create_id,count(1) as 'sendSampleCount' from kuaishou_item_collect_samples
|
|
|
+ where courier_number_time >= from_unixtime(#{start}/1000,'%Y-%m-%d %H:%i:%s')
|
|
|
+ and courier_number_time <= from_unixtime(#{end}/1000,'%Y-%m-%d %H:%i:%s')
|
|
|
+ group by item_create_id
|
|
|
+
|
|
|
+ ) t1 on t.userId = t1.item_create_id
|
|
|
where 1 =1
|
|
|
<if test="userId != null and userId != ''">
|
|
|
and t.userId = #{userId}
|
|
@@ -1596,4 +1603,49 @@
|
|
|
order by t1.orderNum desc
|
|
|
|
|
|
</select>
|
|
|
+ <select id="exportAdminReportList" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
+ select *
|
|
|
+ from (select t1.user_id as 'userId',
|
|
|
+ t1.user_name as 'userName',
|
|
|
+ count(distinct t2.item_id) as 'itemCount',
|
|
|
+ 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 = 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
|
|
|
+ then 1
|
|
|
+ else 0 end),
|
|
|
+ 4) as 'deliveryRadio',
|
|
|
+ sum(case when t2.order_status = 80 then 1 else 0 end) as 'invalidOrderNUm',
|
|
|
+ round(sum(case when t2.order_status != 80 then t2.pay_amount else 0 end) / 100 , 2) as 'payAmount',
|
|
|
+ round(sum(case
|
|
|
+ when t2.order_status != 80 then t2.regimental_promotion_amount
|
|
|
+ else 0 end) / 100, 2 )as 'regimentalPromotionAmount',
|
|
|
+ round(sum(case when t2.order_status != 80 then t2.total_regimental_settle_amount else 0 end) / 100 , 2) as
|
|
|
+ 'totalRegimentalSettleAmount'
|
|
|
+ from kuaishou_item_bind_user t1
|
|
|
+ left join kuaishou_supply_chain t2
|
|
|
+ on t1.item_id = t2.item_id
|
|
|
+ where 1= 1
|
|
|
+ <if test="start != null and start != ''">
|
|
|
+ and t2.order_create_time >= #{start}
|
|
|
+ </if>
|
|
|
+ <if test="end != null and end != ''">
|
|
|
+ and t2.order_create_time <= #{end}
|
|
|
+ </if>
|
|
|
+ group by t1.user_id) t left join (
|
|
|
+ select item_create_id,count(1) as 'sendSampleCount' from kuaishou_item_collect_samples
|
|
|
+ where courier_number_time >= from_unixtime(#{start}/1000,'%Y-%m-%d %H:%i:%s')
|
|
|
+ and courier_number_time <= from_unixtime(#{end}/1000,'%Y-%m-%d %H:%i:%s')
|
|
|
+ group by item_create_id
|
|
|
+
|
|
|
+ ) t1 on t.userId = t1.item_create_id
|
|
|
+ where 1 =1
|
|
|
+ <if test="userId != null and userId != ''">
|
|
|
+ and t.userId = #{userId}
|
|
|
+ </if>
|
|
|
+ order by t.orderNum desc
|
|
|
+ </select>
|
|
|
</mapper>
|