From edca1fef2979057aeabc1a77187b4d0d0f84cc5c Mon Sep 17 00:00:00 2001 From: liuxinxin Date: Thu, 12 Dec 2019 18:05:37 +0800 Subject: [PATCH] =?UTF-8?q?[R]=E5=95=86=E6=88=B7=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0KYC=E6=96=87=E4=BB=B6=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/merchants/core/ClientManager.java | 2 + .../core/impls/ClientManagerImpl.java | 30 +++ .../web/PartnerManageController.java | 11 ++ .../merchants/web/PartnerViewController.java | 10 - .../templates/client_kyc_files_progress.html | 2 + .../kyc/templates/partner_kyc_files.html | 145 +++++++++++++++ .../static/payment/partner/partner-manage.js | 174 ++++++++++++++++++ .../client_compliance_to_perfect.html | 2 + .../partner/templates/partner_detail.html | 3 + 9 files changed, 369 insertions(+), 10 deletions(-) create mode 100644 src/main/ui/static/payment/kyc/templates/partner_kyc_files.html 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 3f635fabd..a741510b7 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 @@ -252,6 +252,8 @@ public interface ClientManager { JSONObject getAllAuthFiles(JSONObject manager, String clientMoniker); + JSONObject getAllKycFiles(JSONObject manager, String clientMoniker); + JSONObject getSourceAgreeFiles(JSONObject manage, String clientMoniker); void deleteAuthFiles(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 9cb1ad500..e94002049 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 @@ -3448,6 +3448,36 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid return fileJson; } + @Override + public JSONObject getAllKycFiles(JSONObject manager, String clientMoniker) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + String[] fileKeys = {"client_bank_file", "kyc_utility_bill_file", "client_id_file"}; + if (client == null) { + throw new InvalidShortIdException(); + } + List clientFiles = clientFilesMapper.findClientFile(client.getIntValue("client_id")); + JSONObject fileJson = new JSONObject(); + if (clientFiles != null && clientFiles.size() > 0) { + for (String fileKey : fileKeys) { + List clientFileUrl = clientFiles.stream() + .filter(json -> (fileKey.equals(json.getString("file_name")))) + .sorted((log1, log2) -> log2.getDate("last_update_date").compareTo(log1.getDate("last_update_date"))) + .map(json -> { + JSONObject params = new JSONObject(); + params.put("file_id", json.getString("file_id")); + params.put("file_value", json.getString("file_value")); + return params; + }) + .collect(Collectors.toList()); + if (clientFileUrl != null && clientFileUrl.size() > 0) { + fileJson.put(fileKey, clientFileUrl); + } + } + } + return fileJson; + } + + @Override public JSONObject getClientViewAuthFiles(JSONObject manager, String clientMoniker) { JSONObject client = getClientInfoByMoniker(clientMoniker); 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 b829c9597..1d99a9bb3 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 @@ -537,6 +537,11 @@ public class PartnerManageController { return clientManager.getAllAuthFiles(manager, clientMoniker); } + @ManagerMapping(value = "/{clientMoniker}/kycFile", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.BD_USER, ManagerRole.SERVANT}) + public JSONObject getKycFiles(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + return clientManager.getAllKycFiles(manager, clientMoniker); + } + @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.getSourceAgreeFiles(manager, clientMoniker); @@ -553,6 +558,12 @@ public class PartnerManageController { clientManager.uploadAuthFiles(manager, clientMoniker, filesInfo); } + @ManagerMapping(value = "/{clientMoniker}/kycFile", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.BD_USER}) + public void uploadKycFiles(@PathVariable String clientMoniker, @RequestBody ClientKycFilesInfo filesInfo, + @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + clientManager.uploadKycFiles(manager, clientMoniker, filesInfo); + } + @ManagerMapping(value = "/analysis", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.BD_USER}) public JSONObject getClientsAnalysis(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { return clientManager.getClientsAnalysis(manager); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java index a0eed3674..1beb36904 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java @@ -581,16 +581,6 @@ public class PartnerViewController { } } - - @PartnerMapping(value = "/update/kycFile", method = RequestMethod.PUT) - @ResponseBody - public void updateKycFile(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, @RequestBody ClientKycFilesInfo filesInfo) { - JSONObject client = account.getJSONObject("client"); - JSONObject manager = new JSONObject(); - manager.put("display_name","client"); - clientManager.uploadKycFiles(manager, account.getString("client_moniker"), filesInfo); - } - @PartnerMapping(value = "/update/wait_kyc_file", method = RequestMethod.PUT) @ResponseBody public void updateWaitKycFile(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, @RequestBody ClientKycFilesInfo filesInfo) { diff --git a/src/main/ui/static/payment/kyc/templates/client_kyc_files_progress.html b/src/main/ui/static/payment/kyc/templates/client_kyc_files_progress.html index 0008a21af..7bf7e7e10 100644 --- a/src/main/ui/static/payment/kyc/templates/client_kyc_files_progress.html +++ b/src/main/ui/static/payment/kyc/templates/client_kyc_files_progress.html @@ -21,6 +21,8 @@ ({{file.client_refuse_reason}}) +
+

前去补充合规文件:点击前往

diff --git a/src/main/ui/static/payment/kyc/templates/partner_kyc_files.html b/src/main/ui/static/payment/kyc/templates/partner_kyc_files.html new file mode 100644 index 000000000..e83b5b67c --- /dev/null +++ b/src/main/ui/static/payment/kyc/templates/partner_kyc_files.html @@ -0,0 +1,145 @@ + +
+
KYC Files     + +
+
+
+
+ +
+
+ + +
+ + + + + + + + + +
1 + + + + +
+ + +
+
+
+

Example:请保证图片信息清晰可见,如下图

+ +
+
+
+ +
+ +
+
+ + +
+ + + + + + + + +
1 + + + + +
+
+
+
+
+

Example:请保证图片(护照或驾照)信息清晰可见,如下图

+ +
+
+
+
+ +
+
+
+
+ +
+ +
+
+ +
+ + + + + + + + +
1 + + + +
+
+
+
+
+

Example:公司请提供以下文件图片,如示例 + +

+

sole trade(个体户),partnership(合伙),trust(信托)请在http://abr.business.gov.au,将查询结果截图上传 + +

+
+
+
+
+ +
+
+
+ check +
+
+ diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index e810cbfa0..abe9ae776 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -167,6 +167,15 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter return $http.get('/sys/partners/' + $stateParams.clientMoniker + '/file'); }] } + }).state('partners.detail.kyc_files', { + url: '/kyc_files', + templateUrl: '/static/payment/kyc/templates/partner_kyc_files.html', + controller: 'partnerKycFileCtrl', + resolve: { + file: ['$http', '$stateParams', function ($http, $stateParams) { + return $http.get('/sys/partners/' + $stateParams.clientMoniker + '/kycFile'); + }] + } }).state('partners.detail.settlement', { url: '/settlement', templateUrl: '/static/payment/partner/templates/partner_settlement.html', @@ -4044,6 +4053,171 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.complianceChangeCheck(); }]); + + app.controller('partnerKycFileCtrl', ['$scope', '$http', '$rootScope', 'commonDialog', '$state', 'Upload', 'file', function ($scope, $http, $rootScope, commonDialog, $state, Upload, file) { + + $scope.file = file.data || {}; + //kyc files + $scope.uploadBankFile = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.bankFileProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.bankFileProgress; + $scope.file.file_bank_info = resp.data.url; + $scope.updateFile(); + if ($scope.file.file_bank_info.endsWith('pdf')) { + $scope.bankIsImage = false; + } else { + $scope.bankIsImage = true; + } + }, function (resp) { + delete $scope.bankFileProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.bankFileProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + + $scope.bankIsImage = true; + if ($scope.file.file_bank_info && $scope.file.file_bank_info.endsWith('pdf')) { + $scope.bankIsImage = false; + } + $scope.idIsImage = true; + if ($scope.file.file_id_info && $scope.file.file_id_info.endsWith('pdf')) { + $scope.idIsImage = false; + } + $scope.billIsImage = true; + if ($scope.file.file_company_info && $scope.file.file_company_info.endsWith('pdf')) { + $scope.billIsImage = false; + } + + //上传ID信息 + $scope.uploadIDFile = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.idFileProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.idFileProgress; + $scope.file.file_id_info = resp.data.url; + $scope.updateFile(); + if ($scope.file.file_id_info.endsWith('pdf')) { + $scope.idIsImage = false; + } else { + $scope.idIsImage = true; + } + }, function (resp) { + delete $scope.idFileProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.idFileProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + + //上传账单流水 + $scope.uploadCompanyFile = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.billFileProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.billFileProgress; + $scope.file.utility_bill_info = resp.data.url; + $scope.updateFile(); + if ($scope.file.utility_bill_info.endsWith('pdf')) { + $scope.billIsImage = false; + } else { + $scope.billIsImage = true; + } + }, function (resp) { + delete $scope.billFileProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.billFileProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + +/* $scope.downloadAsZip = function () { + var url = '/sys/partners/' + $scope.partner.client_moniker + '/download/complianceAsZIP'; + return url; + };*/ + + $scope.deleteComplianceFiles = function (file_id) { + commonDialog.confirm({ + title: 'Warning', + content: 'This operation will delete the file, Are you sure?' + }).then(function () { + $http.put('/sys/partners/auth_file/' + file_id + '/delete').then(function (resp) { + commonDialog.alert({ + title: 'Success', + content: 'Delete Successful', + type: 'success' + }); + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + }) + }; + + $scope.updateFile = function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/kycFile', $scope.file).then(function () { + commonDialog.alert({ + title: 'Success', + content: 'Upload Successful', + type: 'success' + }); + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + } + + function commitError() { + commonDialog.alert({ + title: 'Error', + content: 'Missing file', + type: 'error' + }); + }; + $scope.complianceCheck = function () { + if (!$rootScope.complianceCheck) { + $rootScope.complianceCheck = {}; + } + $rootScope.complianceCheck.client_id = $scope.partner.client_id; + $rootScope.complianceCheck.authFile = true; + }; + $scope.complianceChangeCheck = function () { + if ($rootScope.complianceCheck) { + if ($scope.partner.client_id != $rootScope.complianceCheck.client_id) { + delete $rootScope.complianceCheck; + } + } + }; + $scope.complianceChangeCheck(); + + }]); + app.controller('partnerSettlementCtrl', ['$scope', '$uibModal', '$http', 'clientMoniker', '$filter', function ($scope, $uibModal, $http, clientMoniker, $filter) { $scope.params = {}; $scope.pagination = {}; diff --git a/src/main/ui/static/payment/partner/templates/client_compliance_to_perfect.html b/src/main/ui/static/payment/partner/templates/client_compliance_to_perfect.html index 2f5d5feaa..eadd5e66a 100644 --- a/src/main/ui/static/payment/partner/templates/client_compliance_to_perfect.html +++ b/src/main/ui/static/payment/partner/templates/client_compliance_to_perfect.html @@ -21,6 +21,8 @@ ({{file.client_refuse_reason}}) +
+

前去补充KYC文件:点击前往

diff --git a/src/main/ui/static/payment/partner/templates/partner_detail.html b/src/main/ui/static/payment/partner/templates/partner_detail.html index 7e2ac4067..fae0946e3 100644 --- a/src/main/ui/static/payment/partner/templates/partner_detail.html +++ b/src/main/ui/static/payment/partner/templates/partner_detail.html @@ -277,6 +277,9 @@
  • Compliance Files
  • +
  • + KYC Files +
  • Settlement