|
|
|
@ -682,15 +682,17 @@
|
|
|
|
|
|
|
|
|
|
<select id="listSettlementLogTotal" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
<![CDATA[
|
|
|
|
|
SELECT DATE(t.transaction_time) clearing_time,date_format(t.transaction_time, '%Y-%m-%d') clear_time,SUM(t.clearing_amount) total,
|
|
|
|
|
sum(if(LOCATE('MERCHANT',t.system_transaction_id),t.clearing_amount,0)) income,
|
|
|
|
|
sum(if(LOCATE('SURCHARGE',t.system_transaction_id),t.clearing_amount,0)) fee
|
|
|
|
|
FROM pmt_transactions t
|
|
|
|
|
LEFT JOIN sys_clients c on c.client_id = t.client_id
|
|
|
|
|
WHERE t.channel='Settlement'
|
|
|
|
|
SELECT cd.report_date clearing_time,
|
|
|
|
|
date_format(cd.report_date, '%Y-%m-%d') clear_time,
|
|
|
|
|
SUM(cd.gross_amount) total,
|
|
|
|
|
sum(cd.clearing_amount) income,
|
|
|
|
|
sum(cd.total_charge+cd.tax_amount) fee
|
|
|
|
|
from log_clearing_detail cd
|
|
|
|
|
inner JOIN sys_clients c on c.client_id = cd.client_id
|
|
|
|
|
]]>
|
|
|
|
|
<where>
|
|
|
|
|
<if test="client_ids!=null">
|
|
|
|
|
AND t.client_id IN
|
|
|
|
|
AND cd.client_id IN
|
|
|
|
|
<foreach collection="client_ids" open="(" close=")" separator="," item="client_id">
|
|
|
|
|
#{client_id}
|
|
|
|
|
</foreach>
|
|
|
|
@ -698,14 +700,15 @@
|
|
|
|
|
<if test="client_ids==null and client_id !=null">
|
|
|
|
|
and (c.client_id=#{client_id} or c.parent_client_id=#{client_id})
|
|
|
|
|
</if>
|
|
|
|
|
<if test="from!=null">and t.transaction_time >= #{from}</if>
|
|
|
|
|
<if test="to!=null">and t.transaction_time < #{to}</if>
|
|
|
|
|
<if test="from!=null">and cd.report_date >= #{from}</if>
|
|
|
|
|
<if test="to!=null">and cd.report_date < #{to}</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
|
|
|
|
|
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
GROUP BY DATE(t.transaction_time)
|
|
|
|
|
order by t.clearing_time desc
|
|
|
|
|
GROUP BY cd.report_date
|
|
|
|
|
order by cd.clearing_id desc
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="listSettlementLogInClients" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|