From 623ec31c91761611f7492c9b02f2a2b84c78d58e Mon Sep 17 00:00:00 2001 From: luoyang Date: Wed, 13 Nov 2019 18:19:31 +0800 Subject: [PATCH 1/3] =?UTF-8?q?add=20=E8=AE=A2=E5=8D=95=E6=9D=A5=E6=BA=90?= =?UTF-8?q?=20source=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index f4271e834..61d66e2cd 100644 --- a/pom.xml +++ b/pom.xml @@ -5,11 +5,11 @@ au.com.royalpay.payment payment-parent - 1.1.5 + 1.1.6 4.0.0 manage - 1.2.82 + 1.2.83 UTF-8 1.4.0 From d6074bc055520bdc4c3ec6cf18b08369c142b9d8 Mon Sep 17 00:00:00 2001 From: luoyang Date: Thu, 14 Nov 2019 09:57:01 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix=20source=5Fagree=5Ffile=20=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../manage/mappers/system/ClientFilesMapper.java | 2 ++ .../manage/merchants/core/ClientManager.java | 2 ++ .../merchants/core/impls/ClientManagerImpl.java | 14 +++++++++++--- .../merchants/web/PartnerManageController.java | 2 +- .../manage/mappers/system/ClientFilesMapper.xml | 6 ++++++ 6 files changed, 23 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 61d66e2cd..c6167da35 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 manage - 1.2.83 + 1.2.84 UTF-8 1.4.0 diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.java index 78894f1bc..9d16b9fcc 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.java @@ -40,6 +40,8 @@ public interface ClientFilesMapper { List findFileByClientAndType(@Param("client_id") int client_id, @Param("file_name") String file_name); + JSONObject getSourceAgreeFilesByClientId(@Param("client_id") int clientId); + void deleteByClientAndFileId(@Param("file_id") String file_id); void deleteAggreeByClientId(@Param("client_id") int file_id); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java index 17bbd4737..5df0a155e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java @@ -242,6 +242,8 @@ public interface ClientManager { JSONObject getAllAuthFiles(JSONObject manager, String clientMoniker); + JSONObject getSourceAgreeFiles(JSONObject manage, String clientMoniker); + void deleteAuthFiles(String fileId); void deleteAuthFilesByAdmin(String fileId); 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 e58eae0a9..093c6de17 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 @@ -3353,6 +3353,17 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid return fileJson; } + @Override + public JSONObject getSourceAgreeFiles(JSONObject manage, String clientMoniker) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + JSONObject sourceFile = clientFilesMapper.getSourceAgreeFilesByClientId(client.getIntValue("client_id")); + sourceFile.put(sourceFile.getString("file_name"), sourceFile.getString("file_value")); + return sourceFile; + } + @Override public JSONObject getAllAuthFiles(JSONObject manager, String clientMoniker) { JSONObject client = getClientInfoByMoniker(clientMoniker); @@ -3382,7 +3393,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid return fileJson; } - @Override public JSONObject getClientViewAuthFiles(JSONObject manager, String clientMoniker) { JSONObject client = getClientInfoByMoniker(clientMoniker); @@ -3414,8 +3424,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } - ; - @Override public void deleteAuthFiles(String fileId) { JSONObject file = clientFilesMapper.findFileById(fileId); 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 d88feea7e..fe64de521 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 @@ -538,7 +538,7 @@ public class PartnerManageController { @ManagerMapping(value = "/{clientMoniker}/file/source_agree_file", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.BD_USER, ManagerRole.SERVANT}) public JSONObject getSourceAgreeAuthFiles(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { - return clientManager.getAuthFiles(manager, clientMoniker); + return clientManager.getSourceAgreeFiles(manager, clientMoniker); } @ManagerMapping(value = "/auth_file/{fileId}/delete", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.BD_USER}) diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.xml index c8967b6bf..6977ee40a 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.xml @@ -13,6 +13,12 @@ update sys_files set is_valid = 0 where file_id = #{file_id} + + + + + + @@ -396,6 +585,8 @@ count(DISTINCT l.client_id) clients, ifnull(sum(if(l.transaction_type='Credit' and l.refund_id is null and l.currency!='CNY',l.display_amount,0)),0) display_amount, + ifnull(sum(if(l.transaction_type='Credit' and l.refund_id is null and l.currency!='CNY',l.incremental_surcharge,0)),0) + incremental_surcharge, ifnull(sum(if(l.transaction_type='Credit' and l.refund_id is null and l.currency!='CNY' and l.pre_authorization=1,l.display_amount,0)),0) pre_display_amount, ifnull(sum(if(l.transaction_type='Credit' and l.refund_id is null and l.currency='CNY',l.display_amount,0)),0) @@ -475,6 +666,10 @@ o.channel=#{chan} + + and + o.source=#{source} + 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 diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml index 99175a97a..b12b9714b 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml @@ -96,7 +96,7 @@ + + + + + + + + + +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ + +
+
+ +
+

+ All | + Wechat Pay | + Alipay | + AlipayOnline + | + BestPay | + JD Pay | + HF Pay | + RPay + | + Yeepay | + LakalaPay +

+
+
+
+ +
+
+
+ +
+ ~ +
+ +
+ +
+ Today +
+
+ Yesterday +
+ + + +
+ +
+
+ +
+

+ All + +

+
+
+ +
+ + + + + + +
+
+
+
+
+ +
+ Transaction Amount + + ( {{analysis.order_count}} Orders ) +
+
+
+
+
+ +
+ Input Amount + + ( {{analysis.pre_display_amount | currency:'pre authorization '}} ) +
+
+
+
+
+ +
+ Input Amount + + + ( {{analysis.pre_display_amount | currency:'pre authorization '}} ) + + + + ( {{analysis.pre_cny_display_amount | currency:'pre authorization '}} ) + +
+
+
+
+
+ +
+ Refund Amount + + + ({{analysis.pre_refund_fee|currency:'pre authorization '}}) + +
+
+
+
+
+ +
+ Merchants + + +
+
+
+
+
+ +
+ Incremental Surcharge + +
+
+
+
+
+
+
+
+

Trade Orders + Pre Authorization: +

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PartnerOrder IDAmountInput AmountSystem RateSystem ProfitYangMaTou RateYangMaTou ProfitStatusCreate TimeOperation
+ + {{trade.short_name}}({{trade.client_moniker}}) + + + + + + + + + + + + + + + {{trade.order_id}} + + {{trade.total_amount|currency:trade.currency}} + (-{{trade.refund_fee}}) + {{(trade.surcharge_rate * 100 - trade.rate_value)| number : 2}}%{{(trade.total_surcharge-trade.incremental_surcharge) | number : 2 | currency:trade.currency}}{{trade.source}}:{{(trade.rate_value) | number : 2}}%{{trade.source}}:{{trade.incremental_surcharge | currency:trade.currency}} + + + +
+ +
+
+ +
+
Total Records:{{pagination.totalCount}};Total + Pages:{{pagination.totalPages}} +
+
+
+
+ + + + diff --git a/src/main/ui/static/payment/tradelog/templates/partner_incremental_trade_logs.html b/src/main/ui/static/payment/tradelog/templates/partner_incremental_trade_logs.html new file mode 100644 index 000000000..ac8b711f6 --- /dev/null +++ b/src/main/ui/static/payment/tradelog/templates/partner_incremental_trade_logs.html @@ -0,0 +1,387 @@ + +
+

Incremental Orders

+ +
+
+
+

{{order.display_amount|currency:order.currency+' '}} Paid + Success!

+

Pay Time:{{order.pay_time_local}}

+
+
+
+
+
+
+
+
+
+ +
+ + +
+
+ +
+

+ All | + Wechat Pay | + Alipay | + AlipayOnline | + BestPay | + JD Pay | + HF Pay | + RPay+ | + Yeepay | + LakalaPay +

+
+
+
+ +
+
+
+ +
+ ~ +
+ +
+ +
+ Today +
+
+ Yesterday +
+ + + +
+ +
+ +
+
+ +
+

+ All + +

+
+
+
+ +
+

+ All + +

+
+
+ +
+
+
+
+
+
+
+
+
+
+ +
+ Transaction Amount + + ( {{analysis.order_count}} Orders ) +
+
+
+ +
+
+ +
+ Input Amount + + ( {{analysis.pre_display_amount | currency:'pre authorization '}} ) +
+
+
+
+
+ +
+ Input Amount + + + ( {{analysis.pre_display_amount | currency:'pre authorization '}} ) + + + + ( {{analysis.pre_cny_display_amount | currency:'pre authorization '}} ) + +
+
+
+
+
+ +
+ Refund Amount + + + ({{analysis.pre_refund_fee|currency:'pre authorization '}}) + +
+
+
+
+
+ +
+ Incremental Surcharge + + +
+
+
+
+
+
+
+
+

Orders

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Client Order IDOrder IDAmountInput AmountSystem RateSystem ProfitIncremental RateIncremental ProfitStatusCreate TimeOperation
+ + + + + + + BestPay + Alipay + AlipayOnline + + + + + + {{trade.order_id}} + + {{trade.total_amount|currency:trade.currency+' '}} + (-{{trade.refund_fee}}) + {{(trade.surcharge_rate * 100 - trade.rate_value)| number : 2}}%{{(trade.total_surcharge-trade.incremental_surcharge) | number : 2 | currency:trade.currency}}{{trade.source}}:{{(trade.rate_value) | number : 2}}%{{trade.source}}:{{trade.incremental_surcharge | currency:trade.currency}}{{0.00 | currency:trade.currency}} + + + + +
+ +
+ +
+
+
+
+
diff --git a/src/main/ui/static/payment/tradelog/templates/partner_trade_logs.html b/src/main/ui/static/payment/tradelog/templates/partner_trade_logs.html index 8b1c3f72b..ad16da97c 100644 --- a/src/main/ui/static/payment/tradelog/templates/partner_trade_logs.html +++ b/src/main/ui/static/payment/tradelog/templates/partner_trade_logs.html @@ -109,6 +109,19 @@ ng-model="params.searchText"> +
+ +
+

+ All | + System | + YangMaTou +

+
+
@@ -406,6 +419,8 @@ + + BestPay @@ -416,7 +431,7 @@ - {{trade.order_id}} + {{trade.order_id}} {{trade.total_amount|currency:trade.currency+' '}} diff --git a/src/main/ui/static/payment/tradelog/templates/trade_logs.html b/src/main/ui/static/payment/tradelog/templates/trade_logs.html index 5b33d2b14..77b3ec4f9 100644 --- a/src/main/ui/static/payment/tradelog/templates/trade_logs.html +++ b/src/main/ui/static/payment/tradelog/templates/trade_logs.html @@ -142,6 +142,19 @@
--> +
+ +
+

+ All | + System | + YangMaTou +

+
+
@@ -449,6 +462,10 @@ + + - {{trade.order_id}} + {{trade.order_id}} {{trade.total_amount|currency:trade.currency}} diff --git a/src/main/ui/static/payment/tradelog/tradelog-manage.js b/src/main/ui/static/payment/tradelog/tradelog-manage.js index 77b5e54e7..7cbde9a45 100644 --- a/src/main/ui/static/payment/tradelog/tradelog-manage.js +++ b/src/main/ui/static/payment/tradelog/tradelog-manage.js @@ -13,11 +13,15 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) { url: '/refundReview', templateUrl: '/static/payment/tradelog/templates/refund_review.html', controller: 'refundReviewCtrl' + }).state('incremental_trade', { + url: '/incrementalTrade', + templateUrl: '/static/payment/tradelog/templates/incremental_trade_logs.html', + controller: 'globalIncrementalTradeLogCtrl' }) }]); - app.controller('globalTradeLogCtrl', ['$scope', '$http', '$filter', 'commonDialog', 'refunder', 'orderService', - function ($scope, $http, $filter, commonDialog, refunder, orderService) { - $scope.params = {status: 'PAID',channel:'ALL', textType: 'all', datefrom: new Date(), dateto: new Date(),org_name:'ALL'}; + app.controller('globalTradeLogCtrl', ['$scope', '$http', '$filter', 'commonDialog', 'refunder', 'orderService','$sce', + function ($scope, $http, $filter, commonDialog, refunder, orderService,$sce) { + $scope.params = {source: 'ALL',status: 'PAID',channel:'ALL', textType: 'all', datefrom: new Date(), dateto: new Date(),org_name:'ALL'}; $scope.pagination = {}; $scope.today = new Date(); @@ -127,6 +131,7 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) { } $http.get('/sys/trade_logs', {params: params}).then(function (resp) { $scope.tradeLogs = resp.data.data; + $scope.htmlToolst(); $scope.pagination = resp.data.pagination; $scope.analysis = resp.data.analysis; $scope.analysis.refund_fee = angular.copy(Math.abs($scope.analysis.refund_fee)); @@ -167,6 +172,30 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) { $scope.$on('order_refunded', function () { $scope.loadTradeLogs(); }); + + $scope.htmlToolst = function(){ + for(var i=0;i< $scope.tradeLogs.length;i++){ + var tax_amount = $scope.tradeLogs[i].tax_amount; + var total_surcharge= $scope.tradeLogs[i].total_surcharge; + var incremental_surcharge = $scope.tradeLogs[i].incremental_surcharge; + var total_amount = $scope.tradeLogs[i].total_amount; + var display_amount = $scope.tradeLogs[i].display_amount; + var source = $scope.tradeLogs[i].source; + var system_surcharge = (total_surcharge-incremental_surcharge).toFixed(2); + var tip = '
' + + '
手续费组成
'+'
'+ + '

system:'+ system_surcharge +'

' + + '

'+ source +':'+incremental_surcharge +'

'; + if(total_surcharge < (total_amount-display_amount).toFixed(2)){ + tip = tip +'

tax amount:'+ tax_amount +'

'; + } + tip = tip + '
'; + $scope.tradeLogs[i].htmlTooltip = $sce.trustAsHtml(tip); + } + } + + + } ]); app.controller('refundReviewCtrl', ['$rootScope', '$scope', '$http', '$state', '$filter', '$uibModal', 'commonDialog', 'orderService', @@ -295,6 +324,134 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) { }); }; }]); + app.controller('globalIncrementalTradeLogCtrl', ['$scope', '$http', '$filter', 'commonDialog', 'refunder', 'orderService','$sce', + function ($scope, $http, $filter, commonDialog, refunder, orderService,$sce) { + $scope.params = {source: 'yangmatou',status: 'PAID',channel:'ALL', textType: 'all', datefrom: new Date(), dateto: new Date(),org_name:'ALL'}; + $scope.pagination = {}; + $scope.today = new Date(); + + if (($scope.currentUser.role & parseInt('1000000000', 2)) > 0 && $scope.currentUser.org_id) { + $http.get('/sys/manager_accounts/group/group_bds').then(function (resp) { + $scope.bd_group_bds = resp.data; + $scope.chooseBD('all'); + }); + } + $scope.chooseBD = function (groupBD) { + $scope.params.onlyGroup=true; + if (groupBD == 'all') { + $scope.isAll = true; + $scope.chooseBDId=''; + delete $scope.params.group_bd; + } else { + $scope.chooseBDId=groupBD; + $scope.params.group_bd = groupBD; + $scope.isAll = false; + } + $scope.loadTradeLogs(); + }; + + $scope.chooseToday = function () { + $scope.params.datefrom = $scope.params.dateto = new Date(); + $scope.loadTradeLogs(1); + }; + $scope.chooseYesterday = function () { + var yesterday = new Date(); + yesterday.setDate(yesterday.getDate() - 1); + $scope.params.datefrom = $scope.params.dateto = yesterday; + $scope.loadTradeLogs(1); + }; + $scope.chooseLast7Days = function () { + $scope.params.dateto = new Date(); + var day = new Date(); + day.setDate(day.getDate() - 7); + $scope.params.datefrom = day; + $scope.loadTradeLogs(1); + }; + $scope.thisMonth = function () { + $scope.params.dateto = new Date(); + var monthBegin = new Date(); + monthBegin.setDate(1); + $scope.params.datefrom = monthBegin; + $scope.loadTradeLogs(1); + }; + $scope.lastMonth = function () { + var monthFinish = new Date(); + monthFinish.setDate(0); + $scope.params.dateto = monthFinish; + var monthBegin = new Date(); + monthBegin.setDate(0); + monthBegin.setDate(1); + $scope.params.datefrom = monthBegin; + $scope.loadTradeLogs(1); + }; + if (($scope.currentUser.role & parseInt('1000011', 2)) > 0 && !$scope.currentUser.org_id) { + $scope.org2 = "ALL" + $http.get('/sys/orgs', {params: {}}).then(function (resp) { + $scope.orgs = resp.data; + }); + } + + $scope.loadOrgs = function () { + var params = angular.copy($scope.params); + $http.get('/sys/orgs/orgChild',{params: params}).then(function (resp) { + $scope.orgs_child = resp.data; + }) + }; + if(($scope.currentUser.role & parseInt('1000000000000', 2)) > 0 && ($scope.currentUser.org_id != null)){ + $scope.org2 = "ALL Organizations" + $scope.loadOrgs(); + } + + $scope.loadTradeLogs = function (page) { + 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'); + } + params.page = page || $scope.pagination.page || 1; + if(params.gateway){ + if((params.gateway.sort().toString()!=[0,1].toString()) && (params.gateway.sort().toString()!=[5,6].toString())){ + delete params.gatewayChilds; + delete params.gatewayChild; + } + if(params.gatewayChilds){ + var exist = false + params.gatewayChilds.forEach(function (child) { + if(child==params.gatewayChild){ + exist = true + } + }) + if(!exist){ + params.gatewayChild = null + } + }else{ + delete params.gatewayChild; + } + }else{ + delete params.gatewayChilds; + delete params.gatewayChild; + } + $http.get('/sys/trade_logs/incremental', {params: params}).then(function (resp) { + $scope.tradeLogs = resp.data.data; + $scope.pagination = resp.data.pagination; + $scope.analysis = resp.data.analysis; + $scope.analysis.refund_fee = angular.copy(Math.abs($scope.analysis.refund_fee)); + }); + }; + + $scope.showTradeDetail = function (order) { + orderService.managerOrderDetail(order) + }; + $scope.loadTradeLogs(1); + + $scope.$on('order_refunded', function () { + $scope.loadTradeLogs(); + }); + + } + ]); return app; }); diff --git a/src/main/ui/static/payment/tradelog/tradelog.js b/src/main/ui/static/payment/tradelog/tradelog.js index 710c2c71a..2fc4d2fd8 100644 --- a/src/main/ui/static/payment/tradelog/tradelog.js +++ b/src/main/ui/static/payment/tradelog/tradelog.js @@ -10,11 +10,15 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) { url: '/trade', templateUrl: '/static/payment/tradelog/templates/partner_trade_logs.html', controller: 'tradeLogCtrl' + }).state('incremental_trade', { + url: '/IncrementalTrade', + templateUrl: '/static/payment/tradelog/templates/partner_incremental_trade_logs.html', + controller: 'IncrementalTradeLogCtrl' }) }]); - app.controller('tradeLogCtrl', ['$scope', '$http', '$filter', '$timeout', 'partnerRefunder', 'orderService', 'commonDialog', - function ($scope, $http, $filter, $timeout, partnerRefunder, orderService, commonDialog) { - $scope.params = {status: 'PAID', channel :'ALL' ,textType: 'all', datefrom: new Date(), dateto: new Date()}; + app.controller('tradeLogCtrl', ['$scope', '$http', '$filter', '$timeout', 'partnerRefunder', 'orderService', 'commonDialog','$sce', + function ($scope, $http, $filter, $timeout, partnerRefunder, orderService, commonDialog,$sce) { + $scope.params = {source: 'ALL',status: 'PAID', channel :'ALL' ,textType: 'all', datefrom: new Date(), dateto: new Date()}; $scope.pagination = {}; $scope.today = new Date(); $scope.isAll = true; @@ -92,12 +96,49 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) { } $http.get('/client/partner_info/trade_logs', {params: params}).then(function (resp) { $scope.tradeLogs = resp.data.data; + $scope.htmlToolst(); $scope.pagination = resp.data.pagination; $scope.analysis = resp.data.analysis; $scope.analysis.refund_fee = angular.copy(Math.abs($scope.analysis.refund_fee)); }); }; + /*$scope.htmlToolst = function(){ + for(var i=0;i< $scope.tradeLogs.length;i++){ + var tax_amount = $scope.tradeLogs[i].tax_amount; + var total_surcharge= $scope.tradeLogs[i].total_surcharge; + var incremental_surcharge = $scope.tradeLogs[i].incremental_surcharge; + var system_surcharge = (total_surcharge-incremental_surcharge).toFixed(2); + $scope.tradeLogs[i].htmlTooltip = $sce.trustAsHtml('
' + + '
手续费组成
'+'
'+ + '

system:'+ system_surcharge +'

' + + '

yangmatou:'+ incremental_surcharge +'

' + + '

tax amount:'+ tax_amount +'

' + + '
'); + } + };*/ + + $scope.htmlToolst = function(){ + for(var i=0;i< $scope.tradeLogs.length;i++){ + var tax_amount = $scope.tradeLogs[i].tax_amount; + var total_surcharge= $scope.tradeLogs[i].total_surcharge; + var incremental_surcharge = $scope.tradeLogs[i].incremental_surcharge; + var total_amount = $scope.tradeLogs[i].total_amount; + var display_amount = $scope.tradeLogs[i].display_amount; + var source = $scope.tradeLogs[i].source; + var system_surcharge = (total_surcharge-incremental_surcharge).toFixed(2); + var tip = '
' + + '
手续费组成
'+'
'+ + '

system:'+ system_surcharge +'

' + + '

'+ source +':'+incremental_surcharge +'

'; + if(total_surcharge < (total_amount-display_amount).toFixed(2)){ + tip = tip +'

tax amount:'+ tax_amount +'

'; + } + tip = tip + '
'; + $scope.tradeLogs[i].htmlTooltip = $sce.trustAsHtml(tip); + } + } + $scope.gatewaySelected = function (arr) { return $scope.params.gateway != null && $scope.params.gateway.filter(function (gateway) { return arr.indexOf(gateway) >= 0 @@ -254,5 +295,221 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) { } }]); + app.controller('IncrementalTradeLogCtrl', ['$scope', '$http', '$filter', '$timeout', 'partnerRefunder', 'orderService', 'commonDialog', + function ($scope, $http, $filter, $timeout, partnerRefunder, orderService, commonDialog) { + $scope.params = {source: 'yangmatou',status: 'PAID', channel :'ALL' ,textType: 'all', datefrom: new Date(), dateto: new Date()}; + $scope.pagination = {}; + $scope.today = new Date(); + $scope.isAll = true; + $scope.isLevel3All = true; + $scope.device_isAll = true; + $scope.dev_params = {client_type:'sunmi',limit:100}; + $scope.clients = [$scope.currentUser.client]; + $scope.showLevel3Clients = false; + + + $scope.chooseToday = function () { + $scope.params.datefrom = $scope.params.dateto = new Date(); + $scope.loadTradeLogs(1); + }; + $scope.chooseYesterday = function () { + var yesterday = new Date(); + yesterday.setDate(yesterday.getDate() - 1); + $scope.params.datefrom = $scope.params.dateto = yesterday; + $scope.loadTradeLogs(1); + }; + $scope.chooseLast7Days = function () { + $scope.params.dateto = new Date(); + var day = new Date(); + day.setDate(day.getDate() - 7); + $scope.params.datefrom = day; + $scope.loadTradeLogs(1); + }; + $scope.thisMonth = function () { + $scope.params.dateto = new Date(); + var monthBegin = new Date(); + monthBegin.setDate(1); + $scope.params.datefrom = monthBegin; + $scope.loadTradeLogs(1); + }; + $scope.lastMonth = function () { + var monthFinish = new Date(); + monthFinish.setDate(0); + $scope.params.dateto = monthFinish; + var monthBegin = new Date(); + monthBegin.setDate(0); + monthBegin.setDate(1); + $scope.params.datefrom = monthBegin; + $scope.loadTradeLogs(1); + }; + $scope.loadTradeLogs = function (page) { + 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'); + } + params.page = page || $scope.pagination.page || 1; + $http.get('/client/partner_info/incremental_trade_logs', {params: params}).then(function (resp) { + $scope.tradeLogs = resp.data.data; + $scope.pagination = resp.data.pagination; + $scope.analysis = resp.data.analysis; + $scope.analysis.refund_fee = angular.copy(Math.abs($scope.analysis.refund_fee)); + }); + }; + + $scope.gatewaySelected = function (arr) { + return $scope.params.gateway != null && $scope.params.gateway.filter(function (gateway) { + return arr.indexOf(gateway) >= 0 + }).length > 0 + }; + $scope.showTradeDetail = function (order) { + orderService.clientOrderDetail(order) + }; + $scope.showPRefundLog = function (orderId) { + partnerRefunder.prefunded(orderId); + }; + $scope.newPRefund = function (orderId) { + partnerRefunder.prefund(orderId).then(function () { + $scope.loadTradeLogs(); + }); + }; + $scope.releasePreAuth = function (orderId) { + commonDialog.confirm({ + title: 'Pre Authorization Completion', + content: 'This bill will be taken into settlement, or you will be able to make a refund order. Are you sure?' + }).then(function () { + $http.put('/client/partner_info/trade_logs/' + orderId + '/release_preauth').then(function (resp) { + $scope.loadTradeLogs(); + }, function (resp) { + commonDialog.alert({title: 'Error!', content: resp.data.message, type: 'error'}) + }) + }) + }; + $scope.alerts = []; + $scope.$on('pe_order_paid', function (evt, order) { + $scope.alerts.push(order); + $timeout(function () { + $scope.alerts.splice(0, 1); + }, 10000); + $scope.loadTradeLogs(); + }); + $scope.chooseClient = function (client) { + if (client == 'all') { + $scope.params.client_ids = angular.copy($scope.clientIds); + $scope.isAll = true; + $scope.chooseClientId = ''; + $scope.dev_params.client_ids = angular.copy($scope.clientIds); + $scope.showLevel3Clients = false; + $scope.listDevices(); + } 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.dev_params.client_ids = [client.client_id]; + $scope.showLevel3Clients = false; + $scope.listDevices(); + } + $scope.loadTradeLogs(); + }; + + $scope.chooseLevel3Client = function (client) { + if (client == 'all') { + $scope.params.client_ids = angular.copy($scope.level3ClientIds); + $scope.isLevel3All = true; + $scope.chooseLevel3ClientId = ''; + $scope.dev_params.client_ids = angular.copy($scope.level3ClientIds); + $scope.listDevices(); + } else { + $scope.chooseLevel3ClientId = client.client_id; + $scope.params.client_ids = [client.client_id]; + $scope.isLevel3All = false; + $scope.dev_params.client_ids = [client.client_id]; + $scope.listDevices(); + } + $scope.loadTradeLogs(); + }; + + $scope.listDevices = function () { + var params = angular.copy($scope.dev_params) + $http.get('/client/partner_info/devices', {params: params}).then(function (resp) { + $scope.devices = resp.data.data; + }) + }; + $scope.chooseDevices = function (dev_id) { + if(dev_id == 'all'){ + $scope.chooseDevice_id = ''; + $scope.params.dev_id = null; + $scope.device_isAll = true; + $scope.loadTradeLogs(1); + }else { + $scope.chooseDevice_id = dev_id; + $scope.params.dev_id = dev_id; + $scope.device_isAll = false; + $scope.loadTradeLogs(1); + } + }; + $scope.listDevices(); + + if ($scope.currentUser.client.has_children) { + $http.get('/client/partner_info/sub_partners').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.loadTradeLogs(1); + //console.log($rootScope.currentUser.client.clientList); + }) + }else{ + $scope.loadTradeLogs(1); + } + + $scope.fullReleasePreAuth = 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'); + } + commonDialog.confirm({ + title: 'All Pre Authorization Completion', + content: 'These pre authorization orders will be taken into settlement, or you will be able to make a refund order. Are you sure?' + }).then(function(){ + $http.put('/client/partner_info/trade_logs/full_release_preauth',params).then(function (resp){ + $scope.loadTradeLogs(1); + alert("Success"); + },function (resp) { + commonDialog.alert({title: 'Error!', content: resp.data.message, type: 'error'}) + }) + }); + } + + }]); + return app; -}); \ No newline at end of file +}); diff --git a/src/main/ui/static/payment/tradelog/transflow.js b/src/main/ui/static/payment/tradelog/transflow.js index 540409d51..0d79ae790 100644 --- a/src/main/ui/static/payment/tradelog/transflow.js +++ b/src/main/ui/static/payment/tradelog/transflow.js @@ -12,7 +12,7 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) { controller: 'balanceListCtrl' }) }]); - app.controller('balanceListCtrl', ['$scope', '$http', '$filter', '$timeout', 'refunder', 'orderService', function ($scope, $http, $filter, $timeout, refunder) { + app.controller('balanceListCtrl', ['$scope', '$http', '$filter', '$timeout', 'refunder', 'orderService','$sce', function ($scope, $http, $filter, $timeout, refunder,orderService,$sce) { $scope.params = {}; $scope.pagination = {}; $scope.params.clearing_status = -1; @@ -91,6 +91,7 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) { params.page = page || $scope.pagination.page || 1; $http.get('/client/trans_flow', {params: params}).then(function (resp) { $scope.tradeLogs = resp.data.data; + $scope.htmlToolst(); $scope.pagination = resp.data.pagination; $scope.analysis = resp.data.analysis; $scope.analysis.refund_fee = angular.copy(Math.abs($scope.analysis.refund_fee)); @@ -214,7 +215,29 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) { }else { $scope.chooseLast7Days(); } + + $scope.htmlToolst = function(){ + for(var i=0;i< $scope.tradeLogs.length;i++){ + var tax_amount = $scope.tradeLogs[i].tax_amount; + var total_surcharge= $scope.tradeLogs[i].total_surcharge; + var incremental_surcharge = $scope.tradeLogs[i].incremental_surcharge; + var channel_surcharge = $scope.tradeLogs[i].channel_surcharge; + var royal_surcharge = $scope.tradeLogs[i].royal_surcharge; + var system_surcharge = (total_surcharge-incremental_surcharge).toFixed(2); + var channel = $scope.tradeLogs[i].source; + var tip = '
' + + '
手续费组成
'+'
'+ + '

system:'+ system_surcharge +'

' + + '

'+channel+':'+ incremental_surcharge +'

'; + if(total_surcharge <= (royal_surcharge+incremental_surcharge+channel_surcharge+tax_amount)){ + tip = tip +'

tax amount:'+ tax_amount +'

'; + } + tip = tip + '
'; + $scope.tradeLogs[i].htmlTooltip = $sce.trustAsHtml(tip); + } + }; + }]); return app; -}); \ No newline at end of file +});