From b53b11a1a1145ba75be4e449f9f339888cb0731b Mon Sep 17 00:00:00 2001 From: luoyang Date: Wed, 24 Jul 2019 13:55:02 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E6=94=AF=E4=BB=98=E5=AE=9Donline=20inser?= =?UTF-8?q?t=20partner=E6=89=B9=E9=87=8F=E6=8A=A5=E5=A4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../manage/dev/core/AliforexcelService.java | 2 + .../dev/core/impl/AliforexcelServiceImpl.java | 59 +++++++++++++++++++ .../manage/dev/web/TestController.java | 5 ++ .../ui/static/config/devtools/devtools.js | 18 ++++++ .../registerAlipayOnlineMerchant.html | 4 ++ 6 files changed, 89 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a1e8c8032..55932b945 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ 4.0.0 manage - 1.0.25 + 1.0.26 UTF-8 diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/core/AliforexcelService.java b/src/main/java/au/com/royalpay/payment/manage/dev/core/AliforexcelService.java index ea77df4ec..e854e4423 100644 --- a/src/main/java/au/com/royalpay/payment/manage/dev/core/AliforexcelService.java +++ b/src/main/java/au/com/royalpay/payment/manage/dev/core/AliforexcelService.java @@ -17,6 +17,8 @@ public interface AliforexcelService { JSONObject registerInsertAlipayMerchant(String partners); + JSONObject registerInsertAlipayOnlineMerchant(String partners); + JSONObject getLessPartnerInfo(); void initClientPayType(int begin,int end); diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/AliforexcelServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/AliforexcelServiceImpl.java index 5c50f54fe..46a94aec3 100644 --- a/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/AliforexcelServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/AliforexcelServiceImpl.java @@ -267,6 +267,65 @@ public class AliforexcelServiceImpl implements AliforexcelService { return result; } + @Override + public JSONObject registerInsertAlipayOnlineMerchant(String partners) { + String[] partner = partners.split(","); + JSONObject result = new JSONObject(); + List needRegisterMerchant = new ArrayList<>(); + List registerSuccessMerchant = new ArrayList<>(); + List registerFailMerchant = new ArrayList<>(); + List lessInfoMerchant = new ArrayList<>(); + for (String clientMoniker : partner) { + JSONObject client = clientMapper.findClientByMoniker(clientMoniker); + if (client == null) { + continue; + } + try { + needRegisterMerchant.add(client.getString("client_moniker")); + if (StringUtils.isBlank(client.getString("alipayindustry"))) { + client.put("alipayindustry", "5311"); + } + if (StringUtils.isBlank(client.getString("business_structure"))) { + client.put("business_structure", "da"); + } + if (StringUtils.isBlank(client.getString("company_website"))) { + client.put("company_website", client.getString("ali_sub_merchant_id")+".royalpay.com.au"); + } + checkPartnerInfo(client,"online"); + } catch (InvalidParameterException e) { + JSONObject exception = new JSONObject(); + exception.put("client_moniker", client.getString("client_moniker")); + exception.put("return_msg", e.getMessage()); + exception.put("bd_name", client.getString("bd_user_name")); + lessInfoMerchant.add(exception); + continue; + } + AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayOnlineMerchant(); + Element resultElement = alipayClient.registerOnlineGmsPortal(mch.getPid(), client); + if (!StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) { + JSONObject exception = new JSONObject(); + exception.put("client_moniker", client.getString("client_moniker")); + exception.put("return_msg", resultElement.elementText("error")); + registerFailMerchant.add(exception); + continue; + } + Element responseElement = resultElement.element("response").element("alipay"); + if (!StringUtils.equalsIgnoreCase("SUCCESS", responseElement.elementText("result_code"))) { + JSONObject exception = new JSONObject(); + exception.put("client_moniker", client.getString("client_moniker")); + exception.put("return_msg", resultElement.elementText("error")); + registerFailMerchant.add(exception); + continue; + } + registerSuccessMerchant.add(client.getString("client_moniker")); + } + result.put("need_register_merchant", needRegisterMerchant); + result.put("success_register_merchant", registerSuccessMerchant); + result.put("fail_register_merchant", registerFailMerchant); + result.put("less_info_merchant", lessInfoMerchant); + return result; + } + @Override public JSONObject getLessPartnerInfo() { JSONObject result = new JSONObject(); diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java b/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java index 13418cd84..8e5906843 100644 --- a/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java +++ b/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java @@ -469,6 +469,11 @@ public class TestController implements ApplicationEventPublisherAware { return aliforexcelService.registerInsertAlipayMerchant(partners.getString("partners")); } + @ManagerMapping(value = "/register/alipayOnlineGms/insert_partner", role = ManagerRole.DEVELOPER, method = RequestMethod.POST) + public JSONObject registerInsertAlipayOnlineMerchant(@RequestBody JSONObject partners) { + return aliforexcelService.registerInsertAlipayOnlineMerchant(partners.getString("partners")); + } + @ManagerMapping(value = "/register/getLessPartnerInfo", role = ManagerRole.DEVELOPER, method = RequestMethod.GET) public JSONObject getLessPartnerInfo() { return aliforexcelService.getLessPartnerInfo(); diff --git a/src/main/ui/static/config/devtools/devtools.js b/src/main/ui/static/config/devtools/devtools.js index a97576c01..5d29749f3 100644 --- a/src/main/ui/static/config/devtools/devtools.js +++ b/src/main/ui/static/config/devtools/devtools.js @@ -456,6 +456,24 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) { }) }; + $scope.registerInsertOnlineGMS = function (text) { + $scope.totalhide = true; + $scope.selecttotal = false; + var params = {}; + params.partners = text; + $http.post('/dev/register/alipayOnlineGms/insert_partner',params).then(function (resp) { + $scope.totalhide = false; + $scope.selecttotal = true; + $scope.need_register_merchant = resp.data.need_register_merchant.toString(); + $scope.success_register_merchant = resp.data.success_register_merchant.toString(); + $scope.fail_register_merchant = resp.data.fail_register_merchant; + $scope.less_info_merchant = resp.data.less_info_merchant(); + }, function (resp) { + alert(resp.data.message); + }) + }; + + $scope.getLessPartnerInfo = function () { $scope.totalhide = true; $scope.selecttotal = false; diff --git a/src/main/ui/static/config/devtools/templates/registerAlipayOnlineMerchant.html b/src/main/ui/static/config/devtools/templates/registerAlipayOnlineMerchant.html index 12a73e0d6..915099d33 100644 --- a/src/main/ui/static/config/devtools/templates/registerAlipayOnlineMerchant.html +++ b/src/main/ui/static/config/devtools/templates/registerAlipayOnlineMerchant.html @@ -22,6 +22,10 @@ +
+ + +
需要报备的商户编码