|
|
|
@ -559,6 +559,41 @@
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="listSettlementLog" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
select cd.cling_id, cd.report_date clearing_time, cd.report_date,
|
|
|
|
|
<if test="merge_settle!=null">
|
|
|
|
|
SUM(cd.tax_amount) as tax_amount,
|
|
|
|
|
SUM(cd.total_charge) as total_charge,
|
|
|
|
|
1 as merge_settle,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="merge_settle==null">
|
|
|
|
|
cd.tax_amount,
|
|
|
|
|
cd.total_charge,
|
|
|
|
|
</if>
|
|
|
|
|
sum(cd.gross_amount) total,
|
|
|
|
|
sum(cd.clearing_amount) income,
|
|
|
|
|
sum(cd.total_charge+cd.tax_amount) fee,
|
|
|
|
|
(SELECT min(r.rate_value) FROM sys_client_rates r WHERE r.client_id = t.client_id
|
|
|
|
|
AND r.expiry_time > cd.report_date
|
|
|
|
|
AND r.active_time <= cd.report_date) rate
|
|
|
|
|
from log_clearing_detail cd
|
|
|
|
|
inner join sys_clients sc on sc.client_id=cd.client_id
|
|
|
|
|
<if test="client_ids!=null">
|
|
|
|
|
AND cd.client_id IN
|
|
|
|
|
<foreach collection="client_ids" open="(" close=")" separator="," item="client_id">
|
|
|
|
|
#{client_id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="client_ids==null and client_id !=null">
|
|
|
|
|
and (sc.client_id=#{client_id} or sc.parent_client_id =#{client_id})
|
|
|
|
|
</if>
|
|
|
|
|
<if test="from!=null">and cd.report_date >= #{from}</if>
|
|
|
|
|
<if test="to!=null">and cd.report_date < #{to}</if>
|
|
|
|
|
<if test="merge_settle!=null">GROUP BY report_date</if>
|
|
|
|
|
<if test="merge_settle==null">GROUP BY clear_detail_id</if>
|
|
|
|
|
order by clearing_id desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="listSettlementLogOrigin" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
SELECT t.client_id,DATE(t.transaction_time) clearing_time,
|
|
|
|
|
ifnull(cd.report_date,date(t.transaction_time)) report_date,
|
|
|
|
|
<if test="merge_settle!=null">
|
|
|
|
|