From 7bae85821915382dd386ad9a6dd6791e7a24777a Mon Sep 17 00:00:00 2001 From: duLingLing Date: Fri, 22 Nov 2019 11:57:10 +0800 Subject: [PATCH] =?UTF-8?q?Upd:=E5=AE=8C=E5=96=84=E6=B8=85=E7=AE=97?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=B8=85=E7=AE=97=E6=B1=87=E6=80=BBExcel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/impls/ClientManagerImpl.java | 14 ++- .../web/PartnerManageController.java | 1 + .../core/impls/TradeLogServiceImpl.java | 14 ++- .../static/payment/partner/partner-manage.js | 93 ++++++++++++++++--- .../partner/templates/partner_settlement.html | 16 +++- .../tradelog/partner-settlement-log.js | 15 ++- .../templates/partner_settlement_logs.html | 2 +- 7 files changed, 134 insertions(+), 21 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index d3e797415..7aed67259 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -3707,14 +3707,19 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid 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); params.put("client_id", client_id); PageList logs = transactionMapper.listSettlementLog(params, new PageBounds(query.getPage(), 10000, Order.formString("clearing_time.desc"))); //Excel 多sheet导出 try (HSSFWorkbook workbook = new HSSFWorkbook()) { - addSheet(0,workbook,client,logs); - List childs = clientMapper.listChildClients(client.getIntValue("client_id")); - if(childs.size()>0){ + if(query.getClient_ids() ==null){ + addSheet(0,workbook,client,logs); + List childs = clientMapper.listChildClients(client.getIntValue("client_id")); for (int i=0;i 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); } } + }else{ + JSONObject chlidClient = clientMapper.findClient(Integer.parseInt(query.getClient_ids()[0])); + addSheet(0,workbook,chlidClient,logs); } String fileName = "Settlement Log - "+ (query.getDatefrom() + "~" + query.getDateto() ); response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xls"); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java index 4cc473907..b829c9597 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java @@ -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.core.ClientManager; 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.pos.datasource.ReadOnlyConnection; import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery; diff --git a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java index 0997627f3..1f1fe29ac 100644 --- a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java @@ -957,14 +957,19 @@ public class TradeLogServiceImpl implements TradeLogService { JSONObject client = clientManager.getClientInfoByMoniker(partner.getString("client_moniker")); int clientId = partner.getIntValue("client_id"); 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); params.put("client_id", clientId); PageList logs = transactionMapper.listSettlementLog(params, new PageBounds(query.getPage(), query.getLimit(), Order.formString("clearing_time.desc"))); try (HSSFWorkbook workbook = new HSSFWorkbook()) { - addSheet(0,workbook,client,logs); - List childs = clientMapper.listChildClients(client.getIntValue("client_id")); - if(childs.size()>0){ + if(query.getClient_ids() ==null){ + addSheet(0,workbook,client,logs); + List childs = clientMapper.listChildClients(client.getIntValue("client_id")); for (int i=0;i 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); } } + }else{ + JSONObject chlidClient = clientMapper.findClient(Integer.parseInt(query.getClient_ids()[0])); + addSheet(0,workbook,chlidClient,logs); } String fileName = "Settlement Log - "+ (query.getDatefrom() + "~" + query.getDateto() ); response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xls"); diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index 3a6d2503f..f30b1ff25 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -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) { $scope.params = {}; $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.params.datefrom = $scope.params.dateto = new Date(); $scope.loadSettlementLogs(1); @@ -4112,16 +4193,6 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter 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(); }]); app.controller('partnerSurchargeAccountCtrl', ['$scope', '$uibModal', '$http', 'clientMoniker', '$filter', function ($scope, $uibModal, $http, clientMoniker, $filter) { diff --git a/src/main/ui/static/payment/partner/templates/partner_settlement.html b/src/main/ui/static/payment/partner/templates/partner_settlement.html index eab91a3d2..681a96237 100644 --- a/src/main/ui/static/payment/partner/templates/partner_settlement.html +++ b/src/main/ui/static/payment/partner/templates/partner_settlement.html @@ -50,6 +50,20 @@ +
+ +
+

+ All + +

+
+
@@ -61,7 +75,7 @@
diff --git a/src/main/ui/static/payment/tradelog/partner-settlement-log.js b/src/main/ui/static/payment/tradelog/partner-settlement-log.js index 3bdbe2b6e..c2caaad00 100644 --- a/src/main/ui/static/payment/tradelog/partner-settlement-log.js +++ b/src/main/ui/static/payment/tradelog/partner-settlement-log.js @@ -98,15 +98,26 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) { $scope.analysis = resp.data.analysis; }); }; - $scope.excelSettlementLogs = function(){ + $scope.excelSettlementAllLogs = function(){ var params = angular.copy($scope.params); + var url = '/client/trans_flow/settlement/log/excelAll'; + 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; } - 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); diff --git a/src/main/ui/static/payment/tradelog/templates/partner_settlement_logs.html b/src/main/ui/static/payment/tradelog/templates/partner_settlement_logs.html index 058bea611..681c6860e 100644 --- a/src/main/ui/static/payment/tradelog/templates/partner_settlement_logs.html +++ b/src/main/ui/static/payment/tradelog/templates/partner_settlement_logs.html @@ -127,7 +127,7 @@ - EXCEL + Export Settlement Summary