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 f88c5a102..d5bd11c71 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; @@ -62,6 +63,7 @@ import org.springframework.util.MimeTypeUtils; 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; @@ -153,6 +155,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 { @@ -578,6 +582,27 @@ 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 +