|
|
|
@ -797,19 +797,19 @@
|
|
|
|
|
|
|
|
|
|
<select id="getAreaMerchantAmountAnalysis" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
SELECT c.client_moniker,c.short_name,c.bd_user_name,sum(if(t.transaction_type='Credit',t.clearing_amount,0)) total,
|
|
|
|
|
sum(if(t.transaction_type='Credit',1,0)) orders,
|
|
|
|
|
c.suburb,c.state,c.royalpayindustry,sum(if(t.channel='Alipay'AND t.transaction_type='Credit',t.clearing_amount,0)) alipay_total,
|
|
|
|
|
sum(if(t.channel='Alipay'AND t.transaction_type='Credit',1,0)) alipay_order,sum(if(t.channel='Wechat'AND t.transaction_type='Credit',t.clearing_amount,0)) wechat_toatl,
|
|
|
|
|
sum(if(t.channel='Wechat'AND t.transaction_type='Credit',1,0)) wechat_order
|
|
|
|
|
COUNT(DISTINCT t.order_id) orders,
|
|
|
|
|
c.suburb,c.state,c.royalpayindustry,sum(if(t.channel='Alipay',t.clearing_amount,0)) alipay_total,
|
|
|
|
|
sum(if(t.channel='Alipay'AND t.channel='AlipayOnline',1,0)) alipay_order,sum(if(t.channel='Wechat',t.clearing_amount,0)) wechat_toatl,
|
|
|
|
|
sum(if(t.channel='Wechat',1,0)) wechat_order
|
|
|
|
|
FROM pmt_transactions t
|
|
|
|
|
INNER JOIN pmt_orders ord on ord.order_id = t.order_id
|
|
|
|
|
RIGHT JOIN sys_clients c on t.client_id = c.client_id and c.is_valid = 1
|
|
|
|
|
<if test="bd_user!=null">
|
|
|
|
|
INNER JOIN sys_client_bd d ON c.client_id = d.client_id AND d.bd_id = #{bd_user} and
|
|
|
|
|
date(d.start_date)<= date(now()) and (d.end_date is null or date(d.end_date)>= date(now())) and
|
|
|
|
|
date(d.start_date)<= #{begin} and (d.end_date is null or date(d.end_date)>= #{end}) and
|
|
|
|
|
d.is_valid=1
|
|
|
|
|
</if>
|
|
|
|
|
where (t.transaction_type = 'Credit' or t.refund_id is not null)
|
|
|
|
|
where (t.transaction_type = 'Credit')
|
|
|
|
|
<if test="begin!=null">and t.transaction_time >= #{begin}</if>
|
|
|
|
|
<if test="end!=null">and t.transaction_time <= #{end}</if>
|
|
|
|
|
<if test="state!=null">and c.state <= #{state}</if>
|
|
|
|
|