Upd:完善清算导出清算汇总Excel

master
duLingLing 5 years ago
parent 5cf5935f06
commit 7bae858219

@ -3707,14 +3707,19 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
query.setDateto(DateFormatUtils.format(new Date(), "yyyyMMdd")); query.setDateto(DateFormatUtils.format(new Date(), "yyyyMMdd"));
} }
} }
if(query.getClient_ids()!=null){
if(query.getClient_ids().length>1){
query.setClient_ids(null);
}
}
JSONObject params = query.toParams(timezone); JSONObject params = query.toParams(timezone);
params.put("client_id", client_id); params.put("client_id", client_id);
PageList<JSONObject> logs = transactionMapper.listSettlementLog(params, new PageBounds(query.getPage(), 10000, Order.formString("clearing_time.desc"))); PageList<JSONObject> logs = transactionMapper.listSettlementLog(params, new PageBounds(query.getPage(), 10000, Order.formString("clearing_time.desc")));
//Excel 多sheet导出 //Excel 多sheet导出
try (HSSFWorkbook workbook = new HSSFWorkbook()) { try (HSSFWorkbook workbook = new HSSFWorkbook()) {
addSheet(0,workbook,client,logs); if(query.getClient_ids() ==null){
List<JSONObject> childs = clientMapper.listChildClients(client.getIntValue("client_id")); addSheet(0,workbook,client,logs);
if(childs.size()>0){ List<JSONObject> childs = clientMapper.listChildClients(client.getIntValue("client_id"));
for (int i=0;i<childs.size();i++){ for (int i=0;i<childs.size();i++){
params.put("client_id", childs.get(i).getInteger("client_id")); params.put("client_id", childs.get(i).getInteger("client_id"));
PageList<JSONObject> childLogs = transactionMapper.listSettlementLog(params, new PageBounds(query.getPage(), 10000, Order.formString("clearing_time.desc"))); PageList<JSONObject> childLogs = transactionMapper.listSettlementLog(params, new PageBounds(query.getPage(), 10000, Order.formString("clearing_time.desc")));
@ -3722,6 +3727,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
addSheet(i+1,workbook, childs.get(i),childLogs); addSheet(i+1,workbook, childs.get(i),childLogs);
} }
} }
}else{
JSONObject chlidClient = clientMapper.findClient(Integer.parseInt(query.getClient_ids()[0]));
addSheet(0,workbook,chlidClient,logs);
} }
String fileName = "Settlement Log - "+ (query.getDatefrom() + "~" + query.getDateto() ); String fileName = "Settlement Log - "+ (query.getDatefrom() + "~" + query.getDateto() );
response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xls"); response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xls");

@ -4,6 +4,7 @@ import au.com.royalpay.payment.manage.dev.core.MerchantLocationService;
import au.com.royalpay.payment.manage.merchants.beans.*; import au.com.royalpay.payment.manage.merchants.beans.*;
import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.manage.permission.manager.PartnerMapping;
import au.com.royalpay.payment.manage.permission.manager.RequireManager; import au.com.royalpay.payment.manage.permission.manager.RequireManager;
import au.com.royalpay.payment.manage.pos.datasource.ReadOnlyConnection; import au.com.royalpay.payment.manage.pos.datasource.ReadOnlyConnection;
import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery; import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;

