|
|
@ -31,20 +31,22 @@
|
|
|
|
<if test="trans_type==2">and t.refund_id is NOT NULL</if>
|
|
|
|
<if test="trans_type==2">and t.refund_id is NOT NULL</if>
|
|
|
|
<if test="trans_type==3">and t.transaction_type='Debit' and t.refund_id is NULL</if>
|
|
|
|
<if test="trans_type==3">and t.transaction_type='Debit' and t.refund_id is NULL</if>
|
|
|
|
<if test="channel!=null">
|
|
|
|
<if test="channel!=null">
|
|
|
|
and <foreach collection="channel" item="chan" open="(" close=")" separator=" or ">o.channel=#{chan}</foreach>
|
|
|
|
and
|
|
|
|
|
|
|
|
<foreach collection="channel" item="chan" open="(" close=")" separator=" or ">o.channel=#{chan}
|
|
|
|
|
|
|
|
</foreach>
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
</where>
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="listTransFlow" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="listTransFlow" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
SELECT t.*,
|
|
|
|
SELECT t.*,
|
|
|
|
ifnull(o.client_order_id,'--') client_order_id,
|
|
|
|
ifnull(o.client_order_id,'--') client_order_id,
|
|
|
|
if(t.channel='Settlement','clearing',
|
|
|
|
if(t.channel='Settlement','clearing',
|
|
|
|
if(t.transaction_type='Credit','payment','refund')) trans_type,
|
|
|
|
if(t.transaction_type='Credit','payment','refund')) trans_type,
|
|
|
|
t.system_transaction_id,
|
|
|
|
t.system_transaction_id,
|
|
|
|
if(t.channel='Settlement',
|
|
|
|
if(t.channel='Settlement',
|
|
|
|
if(locate('MERCHANT',t.system_transaction_id)>0, 'Transfer to Merchant','Merchant Service Fee'),
|
|
|
|
if(locate('MERCHANT',t.system_transaction_id)>0, 'Transfer to Merchant','Merchant Service Fee'),
|
|
|
|
if(t.system_generate=0,t.order_id,t.remark)) order_id2,
|
|
|
|
if(t.system_generate=0,t.order_id,t.remark)) order_id2,
|
|
|
|
if(t.channel='Settlement','-',CASE t.clearing_status
|
|
|
|
if(t.channel='Settlement','-',CASE t.clearing_status
|
|
|
|
WHEN 0 THEN 'ReadyToClear'
|
|
|
|
WHEN 0 THEN 'ReadyToClear'
|
|
|
|
WHEN 1 THEN 'Cleared'
|
|
|
|
WHEN 1 THEN 'Cleared'
|
|
|
@ -72,7 +74,9 @@
|
|
|
|
<if test="trans_type==2">and t.refund_id is NOT NULL</if>
|
|
|
|
<if test="trans_type==2">and t.refund_id is NOT NULL</if>
|
|
|
|
<if test="trans_type==3">and t.transaction_type='Debit' and t.refund_id is NULL</if>
|
|
|
|
<if test="trans_type==3">and t.transaction_type='Debit' and t.refund_id is NULL</if>
|
|
|
|
<if test="channel!=null">
|
|
|
|
<if test="channel!=null">
|
|
|
|
and <foreach collection="channel" item="chan" open="(" close=")" separator=" or ">o.channel=#{chan}</foreach>
|
|
|
|
and
|
|
|
|
|
|
|
|
<foreach collection="channel" item="chan" open="(" close=")" separator=" or ">o.channel=#{chan}
|
|
|
|
|
|
|
|
</foreach>
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
</where>
|
|
|
|
</where>
|
|
|
|
order by t.transaction_time desc
|
|
|
|
order by t.transaction_time desc
|
|
|
@ -95,14 +99,22 @@
|
|
|
|
sum(if(t.transaction_type='Debit' AND t.refund_id is NOT NULL and o.pre_authorization=1,t.clearing_amount,0))
|
|
|
|
sum(if(t.transaction_type='Debit' AND t.refund_id is NOT NULL and o.pre_authorization=1,t.clearing_amount,0))
|
|
|
|
pre_refund_fee,
|
|
|
|
pre_refund_fee,
|
|
|
|
|
|
|
|
|
|
|
|
ifnull(sum(if(t.transaction_type = 'Credit' and t.channel != 'Settlement',t.settle_amount,if(t.channel != 'Settlement',-t.settle_amount,0))),0) total_settle_amount,
|
|
|
|
ifnull(sum(if(t.transaction_type = 'Credit' and t.channel != 'Settlement',t.settle_amount,if(t.channel !=
|
|
|
|
ifnull(sum(if(t.transaction_type = 'Credit' and t.channel != 'Settlement',t.royal_surcharge,if(t.channel != 'Settlement',-t.royal_surcharge,0))),0) total_royal_surcharge,
|
|
|
|
'Settlement',-t.settle_amount,0))),0) total_settle_amount,
|
|
|
|
ifnull(sum(if(t.transaction_type = 'Credit' and t.channel != 'Settlement',t.total_surcharge,if(t.channel != 'Settlement',-t.total_surcharge,0))),0) total_surcharge,
|
|
|
|
ifnull(sum(if(t.transaction_type = 'Credit' and t.channel != 'Settlement',t.royal_surcharge,if(t.channel !=
|
|
|
|
ifnull(sum(if(t.transaction_type = 'Credit' and t.channel = 'Wechat',t.channel_surcharge,if(t.channel = 'Wechat',-t.channel_surcharge,0))),0) wechat_fee,
|
|
|
|
'Settlement',-t.royal_surcharge,0))),0) total_royal_surcharge,
|
|
|
|
ifnull(sum(if(t.transaction_type = 'Credit' and t.channel = 'Alipay',t.channel_surcharge,if(t.channel = 'Alipay',-t.channel_surcharge,0))),0) alipay_fee,
|
|
|
|
ifnull(sum(if(t.transaction_type = 'Credit' and t.channel != 'Settlement',t.total_surcharge,if(t.channel !=
|
|
|
|
ifnull(sum(if(t.transaction_type = 'Credit' and t.channel = 'jd',t.channel_surcharge,if(t.channel = 'jd',-t.channel_surcharge,0))),0) jd_fee,
|
|
|
|
'Settlement',-t.total_surcharge,0))),0) total_surcharge,
|
|
|
|
ifnull(sum(if(t.transaction_type = 'Credit' and t.channel = 'Bestpay',t.channel_surcharge,if(t.channel = 'Bestpay',-t.channel_surcharge,0))),0) bestpay_fee,
|
|
|
|
ifnull(sum(if(t.transaction_type = 'Credit' and t.channel = 'Wechat',t.channel_surcharge,if(t.channel =
|
|
|
|
ifnull(sum(if(t.transaction_type = 'Credit' and t.channel = 'AlipayOnline',t.channel_surcharge,if(t.channel = 'AlipayOnline',-t.channel_surcharge,0))),0) alipay_online_fee
|
|
|
|
'Wechat',-t.channel_surcharge,0))),0) wechat_fee,
|
|
|
|
|
|
|
|
ifnull(sum(if(t.transaction_type = 'Credit' and t.channel = 'Alipay',t.channel_surcharge,if(t.channel =
|
|
|
|
|
|
|
|
'Alipay',-t.channel_surcharge,0))),0) alipay_fee,
|
|
|
|
|
|
|
|
ifnull(sum(if(t.transaction_type = 'Credit' and t.channel = 'jd',t.channel_surcharge,if(t.channel =
|
|
|
|
|
|
|
|
'jd',-t.channel_surcharge,0))),0) jd_fee,
|
|
|
|
|
|
|
|
ifnull(sum(if(t.transaction_type = 'Credit' and t.channel = 'Bestpay',t.channel_surcharge,if(t.channel =
|
|
|
|
|
|
|
|
'Bestpay',-t.channel_surcharge,0))),0) bestpay_fee,
|
|
|
|
|
|
|
|
ifnull(sum(if(t.transaction_type = 'Credit' and t.channel = 'AlipayOnline',t.channel_surcharge,if(t.channel =
|
|
|
|
|
|
|
|
'AlipayOnline',-t.channel_surcharge,0))),0) alipay_online_fee
|
|
|
|
FROM pmt_transactions t
|
|
|
|
FROM pmt_transactions t
|
|
|
|
left JOIN pmt_orders o on o.order_id=t.order_id
|
|
|
|
left JOIN pmt_orders o on o.order_id=t.order_id
|
|
|
|
<where>
|
|
|
|
<where>
|
|
|
@ -124,7 +136,9 @@
|
|
|
|
<if test="trans_type==2">and t.refund_id is NOT NULL</if>
|
|
|
|
<if test="trans_type==2">and t.refund_id is NOT NULL</if>
|
|
|
|
<if test="trans_type==3">and t.transaction_type='Debit' and t.refund_id is NULL</if>
|
|
|
|
<if test="trans_type==3">and t.transaction_type='Debit' and t.refund_id is NULL</if>
|
|
|
|
<if test="channel!=null">
|
|
|
|
<if test="channel!=null">
|
|
|
|
and <foreach collection="channel" item="chan" open="(" close=")" separator=" or ">o.channel=#{chan}</foreach>
|
|
|
|
and
|
|
|
|
|
|
|
|
<foreach collection="channel" item="chan" open="(" close=")" separator=" or ">o.channel=#{chan}
|
|
|
|
|
|
|
|
</foreach>
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
</where>
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
@ -172,12 +186,16 @@
|
|
|
|
<if test="to!=null">and t.transaction_time < #{to}</if>
|
|
|
|
<if test="to!=null">and t.transaction_time < #{to}</if>
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
<select id="listPreRefundClients" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="listPreRefundClients" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
select *
|
|
|
|
SELECT *
|
|
|
|
from (select ifnull(sum(if(transaction_type = 'Credit', clearing_amount, -clearing_amount)), 0) amount, c.client_id client_id,max(t.transaction_time) transation_time,c.client_moniker client_moniker
|
|
|
|
FROM (SELECT
|
|
|
|
from pmt_transactions t INNER join sys_clients c
|
|
|
|
ifnull(sum(if(transaction_type = 'Credit', clearing_amount, -clearing_amount)), 0) amount,
|
|
|
|
on t.client_id = c.client_id and c.enable_refund_auth = 0
|
|
|
|
c.client_id client_id,
|
|
|
|
group by c.client_id) a
|
|
|
|
max(t.transaction_time) transation_time,
|
|
|
|
where a.amount < 0
|
|
|
|
c.client_moniker client_moniker
|
|
|
|
|
|
|
|
FROM pmt_transactions t INNER JOIN sys_clients c
|
|
|
|
|
|
|
|
ON t.client_id = c.client_id AND c.enable_refund_auth = 0
|
|
|
|
|
|
|
|
GROUP BY c.client_id) a
|
|
|
|
|
|
|
|
WHERE a.amount < 0
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
<select id="validAnalysis" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="validAnalysis" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<![CDATA[
|
|
|
|
<![CDATA[
|
|
|
@ -279,7 +297,8 @@
|
|
|
|
<if test="to!=null">and t.transaction_time < #{to}</if>
|
|
|
|
<if test="to!=null">and t.transaction_time < #{to}</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and c.org_id = #{org_id}</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and c.org_id = #{org_id}</if>
|
|
|
|
<if test="org_ids!=null">and c.org_id in
|
|
|
|
<if test="org_ids!=null">and c.org_id in
|
|
|
|
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
|
|
|
|
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
|
|
|
|
|
|
|
|
</if>
|
|
|
|
GROUP BY DATE(t.transaction_time)
|
|
|
|
GROUP BY DATE(t.transaction_time)
|
|
|
|
order by t.clearing_time desc
|
|
|
|
order by t.clearing_time desc
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
@ -298,7 +317,8 @@
|
|
|
|
<if test="client_moniker!=null">and c.client_moniker=#{client_moniker}</if>
|
|
|
|
<if test="client_moniker!=null">and c.client_moniker=#{client_moniker}</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and c.org_id = #{org_id}</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and c.org_id = #{org_id}</if>
|
|
|
|
<if test="org_ids!=null">and c.org_id in
|
|
|
|
<if test="org_ids!=null">and c.org_id in
|
|
|
|
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
|
|
|
|
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
|
|
|
|
|
|
|
|
</if>
|
|
|
|
GROUP BY c.client_id
|
|
|
|
GROUP BY c.client_id
|
|
|
|
order by total desc
|
|
|
|
order by total desc
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
@ -317,7 +337,8 @@
|
|
|
|
<if test="client_moniker!=null">and c.client_moniker=#{client_moniker}</if>
|
|
|
|
<if test="client_moniker!=null">and c.client_moniker=#{client_moniker}</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and c.org_id = #{org_id}</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and c.org_id = #{org_id}</if>
|
|
|
|
<if test="org_ids!=null">and c.org_id in
|
|
|
|
<if test="org_ids!=null">and c.org_id in
|
|
|
|
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
|
|
|
|
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
|
|
|
|
|
|
|
|
</if>
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getAusTracData" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="getAusTracData" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
@ -457,33 +478,33 @@
|
|
|
|
<![CDATA[
|
|
|
|
<![CDATA[
|
|
|
|
SELECT
|
|
|
|
SELECT
|
|
|
|
sum(if(t.transaction_type = 'Credit', t.clearing_amount, -t.clearing_amount)) * b.proportion
|
|
|
|
sum(if(t.transaction_type = 'Credit', t.clearing_amount, -t.clearing_amount)) * b.proportion
|
|
|
|
total,
|
|
|
|
total,
|
|
|
|
t.client_id,
|
|
|
|
t.client_id,
|
|
|
|
m.org_id,
|
|
|
|
m.org_id,
|
|
|
|
c.approve_time client_create_time,
|
|
|
|
c.approve_time client_create_time,
|
|
|
|
c.source client_source,
|
|
|
|
c.source client_source,
|
|
|
|
date(t.transaction_time) trade_date,
|
|
|
|
date(t.transaction_time) trade_date,
|
|
|
|
t.channel channel,
|
|
|
|
t.channel channel,
|
|
|
|
ifnull((SELECT min(r.rate_value)
|
|
|
|
ifnull((SELECT min(r.rate_value)
|
|
|
|
FROM sys_client_rates r
|
|
|
|
FROM sys_client_rates r
|
|
|
|
WHERE r.client_id = t.client_id AND r.active_time <= t.transaction_time AND
|
|
|
|
WHERE r.client_id = t.client_id AND r.active_time <= t.transaction_time AND
|
|
|
|
r.expiry_time >= t.transaction_time AND
|
|
|
|
r.expiry_time >= t.transaction_time AND
|
|
|
|
r.rate_name = 'Wechat'), 1) wechat_rate_value,
|
|
|
|
r.rate_name = 'Wechat'), 1) wechat_rate_value,
|
|
|
|
ifnull((SELECT min(r.rate_value)
|
|
|
|
ifnull((SELECT min(r.rate_value)
|
|
|
|
FROM sys_client_rates r
|
|
|
|
FROM sys_client_rates r
|
|
|
|
WHERE r.client_id = t.client_id AND r.active_time <= t.transaction_time AND
|
|
|
|
WHERE r.client_id = t.client_id AND r.active_time <= t.transaction_time AND
|
|
|
|
r.expiry_time >= t.transaction_time AND
|
|
|
|
r.expiry_time >= t.transaction_time AND
|
|
|
|
r.rate_name = 'Alipay'), 1) alipay_rate_value,
|
|
|
|
r.rate_name = 'Alipay'), 1) alipay_rate_value,
|
|
|
|
ifnull((SELECT min(r.rate_value)
|
|
|
|
ifnull((SELECT min(r.rate_value)
|
|
|
|
FROM sys_client_rates r
|
|
|
|
FROM sys_client_rates r
|
|
|
|
WHERE r.client_id = t.client_id AND r.active_time <= t.transaction_time AND
|
|
|
|
WHERE r.client_id = t.client_id AND r.active_time <= t.transaction_time AND
|
|
|
|
r.expiry_time >= t.transaction_time AND
|
|
|
|
r.expiry_time >= t.transaction_time AND
|
|
|
|
r.rate_name = 'Bestpay'), 1) bestpay_rate_value,
|
|
|
|
r.rate_name = 'Bestpay'), 1) bestpay_rate_value,
|
|
|
|
ifnull((SELECT min(r.rate_value)
|
|
|
|
ifnull((SELECT min(r.rate_value)
|
|
|
|
FROM sys_client_rates r
|
|
|
|
FROM sys_client_rates r
|
|
|
|
WHERE r.client_id = t.client_id AND r.active_time <= t.transaction_time AND
|
|
|
|
WHERE r.client_id = t.client_id AND r.active_time <= t.transaction_time AND
|
|
|
|
r.expiry_time >= t.transaction_time AND
|
|
|
|
r.expiry_time >= t.transaction_time AND
|
|
|
|
r.rate_name = 'jd'), 1) jd_rate_value,
|
|
|
|
r.rate_name = 'jd'), 1) jd_rate_value,
|
|
|
|
ifnull((SELECT min(r.rate_value)
|
|
|
|
ifnull((SELECT min(r.rate_value)
|
|
|
|
FROM sys_client_rates r
|
|
|
|
FROM sys_client_rates r
|
|
|
|
WHERE r.client_id = t.client_id AND r.active_time <= t.transaction_time AND
|
|
|
|
WHERE r.client_id = t.client_id AND r.active_time <= t.transaction_time AND
|
|
|
@ -517,7 +538,7 @@
|
|
|
|
INNER JOIN sys_org so
|
|
|
|
INNER JOIN sys_org so
|
|
|
|
ON c.referrer_id = so.org_id AND so.is_valid = 1 AND so.type = 1 AND so.commission = 1
|
|
|
|
ON c.referrer_id = so.org_id AND so.is_valid = 1 AND so.type = 1 AND so.commission = 1
|
|
|
|
WHERE year(t.transaction_time) = #{year} AND month(t.transaction_time) = #{month} AND t.channel != 'Settlement'
|
|
|
|
WHERE year(t.transaction_time) = #{year} AND month(t.transaction_time) = #{month} AND t.channel != 'Settlement'
|
|
|
|
GROUP BY so.org_id, trade_date,t.client_id
|
|
|
|
GROUP BY so.org_id, trade_date, t.client_id
|
|
|
|
ORDER BY c.org_id ASC, t.client_id ASC, trade_date ASC
|
|
|
|
ORDER BY c.org_id ASC, t.client_id ASC, trade_date ASC
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
@ -525,33 +546,33 @@
|
|
|
|
<![CDATA[
|
|
|
|
<![CDATA[
|
|
|
|
SELECT
|
|
|
|
SELECT
|
|
|
|
sum(if(t.transaction_type = 'Credit', t.clearing_amount, -t.clearing_amount))
|
|
|
|
sum(if(t.transaction_type = 'Credit', t.clearing_amount, -t.clearing_amount))
|
|
|
|
total,
|
|
|
|
total,
|
|
|
|
t.client_id client_id,
|
|
|
|
t.client_id client_id,
|
|
|
|
c.approve_time client_create_time,
|
|
|
|
c.approve_time client_create_time,
|
|
|
|
c.source client_source,
|
|
|
|
c.source client_source,
|
|
|
|
date(t.transaction_time) trade_date,
|
|
|
|
date(t.transaction_time) trade_date,
|
|
|
|
t.channel channel,
|
|
|
|
t.channel channel,
|
|
|
|
ifnull(so.rate_value, 1) rate_value,
|
|
|
|
ifnull(so.rate_value, 1) rate_value,
|
|
|
|
ifnull((SELECT min(r.rate_value)
|
|
|
|
ifnull((SELECT min(r.rate_value)
|
|
|
|
FROM sys_client_rates r
|
|
|
|
FROM sys_client_rates r
|
|
|
|
WHERE r.client_id = t.client_id AND r.active_time <= t.transaction_time AND
|
|
|
|
WHERE r.client_id = t.client_id AND r.active_time <= t.transaction_time AND
|
|
|
|
r.expiry_time >= t.transaction_time AND
|
|
|
|
r.expiry_time >= t.transaction_time AND
|
|
|
|
r.rate_name = 'Wechat'), 1) wechat_rate_value,
|
|
|
|
r.rate_name = 'Wechat'), 1) wechat_rate_value,
|
|
|
|
ifnull((SELECT min(r.rate_value)
|
|
|
|
ifnull((SELECT min(r.rate_value)
|
|
|
|
FROM sys_client_rates r
|
|
|
|
FROM sys_client_rates r
|
|
|
|
WHERE r.client_id = t.client_id AND r.active_time <= t.transaction_time AND
|
|
|
|
WHERE r.client_id = t.client_id AND r.active_time <= t.transaction_time AND
|
|
|
|
r.expiry_time >= t.transaction_time AND
|
|
|
|
r.expiry_time >= t.transaction_time AND
|
|
|
|
r.rate_name = 'Alipay'), 1) alipay_rate_value,
|
|
|
|
r.rate_name = 'Alipay'), 1) alipay_rate_value,
|
|
|
|
ifnull((SELECT min(r.rate_value)
|
|
|
|
ifnull((SELECT min(r.rate_value)
|
|
|
|
FROM sys_client_rates r
|
|
|
|
FROM sys_client_rates r
|
|
|
|
WHERE r.client_id = t.client_id AND r.active_time <= t.transaction_time AND
|
|
|
|
WHERE r.client_id = t.client_id AND r.active_time <= t.transaction_time AND
|
|
|
|
r.expiry_time >= t.transaction_time AND
|
|
|
|
r.expiry_time >= t.transaction_time AND
|
|
|
|
r.rate_name = 'Bestpay'), 1) bestpay_rate_value,
|
|
|
|
r.rate_name = 'Bestpay'), 1) bestpay_rate_value,
|
|
|
|
ifnull((SELECT min(r.rate_value)
|
|
|
|
ifnull((SELECT min(r.rate_value)
|
|
|
|
FROM sys_client_rates r
|
|
|
|
FROM sys_client_rates r
|
|
|
|
WHERE r.client_id = t.client_id AND r.active_time <= t.transaction_time AND
|
|
|
|
WHERE r.client_id = t.client_id AND r.active_time <= t.transaction_time AND
|
|
|
|
r.expiry_time >= t.transaction_time AND
|
|
|
|
r.expiry_time >= t.transaction_time AND
|
|
|
|
r.rate_name = 'jd'), 1) jd_rate_value,
|
|
|
|
r.rate_name = 'jd'), 1) jd_rate_value,
|
|
|
|
ifnull((SELECT min(r.rate_value)
|
|
|
|
ifnull((SELECT min(r.rate_value)
|
|
|
|
FROM sys_client_rates r
|
|
|
|
FROM sys_client_rates r
|
|
|
|
WHERE r.client_id = t.client_id AND r.active_time <= t.transaction_time AND
|
|
|
|
WHERE r.client_id = t.client_id AND r.active_time <= t.transaction_time AND
|
|
|
@ -561,7 +582,7 @@
|
|
|
|
INNER JOIN sys_clients c ON c.client_id = t.client_id
|
|
|
|
INNER JOIN sys_clients c ON c.client_id = t.client_id
|
|
|
|
INNER JOIN sys_org so
|
|
|
|
INNER JOIN sys_org so
|
|
|
|
ON c.org_id = so.org_id AND so.is_valid = 1 AND so.type = 0 AND so.parent_org_id = #{parent_org_id}
|
|
|
|
ON c.org_id = so.org_id AND so.is_valid = 1 AND so.type = 0 AND so.parent_org_id = #{parent_org_id}
|
|
|
|
WHERE year(t.transaction_time) = #{year} AND month(t.transaction_time) = #{month} AND t.channel != 'Settlement'
|
|
|
|
WHERE year(t.transaction_time) = #{year} AND month(t.transaction_time) = #{month} AND t.channel != 'Settlement'
|
|
|
|
GROUP BY t.client_id, trade_date, channel
|
|
|
|
GROUP BY t.client_id, trade_date, channel
|
|
|
|
ORDER BY c.org_id ASC, t.client_id ASC, trade_date ASC
|
|
|
|
ORDER BY c.org_id ASC, t.client_id ASC, trade_date ASC
|
|
|
|
]]>
|
|
|
|
]]>
|
|
|
@ -676,7 +697,8 @@
|
|
|
|
select sum(if(t.transaction_type='Credit',settle_amount,-settle_amount)) settle_amount ,
|
|
|
|
select sum(if(t.transaction_type='Credit',settle_amount,-settle_amount)) settle_amount ,
|
|
|
|
DATE_FORMAT(t.transaction_time,'%Y%m%d') weekend
|
|
|
|
DATE_FORMAT(t.transaction_time,'%Y%m%d') weekend
|
|
|
|
from pmt_transactions t
|
|
|
|
from pmt_transactions t
|
|
|
|
INNER JOIN log_clearing_detail d on d.clear_detail_id=t.clearing_order and DAYOFWEEK(d.report_date)>2 and clear_days = 1
|
|
|
|
INNER JOIN log_clearing_detail d on d.clear_detail_id=t.clearing_order and DAYOFWEEK(d.report_date)>2 and
|
|
|
|
|
|
|
|
clear_days = 1
|
|
|
|
where (DAYOFWEEK(t.transaction_time)=1 or DAYOFWEEK(t.transaction_time) = 7)
|
|
|
|
where (DAYOFWEEK(t.transaction_time)=1 or DAYOFWEEK(t.transaction_time) = 7)
|
|
|
|
<if test="begin!=null">
|
|
|
|
<if test="begin!=null">
|
|
|
|
and t.transaction_time > #{begin}
|
|
|
|
and t.transaction_time > #{begin}
|
|
|
@ -722,5 +744,15 @@
|
|
|
|
and t.clearing_order is not NULL
|
|
|
|
and t.clearing_order is not NULL
|
|
|
|
group by client_id
|
|
|
|
group by client_id
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="listClientUnsettleDataByDate" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
|
|
date(transaction_time) trans_date,
|
|
|
|
|
|
|
|
sum(if(transaction_type = 'Credit', clearing_amount, -clearing_amount)) clearing_amount,
|
|
|
|
|
|
|
|
sum(if(transaction_type = 'Credit', settle_amount, -settle_amount)) settle_amount
|
|
|
|
|
|
|
|
FROM pmt_transactions t
|
|
|
|
|
|
|
|
WHERE t.client_id = #{client_id} AND t.clearing_status = 0
|
|
|
|
|
|
|
|
GROUP BY trans_date
|
|
|
|
|
|
|
|
ORDER BY trans_date DESC
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
</mapper>
|
|
|
|
</mapper>
|