From e1cd4e2287808beae7a0e7afa82134da02a01791 Mon Sep 17 00:00:00 2001 From: "xiao.tang" Date: Thu, 7 Jan 2021 16:31:14 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8feat(royalpay):=20=E4=BA=A4=E6=98=93?= =?UTF-8?q?=E5=AF=B9=E8=B4=A6=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../payment/validation/order-validation.js | 361 ++++++++++++++---- .../validation/templates/handle_desc.html | 25 ++ .../validation/templates/valid-calendar.html | 28 +- .../validation/templates/valid_new.html | 278 ++++++++++++++ 4 files changed, 612 insertions(+), 80 deletions(-) create mode 100644 src/main/ui/static/payment/validation/templates/handle_desc.html create mode 100644 src/main/ui/static/payment/validation/templates/valid_new.html diff --git a/src/main/ui/static/payment/validation/order-validation.js b/src/main/ui/static/payment/validation/order-validation.js index 0a66b25cd..9476ef242 100644 --- a/src/main/ui/static/payment/validation/order-validation.js +++ b/src/main/ui/static/payment/validation/order-validation.js @@ -2,83 +2,296 @@ * Created by davep on 2016-09-01. */ define(['angular', 'uiRouter'], function () { - 'use strict'; - var app = angular.module('orderValidApp', ['ui.router']); - app.config(['$stateProvider', function ($stateProvider) { - $stateProvider.state('order_valid', { - url: '/order_validation', - templateUrl: '/static/payment/validation/templates/valid-calendar.html', - controller: 'orderValidCalendarCtrl' - }).state('order_valid.report', { - url: '/{date}', - templateUrl: '/static/payment/validation/templates/valid.html', - controller: 'orderValidationCtrl' - }); - }]); - app.controller('orderValidCalendarCtrl', ['$scope', '$http', '$filter', function ($scope, $http, $filter) { - $scope.today = new Date(); - $scope.loadValidatedDates = function (month) { - let monthStr = $filter('date')(month, 'yyyyMM'); - $http.get('/sys/financial/validated_dates/' + monthStr).then(function (resp) { - $scope.validatedDates = resp.data; + 'use strict' + var app = angular.module('orderValidApp', ['ui.router']) + app.config([ + '$stateProvider', + function ($stateProvider) { + $stateProvider + .state('order_valid', { + url: '/order_validation', + templateUrl: '/static/payment/validation/templates/valid-calendar.html', + controller: 'orderValidCalendarCtrl', + }) + .state('order_valid.report', { + url: '/{date}', + templateUrl: '/static/payment/validation/templates/valid.html', + controller: 'orderValidationCtrl', + }) + .state('order_valid.report_new', { + url: '/new/{date}', + templateUrl: '/static/payment/validation/templates/valid_new.html', + controller: 'orderValidationNewCtrl', + }) + }, + ]) + app.controller('orderValidCalendarCtrl', [ + '$scope', + '$http', + '$filter', + '$state', + 'commonDialog', + function ($scope, $http, $filter, $state, commonDialog) { + $scope.today = new Date() + $scope.loadValidatedDates = function (month) { + let monthStr = $filter('date')(month, 'yyyyMM') + $http.get('/sys/financial/validated_dates/' + monthStr).then(function (resp) { + $scope.validatedDates = resp.data + }) + } + $scope.findReport = function (dateStr) { + if ($scope.validatedDates == null) { + return null + } + let filtered = $scope.validatedDates.filter(rp => rp.date === dateStr) + return filtered.length ? filtered[0] : null + } + $scope.checkDetail = function (date) { + const filterItem = $scope.validatedDates.filter(rp => rp.date === date) + const dateStr = date.replace(/\//g, '') + if (filterItem.length) { + if (filterItem[0].isOld) { + $state.go('order_valid.report', { date: dateStr }) + } else { + sessionStorage.setItem('warningLevel', filterItem[0].warning_level) + $state.go('order_valid.report_new', { date: dateStr }) + } + } else { + commonDialog + .confirm({ + title: 'Confirm', + content: '是否确认重新执行对账?', + }) + .then(function () { + $http + .get('/sys/financial/order_validations/' + dateStr, { + params: { + use_cache: false, + }, + timeout: 300000, + }) + .then( + function () { + $state.reload() + }, + function (resp) { + $state.reload() + } + ) }) - }; - $scope.findReport = function (dateStr) { - if ($scope.validatedDates == null) { - return null; - } - let filtered = $scope.validatedDates.filter(rp => rp.date === dateStr); - return filtered.length ? filtered[0] : null } - }]); - app.controller('orderValidationCtrl', ['$scope', '$http', '$filter', '$stateParams', 'commonDialog', - function ($scope, $http, $filter, $stateParams, commonDialog) { - $scope.date = $stateParams.date; - $scope.startValid = function (forceRebuild) { - $scope.report = {loading: true}; - $http.get('/sys/financial/order_validations/' + $scope.date, { - params: { - use_cache: !forceRebuild - }, - timeout: 300000 - }).then(function (resp) { - $scope.report = resp.data; - $scope.notExistsKeys = []; - $scope.notEqualsKeys = []; - angular.forEach($scope.report.not_exists, function (item) { - angular.forEach(item, function (val, key) { - if ($scope.notExistsKeys.indexOf(key) < 0) { - $scope.notExistsKeys.push(key); - } - }) - }); - angular.forEach($scope.report.not_equals, function (item) { - angular.forEach(item, function (val, key) { - if ($scope.notExistsKeys.indexOf(key) < 0) { - $scope.notExistsKeys.push(key); - } - }) - }); - }, function (resp) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); - $scope.report = null; + } + }, + ]) + // old + app.controller('orderValidationCtrl', [ + '$scope', + '$http', + '$filter', + '$stateParams', + 'commonDialog', + function ($scope, $http, $filter, $stateParams, commonDialog) { + $scope.date = $stateParams.date + $scope.startValid = function (forceRebuild) { + $scope.report = { loading: true } + $http + .get('/sys/financial/order_validations/' + $scope.date, { + params: { + use_cache: !forceRebuild, + }, + timeout: 300000, + }) + .then( + function (resp) { + $scope.report = resp.data + $scope.notExistsKeys = [] + $scope.notEqualsKeys = [] + angular.forEach($scope.report.not_exists, function (item) { + angular.forEach(item, function (val, key) { + if ($scope.notExistsKeys.indexOf(key) < 0) { + $scope.notExistsKeys.push(key) + } + }) + }) + angular.forEach($scope.report.not_equals, function (item) { + angular.forEach(item, function (val, key) { + if ($scope.notExistsKeys.indexOf(key) < 0) { + $scope.notExistsKeys.push(key) + } }) - }; - $scope.startValid(false); + }) + }, + function (resp) { + commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) + $scope.report = null + } + ) + } + $scope.startValid(false) - $scope.fixReport = function () { - var datePattern = $filter('date')($scope.valid.date, 'yyyyMMdd'); - $http.get('/sys/financial/order_validations', { - params: { - date: datePattern, - fix: true - } - }).then(function (resp) { - commonDialog.alert({title: 'Success', content: '修复完毕', type: 'success'}) - }, function (resp) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + $scope.fixReport = function () { + var datePattern = $filter('date')($scope.valid.date, 'yyyyMMdd') + $http + .get('/sys/financial/order_validations', { + params: { + date: datePattern, + fix: true, + }, + }) + .then( + function (resp) { + commonDialog.alert({ title: 'Success', content: '修复完毕', type: 'success' }) + }, + function (resp) { + commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) + } + ) + } + }, + ]) + // new + app.controller('orderValidationNewCtrl', [ + '$scope', + '$http', + '$stateParams', + 'commonDialog', + '$uibModal', + function ($scope, $http, $stateParams, commonDialog, $uibModal) { + // 清除sessionStorage + $scope.$on('$destroy', function () { + sessionStorage.clear() + }) + $scope.date = angular.copy($stateParams.date) + $scope.date = $scope.date.substr(0, 4) + '-' + $scope.date.substr(4, 2) + '-' + $scope.date.substr(6) + $scope.warningLevel = JSON.parse(sessionStorage.getItem('warningLevel')) + // 加载渠道信息 + $scope.startValid = function () { + $http + .get('/sys/financial/order_validation_new/' + $stateParams.date, { + timeout: 300000, + }) + .then( + function (resp) { + $scope.channelList = [] + for (let key in resp.data) { + const obj = {} + obj.key = key + obj.channel = resp.data[key] + obj.selected = false + $scope.channelList.push(obj) + } + $scope.channelList.map(item => { + const arr = item.channel.filter(f => { + return f.success === false }) + item.status = arr.length ? 'FAILED' : 'SUCCESS' + item.success = arr.length ? false : true + }) + if (sessionStorage.getItem('channel')) { + const channel = JSON.parse(sessionStorage.getItem('channel')) + channel.map(item => { + $scope.channelList.filter(f => f.key === item.key)[0].selected = item.selected + }) + } else { + $scope.channelList[0].selected = true + } + console.log($scope.channelList) + }, + function (resp) { + commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) } - }]); - return app; -}); \ No newline at end of file + ) + } + $scope.startValid() + // 受否折叠 + $scope.fold = function (index) { + $scope.channelList[index].selected = !$scope.channelList[index].selected + } + // 是否清除缓存 + $scope.clear = function (channelName, flag) { + $http.post('/sys/financial/redo_channel_validation/' + $stateParams.date, { channel: channelName, cache: flag }).then( + function () { + $scope.startValid() + }, + function (resp) { + commonDialog.alert({ title: 'failed', content: resp.data.message, type: 'error' }) + } + ) + } + // 处理 + $scope.handle = function (logId) { + sessionStorage.setItem('channel', JSON.stringify($scope.channelList)) + $uibModal + .open({ + templateUrl: '/static/payment/validation/templates/handle_desc.html', + controller: 'handleCtrl', + resolve: { + logId: [ + '$stateParams', + function () { + return logId + }, + ], + }, + }) + .result.then(function () { + $scope.startValid() + }) + } + // 下载 + $scope.download = function (merchant, keyName) { + if (merchant != null) { + const params = {} + params.channel = keyName + params.pid = merchant.pid + params.billDate = merchant.bill_date + params.noCache = false + params.billType = '' + window.open( + '/sys/financial/downloadChannelReconciliationFile?billDate=' + + params.billDate + + '&channel=' + + params.channel + + '&noCache=' + + params.noCache + + '&pid=' + + params.pid + + '&billType=' + + params.billType + ) + } + } + // 查看what + $scope.checkStatus = function (transactionId) { + $http.get('/sys/financial/get/transaction/status/' + transactionId, {}).then( + function (resp) { + commonDialog.alert({ title: resp.data.statusInfo, content: '', type: 'success' }) + }, + function (resp) { + commonDialog.alert({ title: 'failed', content: resp.data.message, type: 'error' }) + } + ) + } + }, + ]) + // 处理 + app.controller('handleCtrl', [ + '$scope', + '$http', + 'commonDialog', + 'logId', + function ($scope, $http, commonDialog, logId) { + $scope.confirm = function () { + $http.post('/sys/financial/mark/resolve/message', { log_id: logId, message: $scope.message }).then( + function () { + $scope.$close() + }, + function (resp) { + commonDialog.alert({ title: 'failed', content: resp.data.message, type: 'error' }) + } + ) + } + }, + ]) + return app +}) diff --git a/src/main/ui/static/payment/validation/templates/handle_desc.html b/src/main/ui/static/payment/validation/templates/handle_desc.html new file mode 100644 index 000000000..cda2f2dca --- /dev/null +++ b/src/main/ui/static/payment/validation/templates/handle_desc.html @@ -0,0 +1,25 @@ + + + \ No newline at end of file diff --git a/src/main/ui/static/payment/validation/templates/valid-calendar.html b/src/main/ui/static/payment/validation/templates/valid-calendar.html index 232e60798..f7e6b4970 100644 --- a/src/main/ui/static/payment/validation/templates/valid-calendar.html +++ b/src/main/ui/static/payment/validation/templates/valid-calendar.html @@ -7,19 +7,35 @@
-
+
+
+ +  All channel transactions are reconciled successfully. +
+
+ + Yellow warning: There are some abnormal orders in a channel in the transaction reconciliation + result, such as the difference between the amount of an order in the system and the bill amount + of the corresponding channel. +
+
+ + There are some missing orders in a channel in the result of the transaction reconciliation, + for example, by comparing the statement of a channel, it is found that the payment order was not + found in the system on the same day. +
+
-
\ No newline at end of file diff --git a/src/main/ui/static/payment/validation/templates/valid_new.html b/src/main/ui/static/payment/validation/templates/valid_new.html new file mode 100644 index 000000000..5960ea3e4 --- /dev/null +++ b/src/main/ui/static/payment/validation/templates/valid_new.html @@ -0,0 +1,278 @@ +
+ +
+
+

{{date}}

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

{{item.key}}

+
+
Status: {{item.status}} + + (UpdateTime : {{item.channel[0].valid_time}}) +
+
+ Revalidate + + clear + cache +
+
+
+
+
+

{{merchant.pid}}: + (Transaction Time Range : + {{merchant.valid_from_time}} ~ {{merchant.valid_to_time}}) +

+ handle +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Payment Amount in Local CurrencyPayment Transactions NumberRefund Amount in Local CurrencyRefund Transactions NumberTotal Payment NumberTotal Refund Number
+ + {{merchant.channel_analysis.total_paid || merchant.channel_analysis.total_paid + === 0 ? merchant.channel_analysis.total_paid : '-'}} + + {{merchant.channel_analysis.pay_count || merchant.channel_analysis.pay_count === + 0 ? merchant.channel_analysis.pay_count : '-'}} + + {{merchant.channel_analysis.total_refund || + merchant.channel_analysis.total_refund === 0 ? + merchant.channel_analysis.total_refund : '-'}} + + {{merchant.channel_analysis.refund_count || + merchant.channel_analysis.refund_count === 0 ? + merchant.channel_analysis.refund_count : '-'}} + + {{merchant.channel_analysis.total_paid_number || + merchant.channel_analysis.total_paid_number === 0 ? + merchant.channel_analysis.total_paid_number : '-'}} + + {{merchant.channel_analysis.total_refund_number || + merchant.channel_analysis.total_refund_number === 0 ? + merchant.channel_analysis.total_refund_number : '-'}} +
+ {{merchant.db_analysis.total_paid || merchant.db_analysis.total_paid === 0 ? + merchant.db_analysis.total_paid : '-'}} + + {{merchant.db_analysis.pay_count || merchant.db_analysis.pay_count === 0 ? + merchant.db_analysis.pay_count : '-'}} + + {{merchant.db_analysis.total_refund || merchant.db_analysis.total_refund === 0 ? + merchant.db_analysis.total_refund : '-'}} + + {{merchant.db_analysis.refund_count || merchant.db_analysis.refund_count === 0 ? + merchant.db_analysis.refund_count : '-'}} + + {{merchant.db_analysis.total_paid_number || + merchant.db_analysis.total_paid_number === 0 ? + merchant.db_analysis.total_paid_number : '-'}} + + {{merchant.db_analysis.total_refund_number || + merchant.db_analysis.total_refund_number === 0 ? + merchant.db_analysis.total_refund_number : '-'}} +
+ download +
+
+

Not Exists Transactions

+
+ + + + + + + + + + + + + + + + + + + + + + + +
Missing TypeTransaction TimeTransaction IDOrder IDTransaction TypeTransaction AmountOperation
{{ notExist.missing_side ? notExist.missing_side : '-' }}{{ notExist.transaction_time ? notExist.transaction_time : '-' }} + {{ notExist.channel_trans_id ? notExist.channel_trans_id : '-' }} + {{ notExist.order_id ? notExist.order_id : '-' }}{{ notExist.trans_type ? notExist.trans_type : '-' }}{{ notExist.amount || notExist.amount === 0 ? notExist.amount : '-' + }} + + + - + +
+
+
+ +
+

Not Equals Transactions

+
+ + + + + + + + + + + + + + + + + + + + + +
Transaction TimeTransaction IDOrder IDTransaction TypeTransaction AmountOperation
{{notEqual.trans_time ? notEqual.trans_time : '-'}}{{notEqual.transaction_id ? notEqual.transaction_id : '-'}}{{notEqual.order_id ? notEqual.order_id : '-'}}{{notEqual.trans_type ? notEqual.trans_type : '-'}}{{notEqual.channel_amount || notEqual.channel_amount === 0 ? + notEqual.channel_amount : '-'}} + + - + +
+
+
+
+
Handle Description:
+
{{ merchant.resolve_msg }}
+
+
+
+
+
+ + +
+ \ No newline at end of file