From 45286ac2d37b864239d11901bb0d5eecfbd7213d Mon Sep 17 00:00:00 2001 From: luoyang Date: Fri, 26 Jul 2019 15:53:40 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E6=94=AF=E4=BB=98=E5=AE=9D=E7=BA=BF?= =?UTF-8?q?=E4=B8=8A=E6=89=B9=E9=87=8F=E6=8A=A5=E5=A4=87range?= 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 | 63 ++++++++++++++++++- .../manage/dev/web/TestController.java | 5 ++ .../manage/mappers/system/ClientMapper.java | 2 +- .../manage/mappers/system/ClientMapper.xml | 1 + 6 files changed, 72 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 309394dd5..3fa7174b3 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ 4.0.0 manage - 1.0.29 + 1.0.30 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 e854e4423..7581c3d9d 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 @@ -13,6 +13,8 @@ public interface AliforexcelService { JSONObject registerAlipayOnlineMerchant(); + JSONObject registerRangeAlipayOnlineMerchant(int start,int end); + JSONObject registerAlipayMerchant(); JSONObject registerInsertAlipayMerchant(String partners); 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 04e8acdfe..9b1cc391b 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 @@ -109,7 +109,68 @@ public class AliforexcelServiceImpl implements AliforexcelService { List registerSuccessMerchant = new ArrayList<>(); List registerFailMerchant = new ArrayList<>(); List lessInfoMerchant = new ArrayList<>(); - List useAlipayOnlineMerchant = clientMapper.listUseAlipayMerchant(); + List useAlipayOnlineMerchant = clientMapper.listUseAlipayMerchant(0,10000); + for (int clientId : useAlipayOnlineMerchant) { + JSONObject client = clientMapper.findClient(clientId); + if (client == null) { + continue; + } + try { + needRegisterMerchant.add(client.getString("client_moniker")); + 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; + } + try { + 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")); + } catch (Exception e) { + JSONObject exception = new JSONObject(); + exception.put("client_moniker", client.getString("client_moniker")); + exception.put("return_msg", e.getMessage()); + registerFailMerchant.add(exception); + } + } + result.put("need_register_merchant", needRegisterMerchant); + result.put("success_register_merchant", registerSuccessMerchant); + result.put("fail_register_merchant", registerFailMerchant); + result.put("less_info_merchant", lessInfoMerchant); + logger.info("-------AlipayOnline Gms end----fail_register_merchant"+registerFailMerchant.toString()); + return result; + } + + @Override + public JSONObject registerRangeAlipayOnlineMerchant(int start, int end) { + JSONObject result = new JSONObject(); + List needRegisterMerchant = new ArrayList<>(); + List registerSuccessMerchant = new ArrayList<>(); + List registerFailMerchant = new ArrayList<>(); + List lessInfoMerchant = new ArrayList<>(); + List useAlipayOnlineMerchant = clientMapper.listUseAlipayMerchant(start,end); for (int clientId : useAlipayOnlineMerchant) { JSONObject client = clientMapper.findClient(clientId); if (client == null) { 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 8e5906843..772075c1c 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 @@ -459,6 +459,11 @@ public class TestController implements ApplicationEventPublisherAware { return aliforexcelService.registerAlipayOnlineMerchant(); } + @ManagerMapping(value = "/register/alipayOnlineGms", role = ManagerRole.DEVELOPER, method = RequestMethod.GET) + public JSONObject registerRangeAlipayOnlineMerchant(@RequestParam int start,@RequestParam int end) { + return aliforexcelService.registerRangeAlipayOnlineMerchant(start,end); + } + @ManagerMapping(value = "/register/alipayGms", role = ManagerRole.DEVELOPER, method = RequestMethod.POST) public JSONObject registerAlipayMerchant() { return aliforexcelService.registerAlipayMerchant(); diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java index 062933a06..38465c092 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java @@ -137,6 +137,6 @@ public interface ClientMapper { JSONObject findCountByBd(@Param("bd_group") String bd_group, @Param("today") Date today, @Param("yesterday") Date yesterday, @Param("month") Date month); - List listUseAlipayMerchant(); + List listUseAlipayMerchant(@Param("start") int start, @Param("end") int end); } diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml index e38fbae78..efabf9951 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml @@ -739,5 +739,6 @@