|
|
@ -13,7 +13,8 @@
|
|
|
|
<select id="getEarliestOrder" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="getEarliestOrder" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
SELECT *
|
|
|
|
SELECT *
|
|
|
|
FROM pmt_transactions
|
|
|
|
FROM pmt_transactions
|
|
|
|
WHERE client_id = #{client_id} AND clearing_amount > 1
|
|
|
|
WHERE client_id = #{client_id}
|
|
|
|
|
|
|
|
AND clearing_amount > 1
|
|
|
|
ORDER BY transaction_time
|
|
|
|
ORDER BY transaction_time
|
|
|
|
LIMIT 1;
|
|
|
|
LIMIT 1;
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
@ -55,7 +56,8 @@
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
|
|
|
|
<if test="org_ids!=null">and l.org_id in
|
|
|
|
<if test="org_ids!=null">and l.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="analysisTotalAmount" resultType="java.math.BigDecimal">
|
|
|
|
<select id="analysisTotalAmount" resultType="java.math.BigDecimal">
|
|
|
@ -77,7 +79,8 @@
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
|
|
|
|
<if test="org_ids!=null">and l.org_id in
|
|
|
|
<if test="org_ids!=null">and l.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="analysisTotalCount" resultType="java.lang.Double">
|
|
|
|
<select id="analysisTotalCount" resultType="java.lang.Double">
|
|
|
@ -184,7 +187,8 @@
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and o.org_id=#{org_id}</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and o.org_id=#{org_id}</if>
|
|
|
|
<if test="org_ids!=null">and o.org_id in
|
|
|
|
<if test="org_ids!=null">and o.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>
|
|
|
|
<![CDATA[
|
|
|
|
<![CDATA[
|
|
|
|
GROUP BY o.order_id ORDER BY aud_fee DESC limit 1
|
|
|
|
GROUP BY o.order_id ORDER BY aud_fee DESC limit 1
|
|
|
|
]]>
|
|
|
|
]]>
|
|
|
@ -244,7 +248,8 @@
|
|
|
|
<if test="end!=null">and o.create_time <= #{end}</if>
|
|
|
|
<if test="end!=null">and o.create_time <= #{end}</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
|
|
|
|
<if test="org_ids!=null">and l.org_id in
|
|
|
|
<if test="org_ids!=null">and l.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 gateway_label
|
|
|
|
GROUP BY gateway_label
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
@ -274,7 +279,8 @@
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
|
|
|
|
<if test="org_ids!=null">and l.org_id in
|
|
|
|
<if test="org_ids!=null">and l.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>
|
|
|
|
<if test="bd_group!=null">and l.client_id in
|
|
|
|
<if test="bd_group!=null">and l.client_id in
|
|
|
|
(SELECT b.client_id FROM sys_client_bd b
|
|
|
|
(SELECT b.client_id FROM sys_client_bd b
|
|
|
|
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
|
|
|
|
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
|
|
|
@ -311,7 +317,8 @@
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
|
|
|
|
<if test="org_ids!=null">and l.org_id in
|
|
|
|
<if test="org_ids!=null">and l.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>
|
|
|
|
<![CDATA[
|
|
|
|
<![CDATA[
|
|
|
|
GROUP BY date(o.create_time)
|
|
|
|
GROUP BY date(o.create_time)
|
|
|
|
ORDER BY date(o.create_time)
|
|
|
|
ORDER BY date(o.create_time)
|
|
|
@ -339,7 +346,8 @@
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
|
|
|
|
<if test="org_ids!=null">and l.org_id in
|
|
|
|
<if test="org_ids!=null">and l.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="countCustomers" resultType="java.lang.Integer">
|
|
|
|
<select id="countCustomers" resultType="java.lang.Integer">
|
|
|
|
<![CDATA[
|
|
|
|
<![CDATA[
|
|
|
@ -360,7 +368,8 @@
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and o.org_id=#{org_id}</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and o.org_id=#{org_id}</if>
|
|
|
|
<if test="org_ids!=null">and o.org_id in
|
|
|
|
<if test="org_ids!=null">and o.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>
|
|
|
|
<![CDATA[
|
|
|
|
<![CDATA[
|
|
|
|
GROUP BY o.customer_id) p
|
|
|
|
GROUP BY o.customer_id) p
|
|
|
|
]]>
|
|
|
|
]]>
|
|
|
@ -385,8 +394,9 @@
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and t.org_id=#{org_id}</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and t.org_id=#{org_id}</if>
|
|
|
|
<if test="org_ids!=null">and t.org_id in
|
|
|
|
<if test="org_ids!=null">and t.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 test="channel !=null"> and o.channel = #{channel}</if>
|
|
|
|
</if>
|
|
|
|
|
|
|
|
<if test="channel !=null">and o.channel = #{channel}</if>
|
|
|
|
<![CDATA[
|
|
|
|
<![CDATA[
|
|
|
|
GROUP BY o.customer_id) p
|
|
|
|
GROUP BY o.customer_id) p
|
|
|
|
where p.customer_id NOT IN (SELECT o.customer_id FROM pmt_transactions t INNER JOIN pmt_orders o ON o.order_id = t.order_id
|
|
|
|
where p.customer_id NOT IN (SELECT o.customer_id FROM pmt_transactions t INNER JOIN pmt_orders o ON o.order_id = t.order_id
|
|
|
@ -426,8 +436,9 @@
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and t.org_id=#{org_id}</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and t.org_id=#{org_id}</if>
|
|
|
|
<if test="org_ids!=null">and t.org_id in
|
|
|
|
<if test="org_ids!=null">and t.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 test="channel !=null"> and o.channel = #{channel}</if>
|
|
|
|
</if>
|
|
|
|
|
|
|
|
<if test="channel !=null">and o.channel = #{channel}</if>
|
|
|
|
<![CDATA[
|
|
|
|
<![CDATA[
|
|
|
|
GROUP BY o.customer_id) p
|
|
|
|
GROUP BY o.customer_id) p
|
|
|
|
where p.customer_id IN (SELECT o.customer_id FROM pmt_transactions t INNER JOIN pmt_orders o ON o.order_id = t.order_id
|
|
|
|
where p.customer_id IN (SELECT o.customer_id FROM pmt_transactions t INNER JOIN pmt_orders o ON o.order_id = t.order_id
|
|
|
@ -451,9 +462,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getCountCustomers" resultType="java.lang.Integer">
|
|
|
|
<select id="getCountCustomers" resultType="java.lang.Integer">
|
|
|
|
<![CDATA[
|
|
|
|
<![CDATA[
|
|
|
|
SELECT count(DISTINCT o.customer_id) FROM pmt_orders o where
|
|
|
|
SELECT count(DISTINCT o.customer_id)
|
|
|
|
o.create_time < #{date} and o.status>=5
|
|
|
|
FROM pmt_orders o
|
|
|
|
]]>
|
|
|
|
where o.create_time < #{date}
|
|
|
|
|
|
|
|
and o.status >= 5
|
|
|
|
|
|
|
|
]]>
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getTradePartnersInTypes" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="getTradePartnersInTypes" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
@ -499,7 +512,8 @@
|
|
|
|
]]>
|
|
|
|
]]>
|
|
|
|
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
|
|
|
|
<if test="org_ids!=null">and l.org_id in
|
|
|
|
<if test="org_ids!=null">and l.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>
|
|
|
|
<if test="bd_group!=null">and l.client_id in
|
|
|
|
<if test="bd_group!=null">and l.client_id in
|
|
|
|
(SELECT b.client_id FROM sys_client_bd b
|
|
|
|
(SELECT b.client_id FROM sys_client_bd b
|
|
|
|
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
|
|
|
|
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
|
|
|
@ -558,7 +572,8 @@
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
|
|
|
|
<if test="org_ids!=null">and l.org_id in
|
|
|
|
<if test="org_ids!=null">and l.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>
|
|
|
|
<if test="bd_group!=null">and l.client_id in
|
|
|
|
<if test="bd_group!=null">and l.client_id in
|
|
|
|
(SELECT b.client_id FROM sys_client_bd b
|
|
|
|
(SELECT b.client_id FROM sys_client_bd b
|
|
|
|
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
|
|
|
|
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
|
|
|
@ -650,18 +665,19 @@
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and ptran.org_id=#{org_id}</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and ptran.org_id=#{org_id}</if>
|
|
|
|
<if test="org_ids!=null">and ptran.org_id in
|
|
|
|
<if test="org_ids!=null">and ptran.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="listExchangeRates" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="listExchangeRates" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<![CDATA[
|
|
|
|
<![CDATA[
|
|
|
|
SELECT max(t.transaction_time) mx,t.exchange_rate,date(t.transaction_time) `date`
|
|
|
|
SELECT max(t.transaction_time) mx, t.exchange_rate, date(t.transaction_time) `date`
|
|
|
|
FROM
|
|
|
|
FROM pmt_transactions t
|
|
|
|
pmt_transactions t
|
|
|
|
WHERE date(t.transaction_time) >= #{begin}
|
|
|
|
WHERE date(t.transaction_time) >= #{begin} And date(t.transaction_time) <= #{end} AND
|
|
|
|
And date(t.transaction_time) <= #{end}
|
|
|
|
t.transaction_type ='Credit' AND t.channel =#{channel}
|
|
|
|
AND t.transaction_type = 'Credit'
|
|
|
|
GROUP BY
|
|
|
|
AND t.channel = #{channel}
|
|
|
|
date(t.transaction_time)
|
|
|
|
GROUP BY date(t.transaction_time)
|
|
|
|
order by `date` asc
|
|
|
|
order by `date` asc
|
|
|
|
]]>
|
|
|
|
]]>
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
@ -693,8 +709,9 @@
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and o.org_id=#{org_id}</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and o.org_id=#{org_id}</if>
|
|
|
|
<if test="org_ids!=null">and o.org_id in
|
|
|
|
<if test="org_ids!=null">and o.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>
|
|
|
|
GROUP BY date , channel ORDER BY date DESC
|
|
|
|
</if>
|
|
|
|
|
|
|
|
GROUP BY date , channel ORDER BY date DESC
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getOrgTransactionAnalysis" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="getOrgTransactionAnalysis" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
@ -710,7 +727,8 @@
|
|
|
|
<if test="end!=null">and t.transaction_time <= #{end}</if>
|
|
|
|
<if test="end!=null">and t.transaction_time <= #{end}</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and o.org_id=#{org_id}</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and o.org_id=#{org_id}</if>
|
|
|
|
<if test="org_ids!=null">and o.org_id in
|
|
|
|
<if test="org_ids!=null">and o.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 o.org_id order by amount desc
|
|
|
|
GROUP BY o.org_id order by amount desc
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
@ -749,7 +767,8 @@
|
|
|
|
<if test="channel!=null">and o.channel=#{channel}</if>
|
|
|
|
<if test="channel!=null">and o.channel=#{channel}</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
|
|
|
|
<if test="org_ids!=null">and l.org_id in
|
|
|
|
<if test="org_ids!=null">and l.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="countAmountRangeAnalysis" resultType="java.lang.Integer">
|
|
|
|
<select id="countAmountRangeAnalysis" resultType="java.lang.Integer">
|
|
|
@ -766,7 +785,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="listAmountRangeOrders" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="listAmountRangeOrders" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
select c.client_moniker,c.short_name,t.order_id,t.clearing_amount,t.transaction_time,t.channel,o.customer_id,o.customer_ip,o.gateway
|
|
|
|
select
|
|
|
|
|
|
|
|
c.client_moniker,c.short_name,t.order_id,t.clearing_amount,t.transaction_time,t.channel,o.customer_id,o.customer_ip,o.gateway
|
|
|
|
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
|
|
|
|
INNER JOIN sys_clients c on c.client_id = t.client_id
|
|
|
|
INNER JOIN sys_clients c on c.client_id = t.client_id
|
|
|
@ -778,6 +798,19 @@
|
|
|
|
<if test="amount_from!=null">and t.clearing_amount >= #{amount_from}</if>
|
|
|
|
<if test="amount_from!=null">and t.clearing_amount >= #{amount_from}</if>
|
|
|
|
<if test="amount_to!=null">and t.clearing_amount < #{amount_to}</if>
|
|
|
|
<if test="amount_to!=null">and t.clearing_amount < #{amount_to}</if>
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="countAmountRangeOrders" resultType="int">
|
|
|
|
|
|
|
|
select count(1)
|
|
|
|
|
|
|
|
FROM pmt_transactions t
|
|
|
|
|
|
|
|
<if test="client_moniker!=null">
|
|
|
|
|
|
|
|
inner join sys_clients c on c.client_id=t.client_id and c.client_moniker=#{client_moniker}
|
|
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
where t.transaction_type = 'Credit' and t.refund_id is null and t.channel != 'Settlement'
|
|
|
|
|
|
|
|
<if test="begin!=null">and t.transaction_time >= #{begin}</if>
|
|
|
|
|
|
|
|
<if test="end!=null">and t.transaction_time <= #{end}</if>
|
|
|
|
|
|
|
|
<if test="channel!=null">and t.channel=#{channel}</if>
|
|
|
|
|
|
|
|
<if test="amount_from!=null">and t.clearing_amount >= #{amount_from}</if>
|
|
|
|
|
|
|
|
<if test="amount_to!=null">and t.clearing_amount < #{amount_to}</if>
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!--交易金额分析 饼图 -->
|
|
|
|
<!--交易金额分析 饼图 -->
|
|
|
|
<!--不更改-->
|
|
|
|
<!--不更改-->
|
|
|
@ -804,13 +837,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getClientTransaction" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="getClientTransaction" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
SELECT
|
|
|
|
SELECT
|
|
|
|
IFNULL(sum(if(l.transaction_type='Credit',l.clearing_amount,0)),0) trade_amount,
|
|
|
|
IFNULL(sum(if(l.transaction_type='Credit',l.clearing_amount,0)),0) trade_amount,
|
|
|
|
IFNULL(sum(if(l.transaction_type='Debit',l.clearing_amount,0)),0) refund_amount,
|
|
|
|
IFNULL(sum(if(l.transaction_type='Debit',l.clearing_amount,0)),0) refund_amount,
|
|
|
|
IFNULL(sum(if(l.transaction_type='Credit',1,0)),0) trade_count,
|
|
|
|
IFNULL(sum(if(l.transaction_type='Credit',1,0)),0) trade_count,
|
|
|
|
IFNULL(sum(if(l.transaction_type='Debit',1,0)),0) refund_orders
|
|
|
|
IFNULL(sum(if(l.transaction_type='Debit',1,0)),0) refund_orders
|
|
|
|
FROM pmt_transactions l
|
|
|
|
FROM pmt_transactions l
|
|
|
|
where l.channel!='Settlement' and l.system_generate=0
|
|
|
|
where l.channel!='Settlement' and l.system_generate=0
|
|
|
|
<if test="client_ids!=null">
|
|
|
|
<if test="client_ids!=null">
|
|
|
|
AND l.client_id IN
|
|
|
|
AND l.client_id IN
|
|
|
|
<foreach collection="client_ids" open="(" close=")" separator="," item="client_id">
|
|
|
|
<foreach collection="client_ids" open="(" close=")" separator="," item="client_id">
|
|
|
@ -824,31 +857,39 @@
|
|
|
|
<if test="end!=null">and l.transaction_time < #{end}</if>
|
|
|
|
<if test="end!=null">and l.transaction_time < #{end}</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
|
|
|
|
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
|
|
|
|
<if test="org_ids!=null">and l.org_id in
|
|
|
|
<if test="org_ids!=null">and l.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="getAreaMerchantAmountAnalysis" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="getAreaMerchantAmountAnalysis" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
SELECT c.client_moniker,c.short_name,c.bd_user_name,sum(if(t.transaction_type='Credit',t.clearing_amount,0)) total,
|
|
|
|
SELECT c.client_moniker,c.short_name,c.bd_user_name,sum(if(t.transaction_type='Credit',t.clearing_amount,0))
|
|
|
|
|
|
|
|
total,
|
|
|
|
COUNT(DISTINCT t.order_id) orders,
|
|
|
|
COUNT(DISTINCT t.order_id) orders,
|
|
|
|
c.suburb,c.state,c.royalpayindustry,sum(if(t.channel='Alipay' OR t.channel='AlipayOnline',t.clearing_amount,0)) alipay_total,
|
|
|
|
c.suburb,c.state,c.royalpayindustry,sum(if(t.channel='Alipay' OR t.channel='AlipayOnline',t.clearing_amount,0))
|
|
|
|
sum(if(t.channel='Alipay'OR t.channel='AlipayOnline',1,0)) alipay_order,sum(if(t.channel='Wechat',t.clearing_amount,0)) wechat_toatl,
|
|
|
|
alipay_total,
|
|
|
|
|
|
|
|
sum(if(t.channel='Alipay'OR t.channel='AlipayOnline',1,0))
|
|
|
|
|
|
|
|
alipay_order,sum(if(t.channel='Wechat',t.clearing_amount,0)) wechat_toatl,
|
|
|
|
sum(if(t.channel='Wechat',1,0)) wechat_order
|
|
|
|
sum(if(t.channel='Wechat',1,0)) wechat_order
|
|
|
|
FROM pmt_transactions t
|
|
|
|
FROM sys_clients c
|
|
|
|
INNER JOIN pmt_orders ord on ord.order_id = t.order_id
|
|
|
|
LEFT JOIN (select
|
|
|
|
RIGHT JOIN sys_clients c on t.client_id = c.client_id and c.is_valid = 1
|
|
|
|
tt.client_id,tt.order_id,tt.transaction_type,tt.clearing_amount, tt.channel
|
|
|
|
|
|
|
|
from pmt_transactions tt where tt.transaction_type = 'Credit'
|
|
|
|
|
|
|
|
and tt.system_generate=0
|
|
|
|
|
|
|
|
<if test="begin!=null">and tt.transaction_time >= #{begin}</if>
|
|
|
|
|
|
|
|
<if test="end!=null">and tt.transaction_time <= #{end}</if>
|
|
|
|
|
|
|
|
)t on t.client_id = c.client_id
|
|
|
|
<if test="bd_user!=null">
|
|
|
|
<if test="bd_user!=null">
|
|
|
|
INNER JOIN sys_client_bd d ON c.client_id = d.client_id AND d.bd_id = #{bd_user} and
|
|
|
|
INNER JOIN sys_client_bd d ON c.client_id = d.client_id AND d.bd_id = #{bd_user} and
|
|
|
|
date(d.start_date)<= #{begin} and (d.end_date is null or date(d.end_date)>= #{end}) and
|
|
|
|
date(d.start_date)<= #{begin} and (d.end_date is null or date(d.end_date)>= #{end}) and
|
|
|
|
d.is_valid=1
|
|
|
|
d.is_valid=1
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
where (t.transaction_type = 'Credit')
|
|
|
|
where (c.is_valid = 1 )
|
|
|
|
<if test="begin!=null">and t.transaction_time >= #{begin}</if>
|
|
|
|
|
|
|
|
<if test="end!=null">and t.transaction_time <= #{end}</if>
|
|
|
|
|
|
|
|
<if test="state!=null">and c.state <= #{state}</if>
|
|
|
|
<if test="state!=null">and c.state <= #{state}</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>
|
|
|
|
<if test="client_monikers!=null">
|
|
|
|
<if test="client_monikers!=null">
|
|
|
|
AND c.client_moniker IN
|
|
|
|
AND c.client_moniker IN
|
|
|
|
<foreach collection="client_monikers" open="(" close=")" separator="," item="client_moniker">
|
|
|
|
<foreach collection="client_monikers" open="(" close=")" separator="," item="client_moniker">
|
|
|
@ -858,6 +899,29 @@
|
|
|
|
GROUP BY c.client_id order by total desc
|
|
|
|
GROUP BY c.client_id order by total desc
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="countAreaMerchantAmountAnalysis" resultType="int">
|
|
|
|
|
|
|
|
SELECT count(distinct c.client_id) clients
|
|
|
|
|
|
|
|
FROM sys_clients c
|
|
|
|
|
|
|
|
<if test="bd_user!=null">
|
|
|
|
|
|
|
|
INNER JOIN sys_client_bd d ON c.client_id = d.client_id AND d.bd_id = #{bd_user} and
|
|
|
|
|
|
|
|
date(d.start_date)<= #{begin} and (d.end_date is null or date(d.end_date)>= #{end}) and
|
|
|
|
|
|
|
|
d.is_valid=1
|
|
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
where (c.is_valid = 1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<if test="state!=null">and c.state <= #{state}</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>
|
|
|
|
|
|
|
|
<if test="client_monikers!=null">
|
|
|
|
|
|
|
|
AND c.client_moniker IN
|
|
|
|
|
|
|
|
<foreach collection="client_monikers" open="(" close=")" separator="," item="client_moniker">
|
|
|
|
|
|
|
|
#{client_moniker}
|
|
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getAreaMerchantAmountByCycle" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="getAreaMerchantAmountByCycle" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
SELECT c.client_moniker,sum(if(t.transaction_type='Credit',t.clearing_amount,0)) old_total,
|
|
|
|
SELECT c.client_moniker,sum(if(t.transaction_type='Credit',t.clearing_amount,0)) old_total,
|
|
|
@ -868,16 +932,20 @@
|
|
|
|
RIGHT JOIN sys_clients c on t.client_id = c.client_id and c.is_valid = 1
|
|
|
|
RIGHT JOIN sys_clients c on t.client_id = c.client_id and c.is_valid = 1
|
|
|
|
<if test="bd_user!=null">
|
|
|
|
<if test="bd_user!=null">
|
|
|
|
INNER JOIN sys_client_bd d ON c.client_id = d.client_id AND d.bd_id = #{bd_user} and
|
|
|
|
INNER JOIN sys_client_bd d ON c.client_id = d.client_id AND d.bd_id = #{bd_user} and
|
|
|
|
date(d.start_date)<= DATE_ADD(#{begin},INTERVAL -datediff( #{end},#{begin}) DAY) and (d.end_date is null or date(d.end_date)>= #{begin}) and
|
|
|
|
date(d.start_date)<= DATE_ADD(#{begin},INTERVAL -datediff( #{end},#{begin}) DAY) and (d.end_date is null
|
|
|
|
|
|
|
|
or date(d.end_date)>= #{begin}) and
|
|
|
|
d.is_valid=1
|
|
|
|
d.is_valid=1
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
where (t.transaction_type = 'Credit')
|
|
|
|
where (t.transaction_type = 'Credit')
|
|
|
|
<if test="begin!=null">and t.transaction_time >= DATE_ADD(#{begin},INTERVAL -datediff( #{end},#{begin}) DAY)</if>
|
|
|
|
<if test="begin!=null">and t.transaction_time >= DATE_ADD(#{begin},INTERVAL -datediff( #{end},#{begin})
|
|
|
|
|
|
|
|
DAY)
|
|
|
|
|
|
|
|
</if>
|
|
|
|
<if test="end!=null">and t.transaction_time <= #{begin}</if>
|
|
|
|
<if test="end!=null">and t.transaction_time <= #{begin}</if>
|
|
|
|
<if test="state!=null">and c.state <= #{state}</if>
|
|
|
|
<if test="state!=null">and c.state <= #{state}</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>
|
|
|
|
<if test="client_monikers!=null">
|
|
|
|
<if test="client_monikers!=null">
|
|
|
|
AND c.client_moniker IN
|
|
|
|
AND c.client_moniker IN
|
|
|
|
<foreach collection="client_monikers" open="(" close=")" separator="," item="client_moniker">
|
|
|
|
<foreach collection="client_monikers" open="(" close=")" separator="," item="client_moniker">
|
|
|
@ -888,9 +956,9 @@
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getOrderClearAmount" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="getOrderClearAmount" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
SELECT clearing_amount,o.client_id
|
|
|
|
SELECT clearing_amount, o.client_id
|
|
|
|
FROM pmt_orders o
|
|
|
|
FROM pmt_orders o
|
|
|
|
INNER JOIN pmt_transactions pt ON o.order_id = pt.order_id
|
|
|
|
INNER JOIN pmt_transactions pt ON o.order_id = pt.order_id
|
|
|
|
WHERE o.order_id = #{order_id}
|
|
|
|
WHERE o.order_id = #{order_id}
|
|
|
|
LIMIT 1;
|
|
|
|
LIMIT 1;
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|