@ -957,14 +957,19 @@ public class TradeLogServiceImpl implements TradeLogService {
JSONObject client = clientManager.getClientInfoByMoniker(partner.getString("client_moniker")); JSONObject client = clientManager.getClientInfoByMoniker(partner.getString("client_moniker"));
int clientId = partner.getIntValue("client_id"); int clientId = partner.getIntValue("client_id");
String timezone = partner.getJSONObject("client").getString("timezone"); String timezone = partner.getJSONObject("client").getString("timezone");
if(query.getClient_ids()!=null){
if(query.getClient_ids().length>1){
query.setClient_ids(null);
}
}
JSONObject params = query.toParams(timezone); JSONObject params = query.toParams(timezone);
params.put("client_id", clientId); params.put("client_id", clientId);
PageList<JSONObject> logs = transactionMapper.listSettlementLog(params, PageList<JSONObject> logs = transactionMapper.listSettlementLog(params,
new PageBounds(query.getPage(), query.getLimit(), Order.formString("clearing_time.desc"))); new PageBounds(query.getPage(), query.getLimit(), Order.formString("clearing_time.desc")));
try (HSSFWorkbook workbook = new HSSFWorkbook()) { try (HSSFWorkbook workbook = new HSSFWorkbook()) {
addSheet(0,workbook,client,logs); if(query.getClient_ids() ==null){
List<JSONObject> childs = clientMapper.listChildClients(client.getIntValue("client_id")); addSheet(0,workbook,client,logs);
if(childs.size()>0){ List<JSONObject> childs = clientMapper.listChildClients(client.getIntValue("client_id"));
for (int i=0;i<childs.size();i++){ for (int i=0;i<childs.size();i++){
params.put("client_id", childs.get(i).getInteger("client_id")); params.put("client_id", childs.get(i).getInteger("client_id"));
PageList<JSONObject> childLogs = transactionMapper.listSettlementLog(params, new PageBounds(query.getPage(), 10000, Order.formString("clearing_time.desc"))); PageList<JSONObject> childLogs = transactionMapper.listSettlementLog(params, new PageBounds(query.getPage(), 10000, Order.formString("clearing_time.desc")));
@ -972,6 +977,9 @@ public class TradeLogServiceImpl implements TradeLogService {
addSheet(i+1,workbook, childs.get(i),childLogs); addSheet(i+1,workbook, childs.get(i),childLogs);
} }
} }
}else{
JSONObject chlidClient = clientMapper.findClient(Integer.parseInt(query.getClient_ids()[0]));
addSheet(0,workbook,chlidClient,logs);
} }
String fileName = "Settlement Log - "+ (query.getDatefrom() + "~" + query.getDateto() ); String fileName = "Settlement Log - "+ (query.getDatefrom() + "~" + query.getDateto() );
response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xls"); response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xls");

@ -4047,8 +4047,89 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
app.controller('partnerSettlementCtrl', ['$scope', '$uibModal', '$http', 'clientMoniker', '$filter', function ($scope, $uibModal, $http, clientMoniker, $filter) { app.controller('partnerSettlementCtrl', ['$scope', '$uibModal', '$http', 'clientMoniker', '$filter', function ($scope, $uibModal, $http, clientMoniker, $filter) {
$scope.params = {}; $scope.params = {};
$scope.pagination = {}; $scope.pagination = {};
$scope.today = new Date(); $scope.clients = [];
$scope.showLevel3Clients = false;
$scope.isLevel3All = true;
$scope.clinet = {};
$scope.isAll = true;
$scope.initClientInfo = function(){
$http.get('/sys/partners/'+clientMoniker).then(function (resp) {
$scope.client = resp.data
$scope.clients = [$scope.client];
if ($scope.client.has_children) {
$scope.params.client_ids = [$scope.client.client_id];
$http.get('/sys/partners/'+clientMoniker+'/sub_clients').then(function (resp) {
var clientList = resp.data;
clientList.forEach(function (client) {
$scope.clients.push(client);
});
$scope.clientIds = [];
$scope.clients.forEach(function (client) {
$scope.clientIds.push(client.client_id);
if (client.level3Clients) {
client.level3Clients.forEach(function (level3Client) {
$scope.clientIds.push(level3Client.client_id);
});
}
});
$scope.params.client_ids = angular.copy($scope.clientIds);
$scope.loadSettlementLogs(1);
})
}
});
}
$scope.initClientInfo();
$scope.exportSettlementLogs = function() {
var params = angular.copy($scope.params);
var url = '/sys/partners/'+clientMoniker+'/lists_settlements/excel';
var connectSymbol = '?';
if (params.datefrom) {
params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd');
url += connectSymbol + 'datefrom=' + params.datefrom;
connectSymbol = '&';
}
if (params.dateto) {
params.dateto = $filter('date')(params.dateto, 'yyyyMMdd');
url += connectSymbol + 'dateto=' + params.dateto;
}
if (params.client_ids){
params.client_ids.forEach(function (i) {
url += connectSymbol + 'client_ids=' + i;
connectSymbol = '&';
});
}
return url;
};
$scope.chooseClient = function (client) {
if (client == 'all') {
$scope.params.client_ids = angular.copy($scope.clientIds);
$scope.isAll = true;
$scope.chooseClientId = '';
$scope.showLevel3Clients = false;
} else if (client.level3Clients) {
$scope.chooseClientId = client.client_id;
$scope.showLevel3Clients = true;
$scope.level3Clients = client.level3Clients;
$scope.isAll = false;
$scope.level3ClientIds = [];
$scope.level3ClientIds.push(client.client_id);
client.level3Clients.forEach(function (client) {
$scope.level3ClientIds.push(client.client_id);
});
$scope.chooseLevel3Client("all");
return;
} else {
$scope.chooseClientId = client.client_id;
$scope.params.client_ids = [client.client_id];
$scope.isAll = false;
$scope.showLevel3Clients = false;
}
$scope.loadSettlementLogs();
};
$scope.today = new Date();
$scope.chooseToday = function () { $scope.chooseToday = function () {
$scope.params.datefrom = $scope.params.dateto = new Date(); $scope.params.datefrom = $scope.params.dateto = new Date();
$scope.loadSettlementLogs(1); $scope.loadSettlementLogs(1);
@ -4112,16 +4193,6 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
size: 'lg' size: 'lg'
}); });
}; };
$scope.excelSettlementLogs = function(){
var params = angular.copy($scope.params);
if (params.datefrom) {
params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd');
}
if (params.dateto) {
params.dateto = $filter('date')(params.dateto, 'yyyyMMdd');
}
return '/sys/partners/'+clientMoniker+'/lists_settlements/excel?datefrom='+params.datefrom+'&dateto='+params.dateto
}
$scope.chooseLast7Days(); $scope.chooseLast7Days();
}]); }]);
app.controller('partnerSurchargeAccountCtrl', ['$scope', '$uibModal', '$http', 'clientMoniker', '$filter', function ($scope, $uibModal, $http, clientMoniker, $filter) { app.controller('partnerSurchargeAccountCtrl', ['$scope', '$uibModal', '$http', 'clientMoniker', '$filter', function ($scope, $uibModal, $http, clientMoniker, $filter) {

@ -50,6 +50,20 @@
</div> </div>
</div> </div>
</div> </div>
<div class="form-group col-xs-12" ng-if="client.has_children">
<label class="control-label col-xs-4 col-sm-2">Sub Partner</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':isAll}"
ng-click="chooseClient('all')">All</a>
<label ng-repeat="sub in clients">
|&nbsp;<a role="button"
ng-class="{'bg-primary':sub.client_id==chooseClientId}"
ng-click="chooseClient(sub)">{{sub.short_name}}</a>&nbsp;
</label>
</p>
</div>
</div>
<button class="btn btn-success" type="button" ng-click="loadSettlementLogs(1)"> <button class="btn btn-success" type="button" ng-click="loadSettlementLogs(1)">
<i class="fa fa-search"></i> Search <i class="fa fa-search"></i> Search
</button> </button>
@ -61,7 +75,7 @@
<div class="box box-warning"> <div class="box box-warning">
<div class="box-header"> <div class="box-header">
<h3 class="box-title">Clearing Logs</h3> <h3 class="box-title">Clearing Logs</h3>
<a ng-if="settlementLogs.length>0" target="_blank" style="float: right" ng-href="{{excelSettlementLogs()}}"> <i class="fa fa-download"></i>EXCEL</a> <a ng-if="settlementLogs.length>0" target="_blank" style="float: right" ng-href="{{exportSettlementLogs()}}"> <i class="fa fa-download"></i>Export Settlement Summary</a>
</div> </div>
<div class="box-body table-responsive"> <div class="box-body table-responsive">
<table class="table table-bordered table-hover table-striped"> <table class="table table-bordered table-hover table-striped">

@ -98,15 +98,26 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
$scope.analysis = resp.data.analysis; $scope.analysis = resp.data.analysis;
}); });
}; };
$scope.excelSettlementLogs = function(){ $scope.excelSettlementAllLogs = function(){
var params = angular.copy($scope.params); var params = angular.copy($scope.params);
var url = '/client/trans_flow/settlement/log/excelAll';
var connectSymbol = '?';
if (params.datefrom) { if (params.datefrom) {
params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd'); params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd');
url += connectSymbol + 'datefrom=' + params.datefrom;
connectSymbol = '&';
} }
if (params.dateto) { if (params.dateto) {
params.dateto = $filter('date')(params.dateto, 'yyyyMMdd'); params.dateto = $filter('date')(params.dateto, 'yyyyMMdd');
url += connectSymbol + 'dateto=' + params.dateto;
} }
return '/client/trans_flow/settlement/log/excelAll?datefrom='+params.datefrom+'&dateto='+params.dateto if (params.client_ids){
params.client_ids.forEach(function (i) {
url += connectSymbol + 'client_ids=' + i;
connectSymbol = '&';
});
}
return url;
} }
$scope.loadSettlementLogs(1); $scope.loadSettlementLogs(1);

@ -127,7 +127,7 @@
</span><i style="cursor:pointer;" class="glyphicon glyphicon-warning-sign text-yellow small" </span><i style="cursor:pointer;" class="glyphicon glyphicon-warning-sign text-yellow small"
uib-tooltip-html="htmlTooltip"></i> uib-tooltip-html="htmlTooltip"></i>
</h3> </h3>
<a ng-if="settlementLogs.length>0" target="_blank" style="float: right" ng-href="{{excelSettlementLogs()}}"> <i class="fa fa-download"></i>EXCEL</a> <a ng-if="settlementLogs.length>0" target="_blank" style="float: right" ng-href="{{excelSettlementAllLogs()}}"> <i class="fa fa-download"></i>Export Settlement Summary</a>
</div> </div>
<div class="box-body table-responsive"> <div class="box-body table-responsive">
<table class="table table-bordered table-hover table-striped alignCen"> <table class="table table-bordered table-hover table-striped alignCen">

Loading…
Cancel
Save