| 
					
				 | 
			
			
				@@ -456,8 +456,17 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         'validRadio', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         sum(case when t2.flow_point = 'REFUND' then 1 else 0 end) AS 'invalidOrderNUm', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         sum(case when t2.flow_point != 'REFUND' then t2.total_pay_amount else 0 end)/100 AS 'payAmount', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        sum(case when t2.flow_point != 'REFUND' then t2.colonel_estimated_commission 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        else 0 end) *0.9 /100 AS 'regimentalPromotionAmount', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        sum(CASE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        WHEN t2.flow_point != 'REFUND' and t2.colonel_type != 2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        THEN t2.colonel_estimated_commission 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        WHEN t2.flow_point != 'REFUND' and t2.colonel_type = 2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        then t2.second_estimated_commission 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ELSE 0 END) * 0.9 / 100 AS 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        'regimentalPromotionAmount', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        sum(CASE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        WHEN t2.flow_point != 'REFUND' and t2.colonel_type != 2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        THEN t2.second_estimated_commission 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ELSE 0 END) / 100 AS 'secondEstimatedCommission', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         sum(case when t2.flow_point != 'REFUND' then t2.colonel_real_commission else 0 end)/100 as 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         'totalRegimentalSettleAmount' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         FROM bytedance_promoter_order_list t2 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -495,23 +504,36 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         'validRadio', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         sum(case when t2.flow_point = 'REFUND' then 1 else 0 end) AS 'invalidOrderNUm', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         sum(case when t2.flow_point != 'REFUND' then t2.total_pay_amount else 0 end)/100 AS 'payAmount', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        sum(case when t2.flow_point != 'REFUND' then t2.colonel_estimated_commission 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        else 0 end) * 0.9 /100 AS 'regimentalPromotionAmount', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        sum(case when t2.flow_point != 'REFUND' then t2.colonel_real_commission else 0 end)/100 as 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        sum(CASE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        WHEN t2.flow_point != 'REFUND' and t2.colonel_type != 2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        THEN t2.colonel_estimated_commission 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        WHEN t2.flow_point != 'REFUND' and t2.colonel_type = 2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        then t2.second_estimated_commission 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ELSE 0 END) * 0.9 / 100 AS 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        'regimentalPromotionAmount', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        sum(CASE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        WHEN t2.flow_point != 'REFUND' and t2.colonel_type != 2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        THEN t2.second_estimated_commission 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ELSE 0 END) / 100 AS 'secondEstimatedCommission', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        sum(case when t2.flow_point != 'REFUND' then t2.colonel_real_commission else 0 end) / 100 as 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         'totalRegimentalSettleAmount' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        FROM kuaishou_item_list t1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        FROM (select * from kuaishou_item_list where create_time >= CONCAT(date_format(#{start},'%Y-%m-%d'),' 00:00:00') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        and create_time <= CONCAT(date_format(#{start},'%Y-%m-%d'),' 23:59:59') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        and media_id = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ) t1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         LEFT JOIN (SELECT product_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         order_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         flow_point, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         total_pay_amount, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         colonel_estimated_commission, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        colonel_real_commission 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        colonel_real_commission, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        colonel_type, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        second_estimated_commission 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         FROM bytedance_promoter_order_list 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         WHERE pay_success_time >= #{start} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ) t2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         on t1.item_id = t2.product_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        WHERE t1.create_time >= CONCAT(#{start},' 00:00:00') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        and t1.create_time <= CONCAT(#{end},' 23:59:59') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <if test="userId != null and userId != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             and t1.userId = #{userId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </if> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -519,9 +541,9 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         SELECT t1.user_id,count(distinct courier_number) AS 'sendSampleCount' FROM kuaishou_item_list t1 LEFT JOIN 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         kuaishou_item_collect_samples t2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         on t1.item_id = t2.item_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        WHERE t1.create_time >= CONCAT(#{start},' 00:00:00') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        and t1.create_time <= CONCAT(#{end},' 23:59:59') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        and t2.courier_number_time >= CONCAT(#{start},' 00:00:00') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        WHERE t1.create_time >=CONCAT(date_format(#{start},'%Y-%m-%d'),' 00:00:00') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        and t1.create_time <= CONCAT(date_format(#{start},'%Y-%m-%d'),' 23:59:59') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        and t2.courier_number_time >= CONCAT(date_format(#{start},'%Y-%m-%d'),' 00:00:00') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         GROUP BY t1.user_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ) t2 on t.userId = t2.user_id ORDER BY t.orderNum desc 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </select> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -802,8 +824,17 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         concat(round(sum(case when t2.flow_point != 'REFUND' then 1 else 0 end) / count(t2.order_id) * 100, 2), '%') as 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         'validOrderRate', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         round(sum(t2.total_pay_amount) / 100, 2) as 'orderAmount', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        round( sum( CASE WHEN t2.flow_point != 'REFUND' THEN t2.colonel_estimated_commission ELSE 0 END ) * 0.9 / 100, 2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        ) as 'regimentalPromotionAmount', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        sum(CASE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        WHEN t2.flow_point != 'REFUND' and t2.colonel_type != 2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        THEN t2.colonel_estimated_commission 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        WHEN t2.flow_point != 'REFUND' and t2.colonel_type = 2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        then t2.second_estimated_commission 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ELSE 0 END) * 0.9 / 100 AS 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        'regimentalPromotionAmount', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        sum(CASE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        WHEN t2.flow_point != 'REFUND' and t2.colonel_type != 2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        THEN t2.second_estimated_commission 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ELSE 0 END) / 100 AS 'secondEstimatedCommission', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         round(sum(t2.colonel_real_commission) / 100, 2) as 'totalRegimentalSettleAmount' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         from promoter_bind_channel_date t1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         left join bytedance_promoter_order_list t2 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -867,8 +898,17 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         concat(round(sum(case when t2.flow_point != 'REFUND' then 1 else 0 end) / count(t2.order_id) * 100, 2), '%') as 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         'validOrderRate', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         round(sum(t2.total_pay_amount) / 100, 2) as 'orderAmount', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        round( sum( CASE WHEN t2.flow_point != 'REFUND' THEN t2.colonel_estimated_commission ELSE 0 END ) * 0.9 / 100, 2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        ) as 'regimentalPromotionAmount', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        sum(CASE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        WHEN t2.flow_point != 'REFUND' and t2.colonel_type != 2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        THEN t2.colonel_estimated_commission 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        WHEN t2.flow_point != 'REFUND' and t2.colonel_type = 2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        then t2.second_estimated_commission 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ELSE 0 END) * 0.9 / 100 AS 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        'regimentalPromotionAmount', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        sum(CASE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        WHEN t2.flow_point != 'REFUND' and t2.colonel_type != 2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        THEN t2.second_estimated_commission 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ELSE 0 END) / 100 AS 'secondEstimatedCommission', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         round(sum(t2.colonel_real_commission) / 100, 2) as 'totalRegimentalSettleAmount' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         from kuaishou_promoter t1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         left join(select * 
			 |