From 0517c8ec8ba3cf8cef6a1e602eb292719cab57dd Mon Sep 17 00:00:00 2001 From: dalong306 <304592994@qq.com> Date: Tue, 12 Jan 2021 14:56:24 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=AD=90=E5=95=86?= =?UTF-8?q?=E6=88=B7=E5=8F=B7=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3=E5=BC=80?= =?UTF-8?q?=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../beans/NewSubMerchantIdApply.java | 15 ++ .../core/impls/ClientManagerImpl.java | 10 +- .../ui/static/payment/partner/add-partner.js | 6 +- .../static/payment/partner/partner-manage.js | 156 ++++++++++------ .../new_apply_wx_sub_merchant_id.html | 2 +- .../templates/sub_merchant_id_apply.html | 12 +- .../update_apply_wx_sub_merchant_id.html | 167 +++++++++++------- 7 files changed, 233 insertions(+), 135 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/beans/NewSubMerchantIdApply.java b/src/main/java/au/com/royalpay/payment/manage/merchants/beans/NewSubMerchantIdApply.java index 3bd387622..30309d852 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/beans/NewSubMerchantIdApply.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/beans/NewSubMerchantIdApply.java @@ -85,6 +85,8 @@ public class NewSubMerchantIdApply { @JSONField(name = "business_type") private String business_type; + private String sub_mch_id; + public JSONObject insertObject(JSONObject client) { JSONObject params = new JSONObject(); if(StringUtils.isNotEmpty(merchant_name)){ @@ -139,6 +141,10 @@ public class NewSubMerchantIdApply { params.put("merchant_country_code","036");//固定值,036-澳大利亚国家编码 params.put("merchant_remark",client.getString("client_moniker")); + if(StringUtils.isNotEmpty(sub_mch_id)) { + params.put("sub_mch_id", sub_mch_id); + } + return params; } @@ -163,6 +169,7 @@ public class NewSubMerchantIdApply { put("principal_name",subMerchantApplyInfo.getString("principal_name")); put("principal_id_number",subMerchantApplyInfo.getString("principal_id_number")); put("business_type",subMerchantApplyInfo.getString("business_type")); + put("sub_merchant_id",subMerchantApplyInfo.getString("sub_merchant_id")); }}; } @@ -320,4 +327,12 @@ public class NewSubMerchantIdApply { public void setBusiness_type(String business_type) { this.business_type = business_type; } + + public String getSub_mch_id() { + return sub_mch_id; + } + + public void setSub_mch_id(String sub_mch_id) { + this.sub_mch_id = sub_mch_id; + } } 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 b07dce613..2837dde2d 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 @@ -110,6 +110,7 @@ import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateUtils; +import org.apache.http.util.TextUtils; import org.apache.poi.hssf.usermodel.*; import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.ss.usermodel.CellStyle; @@ -880,7 +881,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid private void saveWechatMcc(JSONObject partner){ JSONObject wxGoodMcc = paymentChannelMccGoodMapper.findWechatPayMccByClientId(partner.getIntValue("client_id")); - if (wxGoodMcc == null || wxGoodMcc.isEmpty()) { + if ((wxGoodMcc == null || wxGoodMcc.isEmpty())&& !TextUtils.isEmpty(partner.getString("mc_code"))) { wxGoodMcc = new JSONObject(); wxGoodMcc.put("client_id",partner.getIntValue("client_id")); wxGoodMcc.put("mc_code",partner.getString("mc_code")); @@ -890,8 +891,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid paymentChannelMccGoodMapper.save(wxGoodMcc); return; } - wxGoodMcc.put("mc_code",partner.getString("mc_code")); - paymentChannelMccGoodMapper.update(wxGoodMcc); + if(!TextUtils.isEmpty(partner.getString("mc_code"))) { + wxGoodMcc.put("mc_code", partner.getString("mc_code")); + paymentChannelMccGoodMapper.update(wxGoodMcc); + } } @@ -5751,7 +5754,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid params.put("operator", manager.getString("display_name")); - sysWxMerchantApplyMapper.updateSubMerchantInfoByMerchantAppId(params); Element elem = wxPayClient.modfiySubMerchant(subMerchantIdApply.getMerchant_id(), subMerchantInfo); String sub_merchant_id = elem.elementText("sub_mch_id"); diff --git a/src/main/ui/static/payment/partner/add-partner.js b/src/main/ui/static/payment/partner/add-partner.js index 3b28d185f..c811d41fa 100644 --- a/src/main/ui/static/payment/partner/add-partner.js +++ b/src/main/ui/static/payment/partner/add-partner.js @@ -246,11 +246,11 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }); return; } - if (!$scope.partner.business_structure||$scope.partner.business_structure == '') { + if ($scope.partner.enable_cross_payment&&(!$scope.partner.business_structure||$scope.partner.business_structure == '')) { alert('Please select the business structure'); return; } - if ($scope.partner.business_structure!='Registered body(Sole Trader)') { + if ($scope.partner.business_structure&&$scope.partner.business_structure!='Registered body(Sole Trader)') { if ($scope.partner.certificat_expire_date_d) { $scope.partner.certificat_expire_date = $filter('dateConversionStr')($scope.partner.certificat_expire_date_d) } else if ($scope.partner.certificat_expire_date_premanent) { @@ -728,7 +728,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter alert('Please select the business structure'); return; } - if ($scope.partner.business_structure!='Registered body(Sole Trader)') { + if ($scope.partner.business_structure&&$scope.partner.business_structure!='Registered body(Sole Trader)') { if ($scope.partner.certificat_expire_date_d) { $scope.partner.certificat_expire_date = $filter('dateConversionStr')($scope.partner.certificat_expire_date_d) } else if ($scope.partner.certificat_expire_date_premanent) { diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index 18762a628..c613fa0fb 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -5689,23 +5689,23 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter // $scope.hideMerchantInfo = function () { // $scope.showMoreMerchantInfo = !$scope.showMoreMerchantInfo; // }; - // $scope.updateSubMerchantId = function (merchant_app_id) { - // $uibModal.open({ - // templateUrl: '/static/payment/partner/templates/update_apply_wx_sub_merchant_id.html', - // controller: 'updateApplyWxSubMerchantIdCtrl', - // resolve: { - // merchantInfo: $scope.partner, - // merchantIds: ['$http', '$stateParams', function ($http) { - // return $http.get('/sys/partners/' + $scope.partner.client_moniker + '/get_merchant_ids'); - // }], - // subMerchantInfo: ['$http', '$stateParams', function ($http) { - // return $http.get('/sys/partners/' + $scope.partner.client_moniker + '/get_merchant_ids/' + merchant_app_id); - // }] - // } - // }).result.then(function () { - // $scope.loadSubMerchantInfos(); - // }) - // } + $scope.updateSubMerchantId = function (merchant_app_id) { + $uibModal.open({ + templateUrl: '/static/payment/partner/templates/update_apply_wx_sub_merchant_id.html', + controller: 'updateApplyWxSubMerchantIdCtrl', + resolve: { + merchantInfo: $scope.partner, + merchantIds: ['$http', '$stateParams', function ($http) { + return $http.get('/sys/partners/' + $scope.partner.client_moniker + '/get_merchant_ids'); + }], + subMerchantInfo: ['$http', '$stateParams', function ($http) { + return $http.get('/sys/partners/' + $scope.partner.client_moniker + '/get_merchant_ids/' + merchant_app_id); + }] + } + }).result.then(function () { + $scope.loadSubMerchantInfos(); + }) + } // $scope.useRpaySubMerchantId = function (sub_merchant_id) { // $http.put('/sys/partners/' + $scope.partner.client_moniker + '/rpay_payment_config', { rpay_enterprise_id: sub_merchant_id }).then(function (resp) { // commonDialog.alert({ @@ -6037,21 +6037,50 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.merchantInfo = angular.copy(merchantInfo); $scope.wechatMccIndustries = wechatGoodMcc.configs(); $scope.merchantIds = merchantIds.data; - $scope.businessTypesMap = businessTypesMap.configs(); + $scope.businessTypesMap=businessTypesMap.configs(); - if ($scope.subMerchantInfo.business_structure) { - $scope.subMerchantInfo.merchant_type = $scope.subMerchantInfo.business_structure != 'Registered body(Sole Trader)' ? "ENTERPRISE" : "INDIVIDUAL"; + if($scope.subMerchantInfo.extra_merchant_type ){ + $scope.subMerchantInfo.merchant_type=$scope.subMerchantInfo.extra_merchant_type; } - if ($scope.subMerchantInfo.industry) { + if($scope.subMerchantInfo.industry) { $scope.subMerchantInfo.industry = $filter('newWxMerchantsFilter')($scope.subMerchantInfo.industry); } - if ($scope.subMerchantInfo.mcc_code) { - $scope.subMerchantInfo.mcc_code = parseInt($scope.subMerchantInfo.mcc_code); + if($scope.subMerchantInfo.mcc_code ){ + $scope.subMerchantInfo.mcc_code=parseInt($scope.subMerchantInfo.mcc_code); } - if ($scope.subMerchantInfo.certificat_expire_date) { - // var datestr = subMerchantInfo.certificat_expire_date.replace(/-/g, '/'); - $scope.subMerchantInfo.certificat_expire_date = new Date($scope.subMerchantInfo.certificat_expire_date); + // if($scope.subMerchantInfo.certificat_expire_date) { + // // var datestr = subMerchantInfo.certificat_expire_date.replace(/-/g, '/'); + // $scope.subMerchantInfo.certificat_expire_date=new Date($scope.subMerchantInfo.certificat_expire_date); + // } + if($scope.subMerchantInfo.certificat_expire_date) { + if( $scope.subMerchantInfo.certificat_expire_date=="PERMANENT"){ + $scope.subMerchantInfo.certificat_expire_date_premanent=true; + }else if( $scope.subMerchantInfo.certificat_expire_date=="N/A"){ + $scope.subMerchantInfo.certificat_expire_date_NA=true; + }else { + var datestr = $scope.subMerchantInfo.certificat_expire_date.replace(/-/g, '/'); + $scope.subMerchantInfo.certificat_expire_date_d = new Date(datestr); + } + } + $scope.checkExpriedate=function (value) { + if(value){ + $scope.subMerchantInfo.certificat_expire_date_premanent=false; + $scope.subMerchantInfo.certificat_expire_date_NA=false; + } + } + $scope.checkExpriedateOther=function (value) { + if(value=='PERMANENT'){ + if($scope.subMerchantInfo.certificat_expire_date_premanent){ + $scope.subMerchantInfo.certificat_expire_date_NA=false; + $scope.subMerchantInfo.certificat_expire_date_d=null; + } + }else if(value=='N/A'){ + if($scope.subMerchantInfo.certificat_expire_date_NA){ + $scope.subMerchantInfo.certificat_expire_date_premanent=false; + $scope.subMerchantInfo.certificat_expire_date_d=null; + } + } } $scope.updateApply = function (form) { $scope.errmsg = null; @@ -6064,44 +6093,61 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter return; } var params = { - company_name: $scope.subMerchantInfo.company_name, - merchant_id: $scope.subMerchantInfo.merchant_id, - short_name: $scope.subMerchantInfo.short_name, - office_phone: $scope.subMerchantInfo.office_phone, - contact_person: $scope.subMerchantInfo.contact_person, - contact_phone: $scope.subMerchantInfo.contact_phone, - company_phone: $scope.subMerchantInfo.company_phone, - contact_email: $scope.subMerchantInfo.contact_email, - industry: $scope.subMerchantInfo.industry, - company_website: $scope.subMerchantInfo.company_website, + company_name : $scope.subMerchantInfo.company_name, + merchant_id : $scope.subMerchantInfo.merchant_id, + short_name : $scope.subMerchantInfo.short_name, + office_phone : $scope.subMerchantInfo.office_phone, + contact_person : $scope.subMerchantInfo.contact_person, + contact_phone : $scope.subMerchantInfo.contact_phone, + company_phone : $scope.subMerchantInfo.company_phone, + contact_email : $scope.subMerchantInfo.contact_email, + industry : $scope.subMerchantInfo.industry, + company_website : $scope.subMerchantInfo.company_website, merchant_type: $scope.subMerchantInfo.merchant_type, - mcc_code: $scope.subMerchantInfo.mcc_code, + mcc_code : $scope.subMerchantInfo.mcc_code, address: $scope.subMerchantInfo.address, - business_type: $scope.subMerchantInfo.business_type + business_type:$scope.subMerchantInfo.business_type, + sub_mch_id:$scope.subMerchantInfo.sub_merchant_id, }; - if (params.business_type == 'ONLINE') { - params.address = null; - } - else if (params.business_type == 'OFFLINE') { - params.company_website = null; - } - if ($scope.subMerchantInfo.merchant_type == 'ENTERPRISE') { - params.director_name = $scope.subMerchantInfo.director_name; - params.director_id_number = $scope.subMerchantInfo.director_id_number; + if(params.business_type=='ONLINE'){ + params.address=null; + } + else if(params.business_type=='OFFLINE'){ + params.company_website=null; + } + // if($scope.subMerchantInfo.merchant_type == 'ENTERPRISE'){ + // params.director_name = $scope.subMerchantInfo.director_name; + // params.director_id_number = $scope.subMerchantInfo.director_id_number; + // params.company_register_no = $scope.subMerchantInfo.company_register_no; + // params.certificat_expire_date = $scope.subMerchantInfo.certificat_expire_date; + // if($scope.subMerchantInfo.certificat_expire_date) { + // params.certificat_expire_date = $filter('dateConversionStr')($scope.subMerchantInfo.certificat_expire_date) + // } + // }else{ + // params.principal_name = $scope.subMerchantInfo.principal_name; + // params.principal_id_number = $scope.subMerchantInfo.principal_id_number; + // } + if(params.merchant_type == 'ENTERPRISE'){ params.company_register_no = $scope.subMerchantInfo.company_register_no; params.certificat_expire_date = $scope.subMerchantInfo.certificat_expire_date; - if ($scope.subMerchantInfo.certificat_expire_date) { - params.certificat_expire_date = $filter('dateConversionStr')($scope.subMerchantInfo.certificat_expire_date) + if($scope.subMerchantInfo.certificat_expire_date_d) { + params.certificat_expire_date = $filter('dateConversionStr')($scope.subMerchantInfo.certificat_expire_date_d) + }else if($scope.subMerchantInfo.certificat_expire_date_premanent){ + params.certificat_expire_date="PERMANENT"; + } + else if($scope.subMerchantInfo.certificat_expire_date_NA){ + params.certificat_expire_date="N/A"; + }else{ + alert("Certificate expiration time is required"); + return; } - } else { - params.principal_name = $scope.subMerchantInfo.principal_name; - params.principal_id_number = $scope.subMerchantInfo.principal_id_number; } - - $http.put('/sys/partners/' + $scope.merchantInfo.client_moniker + '/get_merchant_ids/' + $scope.subMerchantInfo.merchant_app_id, params).then(function (resp) { + $http.put('/sys/partners/' + $scope.merchantInfo.client_moniker + '/get_merchant_ids/'+$scope.subMerchantInfo.merchant_app_id, params).then(function (resp) { $scope.apply_sub_merchant_id = resp.data; $scope.$close(); - commonDialog.confirm({ title: 'Confirm', content: '微信商户进件已修改成功!' }) + commonDialog.confirm({title: 'Confirm', content: 'Successfully modified!'}) + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) }); } }]); diff --git a/src/main/ui/static/payment/partner/templates/new_apply_wx_sub_merchant_id.html b/src/main/ui/static/payment/partner/templates/new_apply_wx_sub_merchant_id.html index 71120fbf9..bb1789c49 100644 --- a/src/main/ui/static/payment/partner/templates/new_apply_wx_sub_merchant_id.html +++ b/src/main/ui/static/payment/partner/templates/new_apply_wx_sub_merchant_id.html @@ -40,7 +40,7 @@
Required Field
@@ -40,13 +40,13 @@Required Field
-Length is more than 50
+Length is more than 20
(Not required when business type is Offline scenario)
Required Field
(Not required when business type is Online scenario)
Required Field
Length is more than 128
@@ -119,17 +121,18 @@ ng-class="{'has-error':subForm.office_phone.$invalid && subForm.office_phone.$dirty}">Required Field
+Length is more than 20
Required Field
-Length is more than 128
-Required Field
-Length is more than 50
-PERMANENT
+ + + + +N/A
+ + + + + + +