|
|
|
@ -146,58 +146,58 @@
|
|
|
|
|
<include refid="tradelog_list_keys"/>
|
|
|
|
|
</if>
|
|
|
|
|
FROM (
|
|
|
|
|
select oo.order_id,oo.client_id,oo.total_amount,oo.display_amount,
|
|
|
|
|
oo.customer_payment_amount,oo.coupon_payment_amount,oo.currency,
|
|
|
|
|
oo.create_time,oo.confirm_time,oo.status,oo.order_description,oo.order_detail,
|
|
|
|
|
oo.client_order_id,oo.gateway,oo.channel,oo.pre_authorization,oo.refund_amount,oo.customer_id
|
|
|
|
|
from pmt_orders oo
|
|
|
|
|
<where>
|
|
|
|
|
<if test="search_text != null">
|
|
|
|
|
<bind name="name_pattern" value="'%' + search_text + '%'"/>
|
|
|
|
|
<if test="text_type == 'remark'">
|
|
|
|
|
AND oo.order_detail LIKE #{name_pattern}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="text_type == 'channel'">
|
|
|
|
|
AND oo.channel = #{search_text}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="text_type == 'order_id'">
|
|
|
|
|
AND oo.order_id = #{search_text}
|
|
|
|
|
</if>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="order_id != null">
|
|
|
|
|
AND oo.order_id = #{order_id}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="trade_type != null">
|
|
|
|
|
AND oo.gateway IN
|
|
|
|
|
<foreach collection="trade_type" item="gateway" open="(" close=")" separator=",">
|
|
|
|
|
#{gateway}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="from != null">
|
|
|
|
|
AND oo.create_time >= #{from}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="to != null">
|
|
|
|
|
AND oo.create_time < #{to}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="date != null">
|
|
|
|
|
AND oo.transaction_date = DATE(#{date})
|
|
|
|
|
</if>
|
|
|
|
|
<if test="dev_id != null">
|
|
|
|
|
AND oo.dev_id = #{dev_id}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="status != null">
|
|
|
|
|
AND
|
|
|
|
|
<foreach collection="status" item="std" open="(" close=")" separator=" or ">
|
|
|
|
|
oo.status = #{std}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="channel != null">
|
|
|
|
|
AND
|
|
|
|
|
<foreach collection="channel" item="chan" open="(" close=")" separator=" or ">
|
|
|
|
|
oo.channel = #{chan}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
select oo.order_id,oo.client_id,oo.total_amount,oo.display_amount,
|
|
|
|
|
oo.customer_payment_amount,oo.coupon_payment_amount,oo.currency,
|
|
|
|
|
oo.create_time,oo.confirm_time,oo.status,oo.order_description,oo.order_detail,
|
|
|
|
|
oo.client_order_id,oo.gateway,oo.channel,oo.pre_authorization,oo.refund_amount,oo.customer_id
|
|
|
|
|
from pmt_orders oo
|
|
|
|
|
<where>
|
|
|
|
|
<if test="search_text != null">
|
|
|
|
|
<bind name="name_pattern" value="'%' + search_text + '%'"/>
|
|
|
|
|
<if test="text_type == 'remark'">
|
|
|
|
|
AND oo.order_detail LIKE #{name_pattern}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="text_type == 'channel'">
|
|
|
|
|
AND oo.channel = #{search_text}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="text_type == 'order_id'">
|
|
|
|
|
AND oo.order_id = #{search_text}
|
|
|
|
|
</if>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="order_id != null">
|
|
|
|
|
AND oo.order_id = #{order_id}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="trade_type != null">
|
|
|
|
|
AND oo.gateway IN
|
|
|
|
|
<foreach collection="trade_type" item="gateway" open="(" close=")" separator=",">
|
|
|
|
|
#{gateway}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="from != null">
|
|
|
|
|
AND oo.create_time >= #{from}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="to != null">
|
|
|
|
|
AND oo.create_time < #{to}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="date != null">
|
|
|
|
|
AND oo.transaction_date = DATE(#{date})
|
|
|
|
|
</if>
|
|
|
|
|
<if test="dev_id != null">
|
|
|
|
|
AND oo.dev_id = #{dev_id}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="status != null">
|
|
|
|
|
AND
|
|
|
|
|
<foreach collection="status" item="std" open="(" close=")" separator=" or ">
|
|
|
|
|
oo.status = #{std}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="channel != null">
|
|
|
|
|
AND
|
|
|
|
|
<foreach collection="channel" item="chan" open="(" close=")" separator=" or ">
|
|
|
|
|
oo.channel = #{chan}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
) o
|
|
|
|
|
INNER JOIN sys_clients p
|
|
|
|
|
ON p.client_id = o.client_id
|
|
|
|
@ -220,12 +220,12 @@
|
|
|
|
|
<bind name="name_pattern" value="'%' + search_text + '%'"/>
|
|
|
|
|
<if test="text_type == 'all'">
|
|
|
|
|
AND (
|
|
|
|
|
p.client_moniker = #{search_text}
|
|
|
|
|
OR p.short_name LIKE #{name_pattern}
|
|
|
|
|
OR o.order_detail LIKE #{name_pattern}
|
|
|
|
|
OR t.system_transaction_id = #{search_text}
|
|
|
|
|
OR o.channel = #{search_text}
|
|
|
|
|
OR o.order_id = #{search_text}
|
|
|
|
|
p.client_moniker = #{search_text}
|
|
|
|
|
OR p.short_name LIKE #{name_pattern}
|
|
|
|
|
OR o.order_detail LIKE #{name_pattern}
|
|
|
|
|
OR t.system_transaction_id = #{search_text}
|
|
|
|
|
OR o.channel = #{search_text}
|
|
|
|
|
OR o.order_id = #{search_text}
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
<if test="text_type == 'client_moniker'">
|
|
|
|
@ -250,26 +250,26 @@
|
|
|
|
|
|
|
|
|
|
<if test="bd_group != null">
|
|
|
|
|
AND p.client_id IN(
|
|
|
|
|
SELECT distinct b.client_id
|
|
|
|
|
FROM sys_client_bd b
|
|
|
|
|
INNER JOIN financial_bd_config c
|
|
|
|
|
ON c.manager_id = b.bd_id
|
|
|
|
|
WHERE b.is_valid = 1
|
|
|
|
|
AND b.start_date <= now()
|
|
|
|
|
AND (b.end_date is null or b.end_date >= now())
|
|
|
|
|
AND (c.bd_group = #{bd_group} or c.manager_id = #{bd_group})
|
|
|
|
|
<if test="bd_group_bd">
|
|
|
|
|
AND c.manager_id = #{bd_group_bd}
|
|
|
|
|
</if>
|
|
|
|
|
SELECT distinct b.client_id
|
|
|
|
|
FROM sys_client_bd b
|
|
|
|
|
INNER JOIN financial_bd_config c
|
|
|
|
|
ON c.manager_id = b.bd_id
|
|
|
|
|
WHERE b.is_valid = 1
|
|
|
|
|
AND b.start_date <= now()
|
|
|
|
|
AND (b.end_date is null or b.end_date >= now())
|
|
|
|
|
AND (c.bd_group = #{bd_group} or c.manager_id = #{bd_group})
|
|
|
|
|
<if test="bd_group_bd">
|
|
|
|
|
AND c.manager_id = #{bd_group_bd}
|
|
|
|
|
</if>
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
<if test="bd_user != null">
|
|
|
|
|
AND p.client_id in(select distinct d.client_id
|
|
|
|
|
from sys_client_bd d
|
|
|
|
|
where d.bd_id = #{bd_user}
|
|
|
|
|
AND d.is_valid = 1
|
|
|
|
|
AND DATE(d.start_date) <= curdate()
|
|
|
|
|
AND (d.end_date IS NULL OR DATE(d.end_date) >= curdate()))
|
|
|
|
|
AND d.is_valid = 1
|
|
|
|
|
AND DATE(d.start_date) <= curdate()
|
|
|
|
|
AND (d.end_date IS NULL OR DATE(d.end_date) >= curdate()))
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
GROUP BY o.order_id
|
|
|
|
@ -393,6 +393,7 @@
|
|
|
|
|
ifnull(sum(if(l.refund_id is not null AND l.pre_authorization=1,l.clearing_amount,0)),0)
|
|
|
|
|
pre_refund_fee,
|
|
|
|
|
count(DISTINCT l.customer_id) customers,
|
|
|
|
|
count(DISTINCT l.client_id) clients,
|
|
|
|
|
ifnull(sum(if(l.transaction_type='Credit' and l.refund_id is null and l.currency!='CNY',l.display_amount,0)),0)
|
|
|
|
|
display_amount,
|
|
|
|
|
ifnull(sum(if(l.transaction_type='Credit' and l.refund_id is null and l.currency!='CNY' and
|
|
|
|
|