diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysRpayMerchantApplyMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysRpayMerchantApplyMapper.java index 06664dc14..898ac3661 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysRpayMerchantApplyMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysRpayMerchantApplyMapper.java @@ -10,7 +10,7 @@ import org.apache.ibatis.annotations.Param; import java.util.List; /** - * Created by yangluo on 2017-03-14. + * Created by yangluo on 2018-09-18. */ @AutoMapper(tablename = "sys_rpay_merchant_apply",pkName = "merchant_app_id") public interface SysRpayMerchantApplyMapper { 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 3e03074d9..377d370cf 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 @@ -336,7 +336,8 @@ public interface ClientManager { void sendHfEmailNotice(JSONObject order); - void subRpayMerchantApplication(String clientMoniker, JSONObject manager); + void subRpayMerchantApplication(String clientMoniker,JSONObject merchantInfo, JSONObject manager); void updateAllPartnerPassword(String clientMoniker, List emails); + } 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 01d570fc5..1785bb42e 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 @@ -239,6 +239,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid @Resource private WxPayClient wxPayClient; + @Resource + private RpayApi rpayApi; + @Resource private ManagerMapper managerMapper; @Resource @@ -282,8 +285,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid @Resource private ClientInfoCacheSupport clientInfoCacheSupport; - @Resource - private RpayApi rpayApi; @Resource private SimpleClientApplyService simpleClientApplyService; @Resource @@ -3598,33 +3599,32 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public void subRpayMerchantApplication(String clientMoniker, JSONObject manager) { + public void subRpayMerchantApplication(String clientMoniker, JSONObject merchantInfo,JSONObject manager) { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); } checkOrgPermission(manager, client); - List listByshortName = sysRpayMerchantApplyMapper.listByShortName(client.getIntValue("client_id"),client.getString("short_name")); + List listByshortName = sysRpayMerchantApplyMapper.listByShortName(client.getIntValue("client_id"),merchantInfo.getString("company_shortname")); if (listByshortName.size()>0) { throw new BadRequestException("请修改【" + clientMoniker + "】的Company shortName信息(请避免和Rpay+商务号列表内的Company Short Name重复)"); } - SubRpayMerchantInfo subRpayMerchantInfo = JSONObject.toJavaObject(client, SubRpayMerchantInfo.class); + SubRpayMerchantInfo subRpayMerchantInfo = JSONObject.toJavaObject(merchantInfo, SubRpayMerchantInfo.class); subRpayMerchantInfo.CheckEmpty(); JSONObject rpayMerchantInfo = rpayApi.registerMerchant(client.getIntValue("client_id"), subRpayMerchantInfo); if (rpayMerchantInfo != null) { - JSONObject merchantApply = new JSONObject(); - merchantApply.put("merchant_id", rpayMerchantInfo.getString("rpay_order_id")); - merchantApply.put("client_id", client.getString("client_id")); - merchantApply.put("create_time", new Date()); - merchantApply.put("operator", manager.getString("display_name")); - merchantApply.put("sub_merchant_id", rpayMerchantInfo.getString("merchantId")); - merchantApply.put("business_category", client.getString("royalpayindustry")); - merchantApply.put("merchant_shortname", client.getString("short_name")); - sysRpayMerchantApplyMapper.insertRpayMerchantApply(merchantApply); + merchantInfo.put("merchant_id", rpayMerchantInfo.getString("rpay_order_id")); + merchantInfo.put("client_id", client.getString("client_id")); + merchantInfo.put("create_time", new Date()); + merchantInfo.put("operator", manager.getString("display_name")); + merchantInfo.put("sub_merchant_id", rpayMerchantInfo.getString("merchantId")); + merchantInfo.put("business_category", client.getString("royalpayindustry")); + merchantInfo.put("merchant_shortname", merchantInfo.getString("company_shortname")); + sysRpayMerchantApplyMapper.insertRpayMerchantApply(merchantInfo); clientMapper.updateRpayEnterpriseId(client.getIntValue("client_id"), rpayMerchantInfo.getString("merchantId")); }else { throw new BadRequestException("请求失败"); 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 6d186abbe..76edb9f5c 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 @@ -17,9 +17,7 @@ import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.http.HttpUtils; import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig; import au.com.royalpay.payment.tools.permission.enums.ManagerRole; - import com.alibaba.fastjson.JSONObject; - import org.springframework.validation.Errors; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; @@ -581,9 +579,10 @@ public class PartnerManageController { public void switchHfEmailNotice(@PathVariable String clientMoniker, @RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { clientManager.switchPermission(manager, clientMoniker, "enable_hf_email_notice", pass.getBooleanValue("allow")); } + @ManagerMapping(value = "/{clientMoniker}/registRpaySubMerchantId", method = RequestMethod.POST, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) - public void subRpayMerchantApplication(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { - clientManager.subRpayMerchantApplication(clientMoniker, manager); + public void subRpayMerchantApplication(@PathVariable String clientMoniker,@RequestBody JSONObject merchantInfo,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + clientManager.subRpayMerchantApplication(clientMoniker, merchantInfo,manager); } } diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index 794065363..bb47df893 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -3142,20 +3142,17 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }) }; $scope.applyRpaySubMerchantId = function () { - $http.post('/sys/partners/' + $scope.partner.client_moniker + '/registRpaySubMerchantId').then(function (resp) { - commonDialog.alert({ - title: 'Success', - content: 'Modify Rpay+ Sub Merchant ID successfully', - type: 'success' - }); - $state.reload(); - }, function (resp) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) - }); - - - - + $uibModal.open({ + templateUrl: '/static/payment/partner/templates/apply_rpay_sub_merchant_id.html', + controller: 'applyRpaySubMerchantIdCtrl', + resolve: { + subMerchantInfo: function () { + return $scope.partner; + } + } + }).result.then(function () { + $scope.loadSubMerchantInfos(); + }) }; $scope.loadSubMerchantInfos(); }]); @@ -3203,10 +3200,57 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }); } }, function (resp) { - $scope.errmsg = resp.data.message; + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) }) } }]); + + app.controller('applyRpaySubMerchantIdCtrl', ['$scope', '$http', '$uibModal', '$state', 'subMerchantInfo', 'businessStructuresMap','$filter', 'commonDialog','timezone', function ($scope, $http, $uibModal, $state, subMerchantInfo, businessStructuresMap,$filter, commonDialog,timezone) { + $scope.subMerchantInfo = angular.copy(subMerchantInfo); + $scope.business_structures = businessStructuresMap.configs(); + $scope.timezone = timezone.configs(); + + + $scope.saveRpayAppliy = function (form) { + var merchantInfo = {}; + $scope.errmsg = null; + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true; + } + }); + return; + } + angular.forEach(form, function (item, key) { + if(item !=null) { + if(item.$name !=null) { + merchantInfo[key] = item.$modelValue; + } + } + }); + + $http.post('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/registRpaySubMerchantId', merchantInfo).then(function (resp) { + $scope.apply_sub_merchant_id = resp.data; + $scope.$close(); + if (subMerchantInfo.sub_merchant_id != null) { + commonDialog.alert({ + title: 'Success', + content: 'Modify Rpay+ Sub Merchant ID successfully', + type: 'success' + }); + $state.reload(); + } + }, function (resp) { + commonDialog.alert({ + title: 'Error', + content: resp.data.message, + type: 'error' + }); + }) + } + }]); + app.controller('permissionClientCtrl', ['$scope', '$http', '$uibModal', '$state', '$filter', 'commonDialog', function ($scope, $http, $uibModal, $state, $filter, commonDialog) { $scope.clientPermission = {client_moniker:$scope.partner.client_moniker}; $scope.loadPermissionList = function () { diff --git a/src/main/ui/static/payment/partner/templates/apply_rpay_sub_merchant_id.html b/src/main/ui/static/payment/partner/templates/apply_rpay_sub_merchant_id.html new file mode 100644 index 000000000..bf36efcf3 --- /dev/null +++ b/src/main/ui/static/payment/partner/templates/apply_rpay_sub_merchant_id.html @@ -0,0 +1,243 @@ +
+
+
+
+
+
Apply Rpay+ Sub Merchant Id
+
+
+
+ +
+ +
+

Required Field

+

Length is more than 50

+
+
+
+ +
+ +
+ +
+

Required Field

+

Length is more than 50

+
+
+
+ +
+ +
+ +
+

Required Field

+

Length is more than 50

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

Required Field

+

Length is more than 256

+
+
+
+ +
+ +
+ +
+

Required Field

+
+
+
+ +
+ +
+ +
+

Required Field

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

Required Field

+
+
+ +
+ +
+ +
+ +
+

Required Field

+
+
+
+ +
+ +
+ +
+

Required Field

+
+
+
+ +
+ +
+ +
+

Required Field

+
+
+
+ +
+ +
+ +
+

Required Field

+
+
+
+ +
+ +
+ +
+

Required Field

+

Length is more than 50

+
+
+
+ +
+ +
+ +
+

Required Field

+
+
+
+ +
+ +
+ +
+

Required Field

+
+
+
+ +
+ +
+ +
+

Required Field

+

Length is more than 10

+
+
+
+ +
+ +
+ +
+
+ + + + + +
+
+
+ + + + + + + + +
+ +
+
+
+
+
\ No newline at end of file diff --git a/src/main/ui/static/payment/partner/templates/apply_sub_merchant_id.html b/src/main/ui/static/payment/partner/templates/apply_wx_sub_merchant_id.html similarity index 99% rename from src/main/ui/static/payment/partner/templates/apply_sub_merchant_id.html rename to src/main/ui/static/payment/partner/templates/apply_wx_sub_merchant_id.html index 34b94f7d4..58b227e73 100644 --- a/src/main/ui/static/payment/partner/templates/apply_sub_merchant_id.html +++ b/src/main/ui/static/payment/partner/templates/apply_wx_sub_merchant_id.html @@ -3,7 +3,7 @@
-
Apply Sub Merchant Id
+
Apply Wechat Sub Merchant Id