二级组织费率限制

master
yuan 7 years ago
parent 8bacdb61ea
commit bf9a4f81e0

@ -57,7 +57,7 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
res.put("new_partners", clientAnalysisMapper.countNewClients(params));
res.put("total_partners", clientAnalysisMapper.countClients(params));
res.put("traded_partners", clientAnalysisMapper.countTradedPartners(params));
res.put("trade_amount", transactionAnalysisMapper.analysisTotalAmount(params));
res.put("trade_amount", transactionAnalysisMapper.getClientTransaction(params).getBigDecimal("trade_amount"));
// res.put("trade_count", transactionAnalysisMapper.analysisTotalCount(params));
// List<JSONObject> topOrders = transactionAnalysisMapper.getTopOrders(params, new PageBounds(1, 1, Order.formString("aud_fee.desc")));
// if (!topOrders.isEmpty()) {
@ -75,7 +75,7 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
// res.put("total_partners", clientAnalysisMapper.countClients(params));
// res.put("traded_partners", clientAnalysisMapper.countTradedPartners(params));
// res.put("trade_amount", transactionAnalysisMapper.analysisTotalAmount(params));
res.put("trade_count", transactionAnalysisMapper.analysisTotalCount(params));
res.put("trade_count", transactionAnalysisMapper.getClientTransaction(params).getIntValue("trade_count"));
List<JSONObject> topOrders = transactionAnalysisMapper.getTopOrders(params, new PageBounds(1, 1, Order.formString("aud_fee.desc")));
if (!topOrders.isEmpty()) {
res.put("top_amount_order", topOrders.get(0));
@ -212,7 +212,10 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
@Override
public List<JSONObject> getTradeAnalysisInDays(JSONObject params) {
return transactionAnalysisMapper.tradeAnalysisInDays(params);
if (!params.containsKey("client_ids") && !params.containsKey("org_id")) {
params.put("client_id", 0);
}
return customerAndOrdersStatisticsMapper.getSumCustomersAnalysis(params);
}
@Override
@ -227,9 +230,10 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
}
JSONObject res = new JSONObject();
params.put("client_id", partner.getIntValue("client_id"));
res.put("trade_amount", transactionAnalysisMapper.analysisTotalAmount(params));
res.put("trade_count", transactionAnalysisMapper.analysisTotalCount(params));
res.put("refund_amount", transactionAnalysisMapper.analysisRefundAmount(params));
JSONObject object = transactionAnalysisMapper.getClientTransaction(params);
res.put("trade_amount", object.getBigDecimal("trade_amount"));
res.put("trade_count", object.getIntValue("trade_count"));
res.put("refund_amount", object.getBigDecimal("refund_amount"));
res.put("not_settled", transactionAnalysisMapper.analysisNotSettled(params));
res.put("pre_amount", transactionAnalysisMapper.analysisPreAmount(params));
List<JSONObject> topOrders = transactionAnalysisMapper.getTopOrders(params, new PageBounds(1, 1, Order.formString("aud_fee.desc")));

