|
@@ -554,8 +554,8 @@
|
|
|
author_short_id as 'promoterId',
|
|
|
author_account as 'promoterNickName',
|
|
|
count(order_id) as 'orderNum',
|
|
|
- sum(case when flow_point != 'REFUND' then 1 else 0 end) as 'validOrderNUm',
|
|
|
- round(sum(case when flow_point != 'REFUND' then 1 else 0 end) / count(order_id),4) as 'validRadio'
|
|
|
+ sum(case when flow_point != 'REFUND' then 1 else 0 end) as 'validOrderNUm',
|
|
|
+ round(sum(case when flow_point != 'REFUND' then 1 else 0 end) / count(order_id),4) as 'validRadio'
|
|
|
from bytedance_order_list
|
|
|
where 1= 1
|
|
|
<if test='promoterIds != null and promoterIds.size() > 0'>
|
|
@@ -2222,4 +2222,77 @@
|
|
|
where t.orderNum > 0
|
|
|
order by ${fieId} ${sort}
|
|
|
</select>
|
|
|
+ <select id="bdReportListV2ByBind" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
+ select t.*,
|
|
|
+ tt.promoterCount,
|
|
|
+ ttt.sampleCount,
|
|
|
+ tttt.sendTotalCount,
|
|
|
+ tttt.sendPromoterCount,
|
|
|
+ tttt.sendItemCount,
|
|
|
+ IFNULL(ttttt.promoters_count, '-') as 'promotersCount'
|
|
|
+ from (select t1.user_id as 'collectSampleId',
|
|
|
+ t1.user_name as 'collectSampleName',
|
|
|
+ sum(t2.order_num) as 'orderNum',
|
|
|
+ sum(t2.valid_order_num) as 'validOrderNum',
|
|
|
+ concat(round(sum(t2.valid_order_num) / sum(t2.order_num) * 100, 2), '%') as 'validOrderRate',
|
|
|
+ round(sum(t2.order_amount) / 100, 2) as 'orderAmount',
|
|
|
+ round(sum(t2.regimental_promotion_amount) / 100, 2) as 'regimentalPromotionAmount',
|
|
|
+ round(sum(t2.total_regimental_settle_amount) / 100, 2) as 'totalRegimentalSettleAmount'
|
|
|
+ from kuaishou_promoter t1
|
|
|
+ left join(select *
|
|
|
+ from canal_management
|
|
|
+ where stat_date >= #{bindStartDate}) t2
|
|
|
+ on t1.promoter_id = t2.promoter_id
|
|
|
+ where 1 = 1
|
|
|
+ <if test="bindStartDate != null and bindStartDate != '' ">
|
|
|
+ and t1.create_time >= str_to_date(concat(date_format(#{bindStartDate}, '%Y-%m-%d'), '00:00:01'),
|
|
|
+ '%Y-%m-%d %H:%i:%s')
|
|
|
+ </if>
|
|
|
+ <if test="bindEndDate != null and bindEndDate != '' ">
|
|
|
+ and t1.create_time <= str_to_date(concat(date_format(#{bindEndDate}, '%Y-%m-%d'), '23:59:59'), '%Y-%m-%d
|
|
|
+ %H:%i:%s')
|
|
|
+ </if>
|
|
|
+ <if test="collectSampleId != null and collectSampleId != '' ">
|
|
|
+ and t1.user_id = #{collectSampleId}
|
|
|
+ </if>
|
|
|
+ group by t1.user_id) t
|
|
|
+ left join (select user_id,
|
|
|
+ count(distinct promoter_id) as 'promoterCount'
|
|
|
+ from kuaishou_promoter
|
|
|
+ where 1 = 1
|
|
|
+ <if test="collectSampleId != null and collectSampleId != '' ">
|
|
|
+ and user_id = #{collectSampleId}
|
|
|
+ </if>
|
|
|
+ group by user_id) tt on t.collectSampleId = tt.user_id
|
|
|
+ left join (select collect_sample_id as 'user_id',
|
|
|
+ count(distinct promoter_id) as 'sampleCount'
|
|
|
+ from kuaishou_item_collect_samples
|
|
|
+ where collect_sample_status > 2
|
|
|
+ <if test="collectSampleId != null and collectSampleId != '' ">
|
|
|
+ and collect_sample_id = #{collectSampleId}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ group by collect_sample_id) ttt on t.collectSampleId = ttt.user_id
|
|
|
+ left join (select collect_sample_id as 'user_id',
|
|
|
+ count(1) as 'sendTotalCount',
|
|
|
+ count(distinct promoter_id) as 'sendPromoterCount',
|
|
|
+ count(distinct item_id) as 'sendItemCount'
|
|
|
+ from kuaishou_item_collect_samples
|
|
|
+ where collect_sample_status > 2
|
|
|
+ <if test="collectSampleId != null and collectSampleId != '' ">
|
|
|
+ and collect_sample_id = #{collectSampleId}
|
|
|
+ </if>
|
|
|
+ group by collect_sample_id) tttt on t.collectSampleId = tttt.user_id
|
|
|
+ left join (select user_id, promoters_count
|
|
|
+ from user_promoters_count
|
|
|
+ where media_id = 2
|
|
|
+ <if test="collectSampleId != null and collectSampleId != '' ">
|
|
|
+ and user_id = #{collectSampleId}
|
|
|
+ </if>
|
|
|
+ ) ttttt
|
|
|
+ on t.collectSampleId = ttttt.user_id
|
|
|
+ order by t.orderNum desc
|
|
|
+
|
|
|
+
|
|
|
+ </select>
|
|
|
</mapper>
|