From 947609278dfcc3dde045ade6625c973c41a82777 Mon Sep 17 00:00:00 2001 From: liuxinxin Date: Thu, 16 Jan 2020 16:17:48 +0800 Subject: [PATCH] =?UTF-8?q?[R]=20=E5=BC=80=E5=8F=91=E5=B7=A5=E5=85=B7=20?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=8A=A5=E5=85=B3=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../manage/dev/web/TestController.java | 26 +++++++++++++++++ .../payment/CommonSubMerchantIdMapper.java | 1 + .../ui/static/config/devtools/devtools.js | 22 ++++++++++++++- .../templates/custom_declare_check.html | 28 +++++++++++++++++++ .../config/devtools/templates/root.html | 6 +++- 6 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 src/main/ui/static/config/devtools/templates/custom_declare_check.html diff --git a/pom.xml b/pom.xml index aa1796787..5a43a0b33 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 manage - 1.3.19 + 1.3.20 UTF-8 1.4.0 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 46dd5d86a..e3d2ba4f6 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 @@ -10,6 +10,7 @@ import au.com.royalpay.payment.channels.yeepay.runtime.YeePayClient; import au.com.royalpay.payment.core.PaymentApi; import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; import au.com.royalpay.payment.core.exceptions.OrderNotExistsException; +import au.com.royalpay.payment.core.mappers.PmtCustomReportMapper; import au.com.royalpay.payment.manage.analysis.core.ATOReportService; import au.com.royalpay.payment.manage.analysis.core.DashboardService; import au.com.royalpay.payment.manage.analysis.core.PlatformClearService; @@ -61,6 +62,7 @@ import org.springframework.util.Assert; import org.springframework.validation.Errors; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; +import au.com.royalpay.payment.tools.exceptions.NotFoundException; import javax.annotation.Resource; import javax.servlet.ServletOutputStream; @@ -148,6 +150,8 @@ public class TestController implements ApplicationEventPublisherAware { private DashboardService dashboardService; @Resource private SynchronizedScheduler synchronizedScheduler; + @Resource + private PmtCustomReportMapper pmtCustomReportsMapper; @ManagerMapping(value = "/{clientMoniker}/export/agreepdf", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.DIRECTOR, ManagerRole.OPERATOR}) public void exportAgreeFile(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, HttpServletResponse httpResponse) throws Exception { @@ -560,6 +564,28 @@ public class TestController implements ApplicationEventPublisherAware { }); } + @ManagerMapping(value = "/custom_declare_check/{reportId}/detail", method = RequestMethod.GET, role = ManagerRole.DEVELOPER) + public JSONObject checkCustomDeclareOrderDetail(@PathVariable String reportId) { + JSONObject report = pmtCustomReportsMapper.findCustomReport(reportId); + if (report == null || report.isEmpty()) { + throw new NotFoundException("Report Not Exists"); + } + JSONObject order = orderMapper.find(report.getString("order_id")); + String declareResp; + + if (StringUtils.equals("Wechat", report.getString("channel"))) { + declareResp = XmlFormatUtils.formatXml(wxPayClient.declareCustomQuery(order.getString("merchant_id"), report,null,false)); + } else if (StringUtils.equals("Alipay", report.getString("channel"))) { + declareResp = XmlFormatUtils.formatXml(alipayClient.queryCustomStatus(order.getString("merchant_id"), report,null,false)); + } else { + throw new BadRequestException("Invalid Channel:" + report.getString("channel")); + } + JSONObject res = new JSONObject(); + res.put("xml", declareResp); + return res; + } + + @GetMapping("/client/customer") public ModelAndView redirectClientCustomer() { JSONObject result = new JSONObject(); diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/CommonSubMerchantIdMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/CommonSubMerchantIdMapper.java index 0e2acbd70..b21d68e15 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/CommonSubMerchantIdMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/CommonSubMerchantIdMapper.java @@ -27,5 +27,6 @@ public interface CommonSubMerchantIdMapper { void update(JSONObject record); @AutoSql(type = SqlType.SELECT) + @AdvanceSelect(addonWhereClause = "is_valid = 1") JSONObject find(@Param("sub_merchant_id") String subMerchantId); } diff --git a/src/main/ui/static/config/devtools/devtools.js b/src/main/ui/static/config/devtools/devtools.js index 5d29749f3..babb78ded 100644 --- a/src/main/ui/static/config/devtools/devtools.js +++ b/src/main/ui/static/config/devtools/devtools.js @@ -71,6 +71,10 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) { url: '/registerAlipayOnlineMerchant', templateUrl: '/static/config/devtools/templates/registerAlipayOnlineMerchant.html', controller: 'registerAlipayOnlineMerchantCtrl' + }).state('devtools.custom_declare_check', { + url: '/custom_declare_check', + templateUrl: '/static/config/devtools/templates/custom_declare_check.html', + controller: 'devCustomDeclareCheckCtrl' }) }]); app.controller('devManualRefundCtrl', ['$scope', '$http', 'commonDialog', function ($scope, $http, commonDialog) { @@ -408,6 +412,22 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) { }]); + app.controller('devCustomDeclareCheckCtrl', ['$scope', '$http', function ($scope, $http) { + $scope.search = {}; + $scope.check = function () { + $scope.errmsg = null; + $scope.xmlStr = null; + if (!$scope.search.report_id) { + return; + } + $http.get('/dev/custom_declare_check/' + $scope.search.report_id + '/detail').then(function (resp) { + $scope.xmlStr = resp.data.xml; + }, function (resp) { + $scope.errmsg = resp.data.message; + }) + }; + }]); + app.controller('registerAlipayOnlineMerchantCtrl', ['$scope', '$http','$filter', function ($scope, $http,$filter) { $scope.selecttotal = true; @@ -489,4 +509,4 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) { return app; -}); \ No newline at end of file +}); diff --git a/src/main/ui/static/config/devtools/templates/custom_declare_check.html b/src/main/ui/static/config/devtools/templates/custom_declare_check.html new file mode 100644 index 000000000..9bd811d64 --- /dev/null +++ b/src/main/ui/static/config/devtools/templates/custom_declare_check.html @@ -0,0 +1,28 @@ +
+

Custom Declare Check

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

+        
+
+
\ No newline at end of file diff --git a/src/main/ui/static/config/devtools/templates/root.html b/src/main/ui/static/config/devtools/templates/root.html index 6b44535f2..9e7c48d88 100644 --- a/src/main/ui/static/config/devtools/templates/root.html +++ b/src/main/ui/static/config/devtools/templates/root.html @@ -91,8 +91,12 @@ 批量报备支付宝线上商户 + + + Customs Declare Check + - \ No newline at end of file +