@ -1,9 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="au.com.royalpay.payment.manage.analysis.mappers.BDAnalysisMapper">
<!--1.BD analysis BD销售量 BD销售数据统计
2.BD analysis BD销售量 导出表格-->
<select id="getBDSaleList" resultType="com.alibaba.fastjson.JSONObject">
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,d.bd_id,sum(if(temp.transaction_type='Credit',temp.clearing_amount*d.proportion,0))
total,
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
FROM
@ -36,9 +38,11 @@
GROUP BY d.bd_id
ORDER BY total DESC
</select>
<!--1.BD analysis BD销售量 商户销售排行
2.BD analysis BD销售量 导出表格每个BD 的商户)-->
<select id="getBDSalePartnerList" resultType="com.alibaba.fastjson.JSONObject">
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,0)),0)
total FROM (SELECT l.client_id,l.clearing_amount,l.transaction_type,l.refund_id,o.create_time FROM
pmt_transactions l
INNER JOIN pmt_orders o
@ -153,10 +157,11 @@
group by bd_id
order by num desc
</select>
<!--1.BD analysis BD销售量 商户类别交易量分布-->
<select id="getBDSalePartnerReport" resultType="com.alibaba.fastjson.JSONObject">
SELECT c.industry,c.royalpayindustry,
count(DISTINCT c.client_id) partner_counts,
IFNULL(sum(if(temp.transaction_type='Credit',temp.clearing_amount*d.proportion,-temp.clearing_amount*d.proportion)),0)
IFNULL(sum(if(temp.transaction_type='Credit',temp.clearing_amount*d.proportion,0)),0)
total
FROM (SELECT l.client_id,l.clearing_amount,l.transaction_type,l.refund_id,o.create_time FROM pmt_transactions l
INNER JOIN pmt_orders o

@ -84,10 +84,13 @@
GROUP BY date(o.create_time)
</select>
<!-- 1.Dashboard前十商户交易额aud_fee
2.GateWay统计 总交易排行-->
<!--已修改-->
<select id="listPartnersTradeAmount" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT
p.client_moniker,p.short_name,ifnull(sum(if(t.transaction_type='Credit',t.clearing_amount,-t.clearing_amount)),0)aud_fee,
p.client_moniker,p.short_name,ifnull(sum(if(t.transaction_type='Credit',t.clearing_amount,0)),0)aud_fee,
count(DISTINCT t.order_id) orders,max(t.clearing_amount)max_order,ifnull(sum(if(t.refund_id is not null,if(t.transaction_type='Debit',t.clearing_amount,-t.clearing_amount),0)),0)refund_amount,
ifnull(sum(if(t.refund_id is not null and t.transaction_type='Debit',1,0)),0)refund_orders,max(if(t.refund_id is not null and t.transaction_type='Debit',t.clearing_amount,0))max_refund
FROM sys_clients p

@ -57,6 +57,8 @@
</where>
</select>
<!--1.交易数据(月统计)交易量变化趋势 -->
<!--不修改 -->
<select id="getSumCustomersAnalysisMonthly" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT sum(s.customers) customers,sum(s.orders) orders,sum(s.new_customers) new_customers,
@ -91,6 +93,12 @@
GROUP BY trade_date ORDER BY date DESC
</select>
<!--1.交易数据(日统计) 交易量变化趋势
2.消费者统计
3.商户端 Customers Analysis Per customer transaction trends
4.商户端 Transaction Analysis Trading amount trends
5.Dashboard交易额趋势(aud_fee)-->
<!--不修改 -->
<select id="getSumCustomersAnalysis" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT sum(s.customers) customers,sum(s.orders) orders,sum(s.new_customers) new_customers,
@ -124,7 +132,8 @@
</where>
GROUP BY s.date ORDER BY date DESC
</select>
<!--Transaction analysis 支付通道 -->
<!--不修改-->
<select id="getSumChannelAnalysis" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT ifnull(sum(s.orders),0) orders,
@ -176,9 +185,10 @@
</where>
</select>-->
<!--1.交易数据(日统计)(月统计) 各平台交易总额 -->
<!--已修改 -->
<select id="getSumCustomersChannelAnalysis" resultType="com.alibaba.fastjson.JSONObject">
SELECT SUM(IF(t.transaction_type = 'Credit', t.clearing_amount, -t.clearing_amount)) AS total_amount
SELECT SUM(IF(t.transaction_type = 'Credit', t.clearing_amount,0)) AS total_amount
FROM pmt_transactions t
<where>
t.transaction_time >= #{begin}
@ -260,6 +270,8 @@
</if>
</select>
<!--Transaction analysis 支付通道 -->
<!--不要修改 -->
<select id="countChannel" resultType="com.alibaba.fastjson.JSONObject">
SELECT
ifnull(sum(s.orders),0) orders,

@ -196,9 +196,11 @@
]]>
</select>
<!--1.消费排名列表 -->
<!--已修改 -->
<select id="listCustomersData" resultType="com.alibaba.fastjson.JSONObject">
SELECT o.customer_id,sum(if(t.transaction_type='Credit',t.clearing_amount,-t.clearing_amount)) amount,
sum(if(t.transaction_type='Credit',t.clearing_amount div 10,-(t.clearing_amount div 10))) points,
SELECT o.customer_id,sum(if(t.transaction_type='Credit',t.clearing_amount,0)) amount,
sum(if(t.transaction_type='Credit',t.clearing_amount div 10,0)) points,
COUNT(DISTINCT o.order_id) orders,max(t.clearing_amount) max_order
FROM pmt_orders o
INNER JOIN pmt_transactions t on t.order_id=o.order_id and t.system_generate=0 and (t.transaction_type='Credit' or t.transaction_type>0)
@ -227,9 +229,11 @@
GROUP BY o.customer_id ORDER BY points desc
</select>
<!--1.消费排名 Total Amount -->
<!--已修改-->
<select id="listCustomersDataAnalysis" resultType="com.alibaba.fastjson.JSONObject">
SELECT sum(if(t.transaction_type='Credit',t.clearing_amount,-t.clearing_amount)) total_amount,
sum(if(t.transaction_type='Credit',t.clearing_amount div 10,-(t.clearing_amount div 10))) total_points
SELECT sum(if(t.transaction_type='Credit',t.clearing_amount,0)) total_amount,
sum(if(t.transaction_type='Credit',t.clearing_amount div 10,0)) total_points
FROM pmt_orders o
INNER JOIN pmt_transactions t on t.order_id=o.order_id and t.system_generate=0 and (t.transaction_type='Credit' or t.refund_id is not null)
<where>

