add 非主流渠道统计

master
luoyang 5 years ago
parent dc05490ba9
commit 6f65cfd464

@ -13,6 +13,8 @@ public interface CustomersAnalysisService {
JSONObject getChannelAmountAnalysis(JSONObject params);
JSONObject getCBBankChannelAmountAnalysis(JSONObject params);
JSONObject getCustomersRanking(JSONObject params, int page, int limit);
JSONObject getCustomersTotal(JSONObject params);

@ -28,6 +28,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -73,6 +74,24 @@ public class CustomersAnalysisServiceImp implements CustomersAnalysisService {
return customerAndOrdersStatisticsMapper.getChannelCommonCount(params);
}
@Override
public JSONObject getCBBankChannelAmountAnalysis(JSONObject params) {
JSONObject result = new JSONObject();
List<String> channels = new ArrayList<>();
if (params.get("channel") == null) {
channels.add("Bestpay");
channels.add("Yeepay");
channels.add("Rpay");
channels.add("hf");
channels.add("jd");
channels.add("LakalaPay");
params.put("channels", channels);
}
result.put("channels", customerAndOrdersStatisticsMapper.getCBBankChannelAmount(params));
result.put("counts", customerAndOrdersStatisticsMapper.getCBBankChannelCommonCount(params));
return result;
}
@Override
public JSONObject getCustomersRanking(JSONObject params, int page, int limit) {
PageList<JSONObject> logs = orderAnalysisMapper.listCustomersData(params, new PageBounds(page, limit, Order.formString("amount.desc")));

@ -50,6 +50,10 @@ public interface CustomerAndOrdersStatisticsMapper {
JSONObject getChannelCommonCount(JSONObject params);
List<JSONObject> getCBBankChannelAmount(JSONObject params);
JSONObject getCBBankChannelCommonCount(JSONObject params);
JSONObject getCommonCount(JSONObject params);
@CountRef(".countAreaMerchantTradeAnalysis")

@ -74,6 +74,21 @@ public class CustomersAnalysisController {
return customersAnalysisService.getChannelAmountAnalysis(params);
}
@ManagerMapping("/sys/cbbank_channel")
public JSONObject getCBBankChannelAnalysis(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject params = analysis.toParams(null);
if (manager.getInteger("org_id") != null) {
params.put("org_id", manager.getIntValue("org_id"));
}
if (analysis.isOnlyGroup() && ManagerRole.BD_LEADER.hasRole(manager.getIntValue("role"))) {
params.put("bd_group", manager.getString("manager_id"));
if (analysis.getGroup_bd()>0){
params.put("bd_group_bd",analysis.getGroup_bd());
}
}
return customersAnalysisService.getCBBankChannelAmountAnalysis(params);
}
@ManagerMapping(value = "/ranking/{openid_type}",role = ManagerRole.DEVELOPER)
public JSONObject getCustomersRanking(@PathVariable int openid_type, AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject params = analysis.toParams(null);

@ -364,6 +364,45 @@
</where>
</select>
<select id="getCBBankChannelAmount" resultType="com.alibaba.fastjson.JSONObject">
SELECT count(distinct client_id) clients,channel,
SUM(IF(transaction_type='Credit',clearing_amount,0)) gross_amount,
SUM(IF(transaction_type='Debit',clearing_amount,0)) refund_amount,
SUM(IF(transaction_type='Credit',total_surcharge,-total_surcharge)) total_surcharge,
SUM(IF(transaction_type='Credit',channel_surcharge,-channel_surcharge)) channel_surcharge,
SUM(IF(transaction_type='Credit',royal_surcharge,-royal_surcharge)) royal_surcharge,
SUM(IF(transaction_type='Credit',clearing_amount,-clearing_amount)) amount
FROM pmt_transactions WHERE
channel IN ('Bestpay','Yeepay','Rpay','hf','jd','LakalaPay')
<if test="begin!=null">and create_time &gt;= #{begin}</if>
<if test="end!=null">and create_time &lt; #{end}</if>
GROUP BY channel
</select>
<select id="getCBBankChannelCommonCount" resultType="com.alibaba.fastjson.JSONObject">
select
ifnull(SUM(IF(channel='Bestpay' and transaction_type='Credit',1,0)),0) bestpay_order_count,
ifnull(SUM(IF(channel='Bestpay' and transaction_type='Credit',clearing_amount,0)),0) bestpayamount,
ifnull(SUM(IF(channel='Yeepay' and transaction_type='Credit',1,0)),0) yeepay_order_count,
ifnull(SUM(IF(channel='Yeepay' and transaction_type='Credit',clearing_amount,0)),0) yeepayamount,
ifnull(SUM(IF(channel='Rpay' and transaction_type='Credit',1,0)),0) rpay_order_count,
ifnull(SUM(IF(channel='Rpay' and transaction_type='Credit',clearing_amount,0)),0) rpayamount,
ifnull(SUM(IF(channel='hf' and transaction_type='Credit',1,0)),0) hf_order_count,
ifnull(SUM(IF(channel='hf' and transaction_type='Credit',clearing_amount,0)),0) hfamount,
ifnull(SUM(IF(channel='jd' and transaction_type='Credit',1,0)),0) jd_order_count,
ifnull(SUM(IF(channel='jd' and transaction_type='Credit',clearing_amount,0)),0) jdamount,
ifnull(SUM(IF(channel='LakalaPay' and transaction_type='Credit',1,0)),0) lakala_order_count,
ifnull(SUM(IF(channel='LakalaPay' and transaction_type='Credit',clearing_amount,0)),0) lakalapayamount,
count(distinct order_id) all_count,
count(distinct client_id) all_client_count,
ifnull(SUM(IF(transaction_type='Credit',clearing_amount,0)),0) all_amount
FROM pmt_transactions WHERE
channel IN
('Bestpay','Yeepay','Rpay','hf','jd','LakalaPay')
<if test="begin!=null">and create_time &gt;= #{begin}</if>
<if test="end!=null">and create_time &lt; #{end}</if>
</select>
<select id="getCommonCount" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
select

@ -368,6 +368,11 @@ margin-bottom: 10%;"/>
<i class="fa fa-area-chart"></i> <span>交易金额分析</span>
</a>
</li>
<li ui-sref-active="active" ng-if="(currentUser.org_id==null || currentUser.org_id==1)">
<a ui-sref="cbbank_channel_trans_analysis" ui-sref-opts="{reload:true}">
<i class="fa fa-area-chart"></i> <span>CBBank渠道交易统计</span>
</a>
</li>
</ul>
</li>

@ -0,0 +1,201 @@
<style>
.cen table {
text-align: center;
}
.cen table th {
text-align: center;
}
.channel .col-sm-2 {
border: 1px solid #d2d6de;
border-left: 0;
}
</style>
<!--<section class="content-header">
<h1>Transaction Data</h1>
<ol class="breadcrumb">
<li>
<i class="fa fa-list-alt"></i> Analysis
</li>
<li class="active">Transaction Data</li>
</ol>
</section>-->
<div class="content">
<div class="row">
<div class="col-sm-12">
<div class="box-solid">
<div class="box box-warning">
<div class="box-header">
<div class="row">
<div class="col-sm-12">
<div class="form-horizontal">
<div class="form-group col-xs-12">
<label class="control-label col-xs-4 col-sm-2">Date Range</label>
<div class="col-sm-10">
<div class="form-control-static form-inline">
<div style="display: inline-block">
<input class="form-control" id="date-from-input"
ng-model="params.begin"
uib-datepicker-popup size="10" placeholder="From"
is-open="dateBegin.open" ng-click="dateBegin.open=true"
datepicker-options="{maxDate:params.end||today}">
</div>
~
<div style="display: inline-block">
<input class="form-control" id="date-to-input" ng-model="params.end"
uib-datepicker-popup size="10" placeholder="To"
is-open="dateTo.open" ng-click="dateTo.open=true"
datepicker-options="{minDate:params.begin,maxDate:today}">
</div>
<!--<div class="btn-group">
<a role="button" class="btn btn-default btn-sm"
ng-click="chooseToday()">Today</a>
</div>-->
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm"
ng-click="chooseYesterday()">Yesterday</a>
</div>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm"
ng-click="chooseLast7Days()">Last 7 Days</a>
</div>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm"
ng-click="thisMonth()">This Month</a>
</div>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm"
ng-click="lastMonth()">Last Month</a>
</div>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm"
ng-click="thisYear()">This Year</a>
</div>
<button class="btn btn-success" type="button" ng-click="doAnalysis()">
<i class="fa fa-search"></i>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="box box-warning" ng-if="currentUser.org==null">
<div class="box-header with-border">CBBank 各平台交易总额
<div class="description-text" style="display: inline-block;float: right;">
<label class="description-text text-red">交易金额{{ totalChannel.all_amount|currency: ' $ ' }}</label>
<label class="description-text text-red">交易笔数:{{ totalChannel.all_count }}</label>
<label class="description-text text-red">交易商户数:{{ totalChannel.all_client_count }}</label>
</div>
</div>
<div class="box-body table-responsive channel">
<div class="row">
<div class="col-sm-4 col-xs-6">
<div class="description-block">
<div class="description-header text-bold"><img src="/static/images/bestpay_sign.png"/>Bestpay</div>
<div class="description-text">
<label class="description-text text-red"
ng-bind="totalChannel.bestpayamount|currency: ' $ '"></label></br>
<label class="description-text text-red">交易笔数:{{ totalChannel.bestpay_order_count }}</label>
</div>
</div>
</div>
<div class="col-sm-4 col-xs-6">
<div class="description-block">
<div class="description-header text-bold"><img src="/static/images/jd_sign.png"/>JD Pay</div>
<div class="description-text">
<label class="description-text text-red"
ng-bind="totalChannel.jdamount|currency: ' $ '"></label></br>
<label class="description-text text-red">交易笔数:{{ totalChannel.jd_order_count }}</label>
</div>
</div>
</div>
<div class="col-sm-4 col-xs-6">
<div class="description-block">
<div class="description-header text-bold"><img src="/static/images/hf_sign.png"/>HF Pay</div>
<div class="description-text">
<label class="description-text text-red"
ng-bind="totalChannel.hfamount|currency: ' $ '"></label></br>
<label class="description-text text-red">交易笔数:{{ totalChannel.hf_order_count }}</label>
</div>
</div>
</div>
</div>
<div class="row">
<!-- 显示Rpay+交易额分析-->
<div class="col-sm-4 col-xs-6">
<div class="description-block">
<div class="description-header text-bold"><img src="/static/images/rpayplus_sign.png"/>RPay+</div>
<div class="description-text">
<label class="description-text text-red"
ng-bind="totalChannel.rpayamount|currency: ' $ '"></label></br>
<label class="description-text text-red">交易笔数:{{ totalChannel.rpay_order_count }}</label>
</div>
</div>
</div>
<div class="col-sm-4 col-xs-6">
<div class="description-block">
<div class="description-header text-bold"><img src="/static/images/yeepay_sign.png"/>Yeepay</div>
<div class="description-text">
<label class="description-text text-red"
ng-bind="totalChannel.yeepayamount|currency: ' $ '"></label></br>
<label class="description-text text-red">交易笔数:{{ totalChannel.yeepay_order_count }}</label>
</div>
</div>
</div>
<div class="col-sm-4 col-xs-6">
<div class="description-block">
<div class="description-header text-bold"><small><img src="/static/images/lakalapay_sign.png"/>LakalaPay</small></div>
<div class="description-text">
<label class="description-text text-red"
ng-bind="totalChannel.lakalapayamount|currency: ' $ '"></label></br>
<label class="description-text text-red">交易笔数:{{ totalChannel.lakala_order_count }}</label>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="box box-warning">
<div class="box box-default">
<div class="box-header">CBBank Channel logs</div>
<div class="box-body table-responsive">
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th>Channel Name</th>
<th>交易商户数</th>
<th>付款金额</th>
<th>退款金额</th>
<th>净交易额</th>
<th>总手续费</th>
<th>成本手续费</th>
<th>平台手续费</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="channel in ChannelAmount">
<td ng-bind="channel.channel"></td>
<td ng-bind="channel.clients"></td>
<td ng-bind="channel.gross_amount|currency:''"></td>
<td ng-bind="channel.refund_amount|currency:''"></td>
<td ng-bind="channel.amount|currency:''"></td>
<td ng-bind="channel.total_surcharge|currency:''"></td>
<td ng-bind="channel.channel_surcharge|currency:''"></td>
<td ng-bind="channel.royal_surcharge|currency:''"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

@ -18,6 +18,10 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts'], function (angul
url: '/amountRangeAnalysis',
templateUrl: '/static/analysis/templates/transaction_amount_Analysis.html',
controller: 'transactionAmountCtrl'
}).state('cbbank_channel_trans_analysis', {
url: '/cbbanktrans_analysis',
templateUrl: '/static/analysis/templates/cbbank_channel_trans_analysis.html',
controller: 'cbbankTransAnalysisCtrl'
})
}]);
@ -364,5 +368,74 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts'], function (angul
}]);
app.controller('cbbankTransAnalysisCtrl', ['$scope', '$http', '$filter', '$timeout', 'commonDialog', 'chartParser',
function ($scope, $http, $filter, $timeout, commonDialog, chartParser) {
$scope.params = {};
$scope.today = new Date(new Date().getTime() - 24*60*60*1000);
$scope.chooseToday = function () {
$scope.params.begin = $scope.params.end = new Date();
$scope.doAnalysis(1);
};
$scope.chooseYesterday = function () {
var yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
$scope.params.begin = $scope.params.end = yesterday;
$scope.doAnalysis(1);
};
$scope.chooseLast7Days = function () {
$scope.params.end = new Date(new Date().getTime() - 24*60*60*1000);
var day = new Date();
day.setDate(day.getDate() - 8);
$scope.params.begin = day;
$scope.doAnalysis(1);
};
$scope.thisMonth = function () {
$scope.params.end = new Date(new Date().getTime() - 24*60*60*1000);
var monthBegin = new Date();
monthBegin.setDate(1);
$scope.params.begin = monthBegin;
$scope.doAnalysis(1);
};
$scope.lastMonth = function () {
var monthFinish = new Date();
monthFinish.setDate(0);
$scope.params.end = monthFinish;
var monthBegin = new Date();
monthBegin.setDate(0);
monthBegin.setDate(1);
$scope.params.begin = monthBegin;
$scope.doAnalysis(1);
};
$scope.thisYear = function () {
var yearFinish = new Date(new Date().getTime() - 24*60*60*1000);
$scope.params.end = yearFinish;
var currentYearFirstDate = new Date(new Date().getFullYear(), 0, 1);
$scope.params.begin = currentYearFirstDate;
$scope.doAnalysis(1);
};
$scope.doAnalysis = function () {
if ($scope.params.channel == 'All') {
$scope.params.channel = null;
}
var params = angular.copy($scope.params);
if (params.begin) {
params.begin = $filter('date')(params.begin, 'yyyyMMdd');
} else {
params.begin = $filter('date')(new Date(), 'yyyyMMdd');
}
if (params.end) {
params.end = $filter('date')(params.end, 'yyyyMMdd');
} else {
params.end = $filter('date')(new Date(), 'yyyyMMdd');
}
$http.get('/analysis/customers/sys/cbbank_channel', {params: params}).then(function (resp) {
$scope.ChannelAmount = resp.data.channels;
$scope.totalChannel = resp.data.counts;
});
};
$scope.chooseLast7Days();
}]);
return app;
});

@ -182,6 +182,16 @@
</div>
</a>
</div>
<div ng-if="(currentUser.org_id==null || currentUser.org_id==1)" class="col-sm-2 col-xs-6">
<a ui-sref="cbbank_channel_trans_analysis" ui-sref-opts="{reload:true}">
<div class="description-block">
<img src="/static/images/main_menu/transaction_original_statistics.png"/>
<div class="description-text">
<span class="description-text">CBBank渠道交易统计</span>
</div>
</div>
</a>
</div>
</div>
</div>
<div class="list-group" ng-if="role=='riskmanager'">

Loading…
Cancel
Save