Merge branch 'develop'

master
taylor.dang 6 years ago
commit 377ff2659b

@ -3,39 +3,70 @@
<mapper namespace="au.com.royalpay.payment.manage.analysis.mappers.BDAnalysisMapper"> <mapper namespace="au.com.royalpay.payment.manage.analysis.mappers.BDAnalysisMapper">
<select id="getBDSaleList" resultType="com.alibaba.fastjson.JSONObject"> <select id="getBDSaleList" resultType="com.alibaba.fastjson.JSONObject">
SELECT SELECT
d.bd_name,d.bd_id,sum(if(temp.transaction_type='Credit',temp.clearing_amount*d.proportion,-temp.clearing_amount*d.proportion)) d.bd_name,
total, d.bd_id,
ifnull(sum(if(temp.refund_id is not null,if(temp.transaction_type='Debit',temp.clearing_amount,-temp.clearing_amount)*d.proportion,0)),0) refund_fee SUM(if(temp.transaction_type = 'Credit', temp.clearing_amount * d.proportion, -temp.clearing_amount * d.proportion)) total,
FROM ifnull(SUM(if(temp.refund_id IS NOT NULL, if(temp.transaction_type='Debit', temp.clearing_amount, -temp.clearing_amount) * d.proportion, 0)), 0) refund_fee
(SELECT l.client_id,l.clearing_amount,l.refund_id,l.transaction_type,o.create_time FROM pmt_transactions l FROM(
INNER JOIN pmt_orders o SELECT
ON o.order_id = l.order_id l.client_id,
<if test="begin!=null">and o.create_time &gt;= #{begin}</if> l.clearing_amount,
<if test="end!=null">and o.create_time &lt; #{end}</if> l.refund_id,
<if test="begin_month">and DATE_FORMAT(o.create_time,'%Y-%m') &gt;=#{begin_month}</if> l.transaction_type,
<if test="end_month">and DATE_FORMAT(o.create_time,'%Y-%m') &lt;= #{end_month}</if> o.create_time
where (l.transaction_type='Credit' or l.refund_id is not null) FROM pmt_transactions l
INNER JOIN pmt_orders o
ON o.order_id = l.order_id
<if test="begin != null">
AND o.create_time &gt;= #{begin}
</if>
<if test="end != null">
AND o.create_time &lt; #{end}
</if>
<if test="begin_month">
AND DATE_FORMAT(o.create_time, '%Y-%m') &gt;= #{begin_month}
</if>
<if test="end_month">
AND DATE_FORMAT(o.create_time, '%Y-%m') &lt;= #{end_month}
</if>
WHERE (l.transaction_type = 'Credit' OR l.refund_id IS NOT NULL)
) temp ) temp
INNER JOIN sys_client_bd d ON temp.client_id = d.client_id AND d.start_date &lt;= temp.create_time and INNER JOIN sys_client_bd d
d.is_valid = '1' ON temp.client_id = d.client_id
AND (d.end_date is null or d.end_date > temp.create_time) AND d.start_date &lt;= temp.create_time
<if test="org_id!=null and org_ids==null"> AND d.is_valid = '1'
INNER JOIN sys_managers m on m.manager_id = d.bd_id and m.org_id = #{org_id} AND (d.end_date IS NULL OR d.end_date > temp.create_time)
<if test="org_id != null and org_ids == null">
INNER JOIN sys_managers m
ON m.manager_id = d.bd_id
AND m.org_id = #{org_id}
</if> </if>
<if test="org_ids!=null"> <if test="org_ids != null">
INNER JOIN sys_managers m on m.manager_id = d.bd_id and m.org_id in INNER JOIN sys_managers m
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if> ON m.manager_id = d.bd_id
<if test="bd_group!=null">and temp.client_id in AND m.org_id IN
(SELECT b.client_id FROM sys_client_bd b <foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id #{org_id}
where b.is_valid=1 and b.start_date&lt;=now() and (b.end_date is null or b.end_date &gt;= now()) </foreach></if>
AND (c.bd_group=#{bd_group} or c.manager_id=#{bd_group}) <if test="bd_group != null">
<if test="bd_group_bd">and c.manager_id=#{bd_group_bd}</if> AND temp.client_id IN(
SELECT b.client_id
FROM sys_client_bd b
INNER JOIN financial_bd_config c
ON c.manager_id = b.bd_id
WHERE b.is_valid = 1
AND b.start_date &lt;= now()
AND (b.end_date IS NULL OR b.end_date &gt;= now())
AND (c.bd_group = #{bd_group} OR c.manager_id = #{bd_group})
<if test="bd_group_bd">
AND c.manager_id = #{bd_group_bd}
</if>
) )
</if> </if>
GROUP BY d.bd_id GROUP BY d.bd_id
ORDER BY total DESC ORDER BY total DESC
</select> </select>
<select id="getBDSalePartnerList" resultType="com.alibaba.fastjson.JSONObject"> <select id="getBDSalePartnerList" resultType="com.alibaba.fastjson.JSONObject">
SELECT SELECT
c.client_id,c.client_moniker,c.short_name,c.approve_time,IFNULL(sum(if(temp.transaction_type='Credit',temp.clearing_amount*d.proportion,-temp.clearing_amount*d.proportion)),0) c.client_id,c.client_moniker,c.short_name,c.approve_time,IFNULL(sum(if(temp.transaction_type='Credit',temp.clearing_amount*d.proportion,-temp.clearing_amount*d.proportion)),0)

@ -95,8 +95,8 @@
p.client_moniker partner_code, p.client_moniker partner_code,
p.short_name partner_name, p.short_name partner_name,
format(o.refund_amount * 100, 0) refund_fee, format(o.refund_amount * 100, 0) refund_fee,
t.clearing_status, t.clearing_status,
t.settle_amount t.settle_amount
</sql> </sql>
<update id="updateRefundAmount"> <update id="updateRefundAmount">
@ -139,7 +139,7 @@
</update> </update>
<select id="listOrders" resultType="com.alibaba.fastjson.JSONObject"> <select id="listOrders" resultType="com.alibaba.fastjson.JSONObject">
<if test="bd_user!=null"> <if test="bd_user != null">
SELECT temp.* FROM ( SELECT temp.* FROM (
</if> </if>
<if test="gateway"> <if test="gateway">
@ -149,80 +149,121 @@
<include refid="tradelog_list_keys"/> <include refid="tradelog_list_keys"/>
</if> </if>
FROM pmt_orders o FROM pmt_orders o
INNER JOIN sys_clients p ON p.client_id=o.client_id AND p.is_valid=1 INNER JOIN sys_clients p
<if test="client_ids!=null"> ON p.client_id = o.client_id
AND p.is_valid = 1
<if test="client_ids != null">
AND p.client_id IN AND p.client_id IN
<foreach collection="client_ids" open="(" close=")" separator="," item="client_id"> <foreach collection="client_ids" open="(" close=")" separator="," item="client_id">
#{client_id} #{client_id}
</foreach> </foreach>
</if> </if>
<if test="client_ids==null and client_id !=null"> <if test="client_ids == null and client_id != null">
and p.client_id=#{client_id} AND p.client_id = #{client_id}
</if> </if>
LEFT JOIN pmt_transactions t on t.order_id=o.order_id and t.refund_id is null and t.transaction_type='Credit' LEFT JOIN pmt_transactions t
ON t.order_id = o.order_id
AND t.refund_id IS NULL
AND t.transaction_type = 'Credit'
<where> <where>
<if test="search_text!=null"> <if test="search_text != null">
<bind name="name_pattern" value="'%'+search_text+'%'"/> <bind name="name_pattern" value="'%' + search_text + '%'"/>
<if test="text_type=='all'"> <if test="text_type == 'all'">
and (p.client_moniker=#{search_text} or p.short_name like #{name_pattern} or o.order_detail like AND (
#{name_pattern} or t.system_transaction_id =#{search_text} or o.channel = #{search_text} or p.client_moniker = #{search_text}
t.order_id =#{search_text}) OR p.short_name LIKE #{name_pattern}
OR o.order_detail LIKE #{name_pattern}
OR t.system_transaction_id = #{search_text}
OR o.channel = #{search_text}
OR t.order_id = #{search_text}
)
</if> </if>
<if test="text_type=='client_moniker'"> <if test="text_type == 'client_moniker'">
and p.client_moniker=#{search_text} AND p.client_moniker = #{search_text}
</if> </if>
<if test="text_type=='client_name'"> <if test="text_type == 'client_name'">
and p.short_name like #{name_pattern} AND p.short_name LIKE #{name_pattern}
</if> </if>
<if test="text_type=='remark'"> <if test="text_type == 'remark'">
and o.order_detail like #{name_pattern} AND o.order_detail LIKE #{name_pattern}
</if> </if>
<if test="text_type=='channel'"> <if test="text_type == 'channel'">
and o.channel = #{search_text} AND o.channel = #{search_text}
</if> </if>
<if test="text_type=='sys_trans_id'"> <if test="text_type == 'sys_trans_id'">
and t.system_transaction_id =#{search_text} AND t.system_transaction_id = #{search_text}
</if> </if>
<if test="text_type=='order_id'"> <if test="text_type == 'order_id'">
and o.order_id =#{search_text} AND o.order_id = #{search_text}
</if> </if>
</if> </if>
<if test="order_id!=null">and o.order_id=#{order_id}</if> <if test="order_id != null">
<if test="trade_type!=null">and o.gateway in AND o.order_id = #{order_id}
<foreach collection="trade_type" item="gateway" open="(" close=")" separator=",">#{gateway}</foreach>
</if> </if>
<if test="org_id!=null and org_ids==null">and p.org_id=#{org_id}</if> <if test="trade_type != null">
<if test="org_ids!=null">and p.org_id in AND o.gateway IN
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach> <foreach collection="trade_type" item="gateway" open="(" close=")" separator=",">
#{gateway}
</foreach>
</if> </if>
<if test="from!=null">and o.create_time &gt;= #{from}</if> <if test="org_id != null and org_ids == null">
<if test="to!=null">and o.create_time &lt; #{to}</if> AND p.org_id = #{org_id}
<if test="date!=null">and date(o.create_time)=date(#{date})</if>
<if test="dev_id!=null">and o.dev_id=#{dev_id}</if>
<if test="status!=null">
and
<foreach collection="status" item="std" open="(" close=")" separator=" or ">o.status=#{std}</foreach>
</if> </if>
<if test="channel!=null"> <if test="org_ids != null">
and AND p.org_id IN
<foreach collection="channel" item="chan" open="(" close=")" separator=" or ">o.channel=#{chan} <foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">
#{org_id}
</foreach> </foreach>
</if> </if>
<if test="bd_group!=null">and p.client_id in <if test="from != null">
(SELECT b.client_id FROM sys_client_bd b AND o.create_time &gt;= #{from}
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id </if>
where b.is_valid=1 and b.start_date&lt;=now() and (b.end_date is null or b.end_date &gt;= now()) <if test="to != null">
AND (c.bd_group=#{bd_group} or c.manager_id=#{bd_group}) AND o.create_time &lt; #{to}
<if test="bd_group_bd">and c.manager_id=#{bd_group_bd}</if> </if>
<if test="date != null">
AND DATE(o.create_time) = DATE(#{date})
</if>
<if test="dev_id != null">
AND o.dev_id = #{dev_id}
</if>
<if test="status != null">
AND
<foreach collection="status" item="std" open="(" close=")" separator=" or ">
o.status = #{std}
</foreach>
</if>
<if test="channel != null">
AND
<foreach collection="channel" item="chan" open="(" close=")" separator=" or ">
o.channel = #{chan}
</foreach>
</if>
<if test="bd_group != null">
AND p.client_id IN(
SELECT b.client_id
FROM sys_client_bd b
INNER JOIN financial_bd_config c
ON c.manager_id = b.bd_id
WHERE b.is_valid = 1
AND b.start_date &lt;= now()
AND (b.end_date is null or b.end_date &gt;= now())
AND (c.bd_group = #{bd_group} or c.manager_id = #{bd_group})
<if test="bd_group_bd">
AND c.manager_id = #{bd_group_bd}
</if>
) )
</if> </if>
</where> </where>
GROUP BY o.order_id,t.refund_id GROUP BY o.order_id, t.refund_id
<if test="bd_user!=null"> <if test="bd_user != null">
) temp ) temp
INNER JOIN sys_client_bd d ON temp.client_id = d.client_id AND d.bd_id = #{bd_user} and d.is_valid=1 INNER JOIN sys_client_bd d
AND date(d.start_date) &lt;= date(now()) ON temp.client_id = d.client_id
AND (d.end_date is null or date(d.end_date) &gt;= date(now())) AND d.bd_id = #{bd_user}
AND d.is_valid = 1
AND DATE(d.start_date) &lt;= DATE(now())
AND (d.end_date IS NULL OR DATE(d.end_date) &gt;= DATE(now()))
</if> </if>
</select> </select>

@ -7,7 +7,7 @@
<ul class="nav nav-pills"> <ul class="nav nav-pills">
<li ng-class="{active:ctrl.channel==null}"> <li ng-class="{active:ctrl.channel==null}">
<a role="button" ng-click="ctrl.channel=null;channelAndDayOfAnalysis()" title="All"> <a role="button" ng-click="ctrl.channel=null;channelAndDayOfAnalysis()" title="All">
<img src="/static/images/rpayplus_sign_lg.png"> <img src="/static/images/royalpay_sign.png">
</a> </a>
</li> </li>
<li ng-class="{active:ctrl.channel=='Wechat'}" ng-if="report.channels.Wechat"> <li ng-class="{active:ctrl.channel=='Wechat'}" ng-if="report.channels.Wechat">

Loading…
Cancel
Save