@ -17,10 +17,11 @@
ORDER BY transaction_time
LIMIT 1;
</select>
<!--1.partner card 标题-->
<!--已修改 -->
<select id="getTransactionCommonAnalysis" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT ifnull(sum(if(t.transaction_type = 'Credit',t.clearing_amount,-t.clearing_amount)), 0) total_amount,
SELECT ifnull(sum(if(t.transaction_type = 'Credit' ,t.clearing_amount,0)), 0) total_amount,
ifnull(sum(if(t.transaction_type = 'Credit' and t.refund_id is null,1,0)), 0) total_count,
ifnull(sum(if(t.refund_id is not null,if(t.transaction_type = 'Debit',t.clearing_amount,-t.clearing_amount),0)), 0) refund_amount,
ifnull(sum(if(t.clearing_status != 1,if(t.transaction_type = 'Credit',t.clearing_amount,-t.clearing_amount),0)), 0) notsettle_amount,
@ -34,7 +35,11 @@
</if>
</where>
</select>
<!--1.Dashboard标题交易额移动至getClientTransaction
2 商户端 Dashboard 标题 交易额 移动至getClientTransaction
3.BD analysis bd提成
4./api/v1.0/retail/app 移动至getClientTransaction-->
<!--不修改 -->
<select id="analysisTotalAmount" resultType="java.math.BigDecimal">
<![CDATA[
SELECT ifnull(sum(if(l.transaction_type = 'Credit',l.clearing_amount,-l.clearing_amount)), 0)
@ -56,7 +61,10 @@
<if test="org_ids!=null">and l.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
</select>
<!--1.Dashboard交易笔数 移动至getClientTransaction
2./api/v1.0/retail/app 移动至getClientTransaction
2.商户端 dashboard 交易笔数移动至getClientTransaction-->
<!--不修改-->
<select id="analysisTotalCount" resultType="java.lang.Double">
<![CDATA[
SELECT ifnull(count(DISTINCT l.order_id), 0)
@ -80,6 +88,7 @@
</if>
</select>
<!--1.商户端 dashboard退款金额 移动至getClientTransaction-->
<select id="analysisRefundAmount" resultType="java.lang.Double">
<![CDATA[
SELECT ifnull(sum(if(l.transaction_type='Debit',l.clearing_amount,-l.clearing_amount)), 0)
@ -99,7 +108,8 @@
</if>
</select>
<!--商户端 dashboard 未清算金额-->
<!--不修改-->
<select id="analysisNotSettled" resultType="java.lang.Double">
<![CDATA[
SELECT ifnull(sum(if(transaction_type = 'Credit', clearing_amount, -clearing_amount)), 0)
@ -117,6 +127,8 @@
</if>
</select>
<!--商户端 dashboard 预授权金额 -->
<!--不修改-->
<select id="analysisPreAmount" resultType="java.lang.Double">
<![CDATA[
SELECT ifnull(sum(l.clearing_amount), 0)
@ -136,7 +148,9 @@
</if>
</select>
<!--1.Dashboard最大交易额订单(aud_fee)
2.商户端 Dashboard最大交易额订单-->
<!-- 不修改-->
<select id="getTopOrders" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT
@ -169,6 +183,9 @@
]]>
</select>
<!--1.Dashboard交易类型分布-交易量
2.partner card 交易类型分布-交易量-->
<!-- 已修改-->
<select id="getTradeAmountInTypes" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT
@ -198,7 +215,7 @@
WHEN 11
THEN 'Share Code'
END AS gateway_label,
ifnull(sum(if(l.transaction_type='Credit',l.clearing_amount,-l.clearing_amount)), 0) aud_fee
ifnull(sum(if(l.transaction_type='Credit',l.clearing_amount,0)), 0) aud_fee
FROM pmt_transactions l
INNER JOIN pmt_orders o ON o.order_id = l.order_id
WHERE (l.transaction_type = 'Credit' or l.refund_id is not null)
@ -211,11 +228,15 @@
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
GROUP BY gateway_label
</select>
<!--1.交易数据(日统计)交易时间分布
2.商户端 Dashboard Trading distribution chart
3.partner card Transaction Time Analysis-->
<!-- 已修改-->
<select id="tradeAnalysisInHours" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT h, round(sum(count)/datediff(#{end},#{begin}),1) count, round(sum(aud_fee)/datediff(#{end},#{begin}),2) aud_fee
FROM(
SELECT HOUR(o.create_time) h, DATE(o.create_time) dt, sum(if(l.transaction_type='Credit' and l.refund_id is null,1,0)) count, ifnull(sum(if(l.transaction_type='Credit',l.clearing_amount,-l.clearing_amount)), 0) aud_fee
SELECT HOUR(o.create_time) h, DATE(o.create_time) dt, sum(if(l.transaction_type='Credit' and l.refund_id is null,1,0)) count, ifnull(sum(if(l.transaction_type='Credit',l.clearing_amount,0)), 0) aud_fee
FROM pmt_transactions l
inner join pmt_orders o on o.order_id = l.order_id
WHERE (l.transaction_type='Credit' or l.refund_id is not null)
@ -252,11 +273,14 @@
order by h
]]>
</select>
<!-- 1.Dashboard交易额趋势(aud_fee)(已不用)
2.generateReport方法名-->
<!--已修改 -->
<select id="tradeAnalysisInDays" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT
date_format(o.create_time, '%Y-%m-%d') date_str,
ifnull(sum(if(l.transaction_type = 'Credit', l.clearing_amount, -l.clearing_amount)), 0) aud_fee,
ifnull(sum(if(l.transaction_type = 'Credit', l.clearing_amount, 0)), 0) aud_fee,
ifnull(sum(if(l.transaction_type='Credit' and l.refund_id is null,1,0)),0) order_count
FROM pmt_transactions l
INNER JOIN pmt_orders o ON o.order_id = l.order_id AND o.create_time >= #{begin} AND o.create_time <= #{end}
@ -279,11 +303,13 @@
ORDER BY date(o.create_time)
]]>
</select>
<!--1.商户端 Dashboard Trading trends-->
<!--已修改 -->
<select id="tradeAnalysisInDay" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT
date_format(#{end}, '%Y-%m-%d') date_str,
ifnull(sum(if(l.transaction_type = 'Credit', l.clearing_amount, -l.clearing_amount)), 0) aud_fee,
ifnull(sum(if(l.transaction_type = 'Credit', l.clearing_amount,0)), 0) aud_fee,
ifnull(sum(if(l.transaction_type='Credit' and l.refund_id is null,1,0)),0) order_count
FROM pmt_transactions l
INNER JOIN pmt_orders o ON o.order_id = l.order_id AND o.create_time >= #{begin} AND o.create_time <= #{end}
@ -416,7 +442,9 @@
o.create_time < #{date} and o.status>=5
]]>
</select>
<!--1.Dashboard 交易类型分布-商户数量
2.gataway统计 各交易类型商家数量分布(家)-->
<!-- 不修改-->
<select id="getTradePartnersInTypes" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT
@ -466,9 +494,11 @@
GROUP BY gateway_label
</select>
<!--1.getaWay统计 交易方式商户排名 -->
<!--已修改 -->
<select id="getPartnersByTradeType" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT c.short_name ,ifnull(SUM(if(l.transaction_type = 'Credit',l.clearing_amount,-l.clearing_amount)), 0) total
SELECT c.short_name ,ifnull(SUM(if(l.transaction_type = 'Credit',l.clearing_amount,0)), 0) total
FROM pmt_transactions l
INNER JOIN pmt_orders o ON o.order_id = l.order_id
left JOIN sys_clients c on c.client_id=o.client_id AND c.is_valid=1
@ -542,6 +572,8 @@
<!--</if>-->
<!--<if test="org_id!=null">and l.org_id=#{org_id}</if>-->
<!--</select>-->
<!--1.Dashboard交易时间分布(order_total) -->
<!-- 不修改-->
<select id="getOrdersByGateway" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT po.create_time,
@ -631,9 +663,12 @@
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
GROUP BY date , channel ORDER BY date DESC
</select>
<!--1.合伙人 合伙人销量 各组织机构交易量分布
2.generateReportWeekReporter-->
<!--已修改-->
<select id="getOrgTransactionAnalysis" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT o.org_id, o.name org_name,sum(if(t.transaction_type='Credit',t.clearing_amount,-t.clearing_amount)) amount
SELECT o.org_id, o.name org_name,sum(if(t.transaction_type='Credit',t.clearing_amount,0)) amount
FROM pmt_transactions t
INNER JOIN pmt_orders ord on ord.order_id = t.order_id
RIGHT JOIN sys_clients c on t.client_id = c.client_id and c.is_valid = 1
@ -647,9 +682,11 @@
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
GROUP BY o.org_id order by amount desc
</select>
<!--1.合伙人 合伙人销量 合伙人商户交易量排名 -->
<!--已修改-->
<select id="getPartnersAmountByOrg" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT c.client_moniker,c.short_name,sum(if(t.transaction_type='Credit',t.clearing_amount,-t.clearing_amount)) amount
SELECT c.client_moniker,c.short_name,sum(if(t.transaction_type='Credit',t.clearing_amount,0)) amount
FROM pmt_transactions t
INNER JOIN pmt_orders ord on ord.order_id = t.order_id
RIGHT JOIN sys_clients c on t.client_id = c.client_id and c.is_valid = 1 AND c.org_id = #{org_id}
@ -660,9 +697,11 @@
GROUP BY c.client_id order by amount desc
</select>
<!-- (1)Dashboard支付通道交易额订单数-->
<!-- 已修改-->
<select id="getPlatformAmount" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT ifnull(sum(if(l.transaction_type = 'Credit',l.clearing_amount,-l.clearing_amount)), 0) amount,
SELECT ifnull(sum(if(l.transaction_type = 'Credit',l.clearing_amount,0)), 0) amount,
ifnull(count(DISTINCT l.order_id), 0) order_count
FROM pmt_transactions l
INNER JOIN pmt_orders o ON o.order_id = l.order_id AND o.create_time >= #{begin} AND
@ -696,7 +735,8 @@
<if test="amount_to!=null">and t.clearing_amount &lt; #{amount_to}</if>
</select>
<!--1.交易金额分析 交易订单列表-->
<!--不更改 -->
<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
FROM pmt_transactions t
@ -711,6 +751,8 @@
<if test="amount_to!=null">and t.clearing_amount &lt; #{amount_to}</if>
</select>
<!--交易金额分析 饼图 -->
<!--不更改-->
<select id="getAmountRangeAnalysis" resultType="com.alibaba.fastjson.JSONObject">
select
sum(if(t.clearing_amount &gt;= 0 and t.clearing_amount &lt; 20,1,0)) amount0_20,
@ -732,14 +774,19 @@
<if test="channel!=null">and t.channel=#{channel}</if>
</select>
<!--1.Dashboard标题交易额
2.Dashboard 交易笔数
3.商户端 交易额,交易笔数 退款金额
4./api/v1.0/retail/app-->
<!--新增接口-->
<select id="getClientTransaction" resultType="com.alibaba.fastjson.JSONObject">
select
IFNULL(sum(if(l.transaction_type='credit',l.clearing_amount,0)),0) trade_amount,
ifnull(sum(if(l.refund_id>0,l.clearing_amount,0)),0) refund_amount,
sum(if(l.transaction_type='Credit',1,0)) trade_count,
sum(if(l.refund_id>0,1,0)) refund_orders,
sum(if(l.refund_id>0,1,0)) refund_orders
FROM pmt_transactions l
where l.channel!='Settlement' and t.system_generate=0
where l.channel!='Settlement' and l.system_generate=0
<if test="client_ids!=null">
AND l.client_id IN
<foreach collection="client_ids" open="(" close=")" separator="," item="client_id">
@ -749,8 +796,8 @@
<if test="client_ids==null and client_id != null">
and l.client_id=#{client_id}
</if>
<if test="begin!=null">and l.transaction &gt;= #{begin}</if>
<if test="end!=null">and l.transaction &lt; #{end}</if>
<if test="begin!=null">and l.transaction_time &gt;= #{begin}</if>
<if test="end!=null">and l.transaction_time &lt; #{end}</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
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>

@ -131,6 +131,8 @@
]]>
</update>
<!--1.交易流水列表 -->
<!--不修改-->
<select id="listOrders" resultType="com.alibaba.fastjson.JSONObject">
<if test="bd_user!=null">
SELECT temp.* FROM (
@ -248,7 +250,9 @@
GROUP BY o.order_id,t.refund_id
order by o.create_time
</select>
<!-- 1.商户管理订单列表
2.商户端 Orders列表-->
<!--不修改 -->
<select id="listOrdersByClients" resultType="com.alibaba.fastjson.JSONObject">
<if test="gateway">
<include refid="gateway_keys"/>
@ -326,10 +330,13 @@
GROUP BY o.order_id,t.refund_id
</select>
<!--1.交易流水交易金额
2.商户端 Orders 标题交易金额-->
<!--已修改-->
<select id="analysisOrders" resultType="com.alibaba.fastjson.JSONObject">
select
count(DISTINCT l.order_id) order_count,
ifnull(sum(if(l.transaction_type='Credit' and l.refund_id is null,l.clearing_amount,0)),0) paid_fee,
ifnull(sum(if(l.transaction_type='Credit',l.clearing_amount,0)),0) paid_fee,
ifnull(sum(if(l.refund_id is not null,if(l.transaction_type='Debit',-l.clearing_amount,l.clearing_amount),0)),0)
refund_fee,
ifnull(sum(if(l.refund_id is not null AND l.pre_authorization=1,l.clearing_amount,0)),0)
@ -499,6 +506,8 @@
WHERE o.customer_id = #{customer_id} and t.transaction_time &gt;= '2017-11-07'
</select>
<!--1.消费排名 用户列表(单个用户) -->
<!--不修改-->
<select id="listOrderByCustomer" resultType="com.alibaba.fastjson.JSONObject">
SELECT o.*,c.short_name,c.client_moniker FROM pmt_orders o
LEFT JOIN sys_clients c on c.client_id = o.client_id

@ -36,6 +36,8 @@
</where>
</select>
<!--1.Transactions 交易列表-->
<!--不修改-->
<select id="listTransFlow" resultType="com.alibaba.fastjson.JSONObject">
SELECT t.*,
ifnull(o.client_order_id,'--') client_order_id,
@ -77,7 +79,8 @@
</where>
order by t.transaction_time desc
</select>
<!--1.Transactions 标题金额 -->
<!--不修改-->
<select id="analysisTransFlow" resultType="com.alibaba.fastjson.JSONObject">
SELECT
count(t.transaction_id) order_count,
@ -158,6 +161,7 @@
FROM pmt_transactions
WHERE clearing_status = 0 AND client_id = #{client_id}
</select>
<!--1.商户端 Settlement 标题 -->
<select id="getClientAmountAnalysis" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT
@ -228,6 +232,7 @@
ORDER BY t.transaction_type, t.transaction_time
]]>
</select>
<!--1.商户端Settlement 列表 -->
<select id="listSettlementLog" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT t.client_id,DATE(t.transaction_time) clearing_time,SUM(t.clearing_amount) total,
@ -423,6 +428,8 @@
WHERE t.transaction_type = 'Credit' OR t.refund_id IS NOT NULL
ORDER BY t.order_id ASC
</select>
<!--1.BD analysis BD提成 生成报表 -->
<!--不修改-->
<select id="listTransactionsForBDPrize" resultType="com.alibaba.fastjson.JSONObject">
SELECT
sum(if(t.transaction_type = 'Credit', t.clearing_amount, -t.clearing_amount))
@ -516,7 +523,8 @@
GROUP BY so.org_id, trade_date,t.client_id
ORDER BY c.org_id ASC, t.client_id ASC, trade_date ASC
</select>
<!--1.合伙人,合伙人提成 generateOrgCommission -->
<!--不修改-->
<select id="listTransactionsForAgentCommission" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT

@ -444,15 +444,21 @@ define(['angular', 'uiRouter', 'uiBootstrap', 'angularEcharts'], function (angul
type: 'category',
boundaryGap: false
},
key: 'date_str'
key: 'trade_date'
},
series: [
{
basic: {type: 'line', label: {normal: {show: true}}, showAllSymbols: true},
column: {key: 'aud_fee'}
column: {key: 'total'}
}
]
};
params.end = new Date();
var day = new Date();
day.setDate(day.getDate() - 7);
params.begin = day;
params.begin = $filter('date')(params.begin, 'yyyyMMdd');
params.end = $filter('date')(params.end, 'yyyyMMdd');
$http.get('/dashboard/system/fee_analysis', {params: params}).then(function (resp) {
$scope.analysis.trade_line = chartParser.parse(analysisConfig, resp.data);
})

Loading…
Cancel
Save