|
|
|
@ -3,53 +3,50 @@
|
|
|
|
|
<mapper namespace="au.com.royalpay.payment.manage.mappers.payment.RefundMapper">
|
|
|
|
|
|
|
|
|
|
<select id="listOrderRefunds" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
SELECT
|
|
|
|
|
r.*,
|
|
|
|
|
a.audit_result,
|
|
|
|
|
a.auditorname,
|
|
|
|
|
a.audittime
|
|
|
|
|
SELECT r.*,
|
|
|
|
|
a.audit_result,
|
|
|
|
|
a.auditorname,
|
|
|
|
|
a.audittime
|
|
|
|
|
FROM pmt_refunds r
|
|
|
|
|
LEFT JOIN pmt_refund_applies a ON a.refund_id = r.refund_id
|
|
|
|
|
LEFT JOIN pmt_refund_applies a ON a.refund_id = r.refund_id
|
|
|
|
|
WHERE r.order_id = #{order_id}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="findRefundInfoByDay" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
<![CDATA[
|
|
|
|
|
SELECT
|
|
|
|
|
IFNULL(SUM(prf.amount), 0) total_refund_amount,
|
|
|
|
|
IFNULL(COUNT(prf.refund_id), 0) total_refund_count,
|
|
|
|
|
MAX(prf.amount) max_refund_amount
|
|
|
|
|
SELECT IFNULL(SUM(prf.amount), 0) total_refund_amount,
|
|
|
|
|
IFNULL(COUNT(prf.refund_id), 0) total_refund_count,
|
|
|
|
|
MAX(prf.amount) max_refund_amount
|
|
|
|
|
FROM pmt_refunds prf
|
|
|
|
|
WHERE prf.create_time <= #{end}
|
|
|
|
|
AND prf.create_time >= #{begin}
|
|
|
|
|
AND prf.status IN ('2', '4', '5')
|
|
|
|
|
AND prf.create_time >= #{begin}
|
|
|
|
|
AND prf.status IN ('2', '4', '5')
|
|
|
|
|
]]>
|
|
|
|
|
</select>
|
|
|
|
|
<select id="findClientMoniker" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
<![CDATA[
|
|
|
|
|
SELECT DISTINCT sysc.*
|
|
|
|
|
FROM sys_clients sysc,
|
|
|
|
|
pmt_refunds prf
|
|
|
|
|
pmt_refunds prf
|
|
|
|
|
WHERE prf.create_time <= #{end}
|
|
|
|
|
AND prf.create_time >= #{begin}
|
|
|
|
|
AND prf.amount = #{amount}
|
|
|
|
|
AND sysc.client_id = prf.client_id
|
|
|
|
|
AND prf.status IN ('2', '4', '5')
|
|
|
|
|
AND prf.create_time >= #{begin}
|
|
|
|
|
AND prf.amount = #{amount}
|
|
|
|
|
AND sysc.client_id = prf.client_id
|
|
|
|
|
AND prf.status IN ('2', '4', '5')
|
|
|
|
|
]]>
|
|
|
|
|
</select>
|
|
|
|
|
<select id="listRefundCount" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
<![CDATA[
|
|
|
|
|
SELECT
|
|
|
|
|
count(1) refund_counts,
|
|
|
|
|
sum(prf.amount) refund_amount,
|
|
|
|
|
sysc.client_moniker
|
|
|
|
|
FROM pmt_refunds prf,
|
|
|
|
|
sys_clients sysc
|
|
|
|
|
WHERE prf.create_time <= #{end}
|
|
|
|
|
AND prf.create_time >= #{begin}
|
|
|
|
|
AND prf.client_id = sysc.client_id
|
|
|
|
|
AND prf.status IN ('2', '4', '5')
|
|
|
|
|
SELECT count(1) refund_counts,
|
|
|
|
|
sum(ptr.clearing_amount) refund_amount,
|
|
|
|
|
sysc.client_moniker
|
|
|
|
|
FROM sys_clients sysc
|
|
|
|
|
inner join pmt_refunds prf on prf.client_id = sysc.client_id and prf.create_time <= #{end}
|
|
|
|
|
AND prf.create_time >= #{begin}
|
|
|
|
|
inner join pmt_transactions ptr on ptr.refund_id = prf.refund_id and ptr.transaction_type = 'Debit' and
|
|
|
|
|
ptr.system_generate = 0
|
|
|
|
|
GROUP BY prf.client_id
|
|
|
|
|
ORDER BY refund_amount DESC
|
|
|
|
|
limit 30
|
|
|
|
|
]]>
|
|
|
|
|
</select>
|
|
|
|
|
<select id="listRefundDate" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
@ -57,7 +54,7 @@
|
|
|
|
|
SELECT *
|
|
|
|
|
FROM calendar
|
|
|
|
|
WHERE datelist >= #{begin}
|
|
|
|
|
AND datelist <= #{end}
|
|
|
|
|
AND datelist <= #{end}
|
|
|
|
|
ORDER BY datelist ASC
|
|
|
|
|
]]>
|
|
|
|
|
</select>
|
|
|
|
@ -71,53 +68,53 @@
|
|
|
|
|
</select>
|
|
|
|
|
<select id="listUnionAllApply" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
SELECT
|
|
|
|
|
order_id order_id,
|
|
|
|
|
client_id client_id,
|
|
|
|
|
create_time create_time,
|
|
|
|
|
confirm_time confirm_time,
|
|
|
|
|
operator_name operator_name,
|
|
|
|
|
`status` `status` ,
|
|
|
|
|
amount amount,
|
|
|
|
|
currency currency,
|
|
|
|
|
1 type
|
|
|
|
|
order_id order_id,
|
|
|
|
|
client_id client_id,
|
|
|
|
|
create_time create_time,
|
|
|
|
|
confirm_time confirm_time,
|
|
|
|
|
operator_name operator_name,
|
|
|
|
|
`status` `status` ,
|
|
|
|
|
amount amount,
|
|
|
|
|
currency currency,
|
|
|
|
|
1 type
|
|
|
|
|
FROM
|
|
|
|
|
pmt_refunds
|
|
|
|
|
pmt_refunds
|
|
|
|
|
<where>
|
|
|
|
|
<if test="client_id!=null">
|
|
|
|
|
and client_id = #{client_id}
|
|
|
|
|
and client_id = #{client_id}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="start_time!=null">
|
|
|
|
|
and create_time >= #{start_time}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="start_time!=null">
|
|
|
|
|
and create_time <= #{end_time}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="client_ids!=null">
|
|
|
|
|
client_id in
|
|
|
|
|
<foreach collection="client_ids" open="(" close=")" separator="," item="item">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="start_time!=null">
|
|
|
|
|
and create_time >= #{start_time}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="start_time!=null">
|
|
|
|
|
and create_time <= #{end_time}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="client_ids!=null">
|
|
|
|
|
client_id in
|
|
|
|
|
<foreach collection="client_ids" open="(" close=")" separator="," item="item">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
UNION ALL
|
|
|
|
|
UNION ALL
|
|
|
|
|
SELECT
|
|
|
|
|
ra.order_id order_id,
|
|
|
|
|
ra.client_id client_id,
|
|
|
|
|
ra.applytime create_time,
|
|
|
|
|
ra.audittime confirm_time,
|
|
|
|
|
ra.auditorname operator_name,
|
|
|
|
|
ra.audit_result `status` ,
|
|
|
|
|
r.amount amount,
|
|
|
|
|
r.currency currency,
|
|
|
|
|
2 type
|
|
|
|
|
ra.order_id order_id,
|
|
|
|
|
ra.client_id client_id,
|
|
|
|
|
ra.applytime create_time,
|
|
|
|
|
ra.audittime confirm_time,
|
|
|
|
|
ra.auditorname operator_name,
|
|
|
|
|
ra.audit_result `status` ,
|
|
|
|
|
r.amount amount,
|
|
|
|
|
r.currency currency,
|
|
|
|
|
2 type
|
|
|
|
|
FROM
|
|
|
|
|
pmt_refund_applies ra left join pmt_refunds r on ra.refund_id = r.refund_id
|
|
|
|
|
pmt_refund_applies ra left join pmt_refunds r on ra.refund_id = r.refund_id
|
|
|
|
|
<where>
|
|
|
|
|
<if test="client_id!=null">
|
|
|
|
|
and ra.client_id = #{client_id}
|
|
|
|
|
and ra.client_id = #{client_id}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="start_time!=null">
|
|
|
|
|
and ra.applytime >= #{start_time}
|
|
|
|
|
and ra.applytime >= #{start_time}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="start_time!=null">
|
|
|
|
|
and ra.applytime <= #{end_time}
|
|
|
|
|