From c6b7a5d2d4e4dcdc65b25c182da60d7f9d80460b Mon Sep 17 00:00:00 2001 From: yixian Date: Sat, 7 Apr 2018 21:45:34 +0800 Subject: [PATCH 1/5] error processing --- .../templates/payment/v1/gateway_jsapi.js | 13 +++++-- .../ui/static/templates/payment/v1/payment.js | 19 +++++++--- .../templates/payment/v1/retail_jsapi.js | 36 ++++++++++++++----- 3 files changed, 51 insertions(+), 17 deletions(-) diff --git a/src/main/ui/static/templates/payment/v1/gateway_jsapi.js b/src/main/ui/static/templates/payment/v1/gateway_jsapi.js index fc837d49c..119411cd9 100644 --- a/src/main/ui/static/templates/payment/v1/gateway_jsapi.js +++ b/src/main/ui/static/templates/payment/v1/gateway_jsapi.js @@ -50,9 +50,16 @@ $(document).ready(function () { invokePay(paydata); }, error: function (jqXhr) { - alert(jqXhr.responseJSON.message); - $('#wdiv').hide(); - dataCache.paying = false; + var respText = jqXhr.responseText; + try { + alert(JSON.parse(respText).message); + $('#wdiv').hide(); + dataCache.paying = false; + } catch (e) { + alert("Unexpected Error:" + respText); + $('#wdiv').hide(); + dataCache.paying = false; + } } }); diff --git a/src/main/ui/static/templates/payment/v1/payment.js b/src/main/ui/static/templates/payment/v1/payment.js index 60ee79934..cbc8f374b 100644 --- a/src/main/ui/static/templates/payment/v1/payment.js +++ b/src/main/ui/static/templates/payment/v1/payment.js @@ -198,7 +198,7 @@ $(function () { $('

').html('Surcharge 手续费(' + window.rateValue + '%):+' + currencySymbol + dataCache.surcharge).appendTo(bd); } if (parseFloat(dataCache.tax) > 0) { - $('

').html('GST(10%):'+currencySymbol+dataCache.tax).appendTo(bd); + $('

').html('GST(10%):' + currencySymbol + dataCache.tax).appendTo(bd); } $(dataCache.discounts).each(function () { $('

').html(this.title + ':-' + currencySymbol + this.amount).appendTo(bd); @@ -287,10 +287,19 @@ $(function () { }) }, error: function (jqXhr) { - weuiAlert(jqXhr.responseJSON.message); - $('#key_P').removeClass('hidden'); - $('#key_Loading').addClass('hidden'); - dataCache.paying = false; + var respText = jqXhr.responseText; + try { + weuiAlert(JSON.parse(respText).message); + $('#key_P').removeClass('hidden'); + $('#key_Loading').addClass('hidden'); + dataCache.paying = false; + } catch (e) { + alert("Unexpected Error:" + respText); + $('#key_P').removeClass('hidden'); + $('#key_Loading').addClass('hidden'); + dataCache.paying = false; + } + } }) }); diff --git a/src/main/ui/static/templates/payment/v1/retail_jsapi.js b/src/main/ui/static/templates/payment/v1/retail_jsapi.js index 6c42a8d43..d31f1e94b 100644 --- a/src/main/ui/static/templates/payment/v1/retail_jsapi.js +++ b/src/main/ui/static/templates/payment/v1/retail_jsapi.js @@ -4,18 +4,21 @@ $(document).ready(function () { 'use strict'; decode(); + function decode() { var redirect = window.redirect; - while(redirect.indexOf('://')<0){ + while (redirect.indexOf('://') < 0) { redirect = decodeURIComponent(redirect); - if(redirect==window.redirect){ + if (redirect == window.redirect) { break; } window.redirect = redirect; } } + var dataCache = {paying: false}; $('#key_P').bind('touchstart', startPay); + function startPay() { $('#wdiv').show(); if (dataCache.paying) { @@ -28,17 +31,31 @@ $(document).ready(function () { method: 'get', dataType: 'json', success: function (pay) { - if(pay.direct_paid){ + try { + if (pay.direct_paid) { + dataCache.paying = false; + location.href = window.redirect; + } + var paydata = pay.jsapi; + invokePay(paydata); + }catch (e) { + alert("Unexpected Error:" + e); + $('#wdiv').hide(); dataCache.paying = false; - location.href = window.redirect; } - var paydata = pay.jsapi; - invokePay(paydata); }, error: function (jqXhr) { - alert(jqXhr.responseJSON.message); - $('#wdiv').hide(); - dataCache.paying = false; + var respText = jqXhr.responseText; + try { + alert(JSON.parse(respText).message); + $('#wdiv').hide(); + dataCache.paying = false; + } catch (e) { + alert("Unexpected Error:" + respText); + $('#wdiv').hide(); + dataCache.paying = false; + } + } }); @@ -85,6 +102,7 @@ $(document).ready(function () { } }) } + checkOrderStd(); } }); \ No newline at end of file From 9e788f0581ba4e529c752a12dad7fa9e6b057933 Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Sun, 8 Apr 2018 11:13:53 +0800 Subject: [PATCH 2/5] contract add query param --- .../mappers/system/ClientsContractMapper.java | 2 +- .../system/core/ClientContractService.java | 2 +- .../core/impl/ClientContractServiceImpl.java | 4 ++-- .../manage/system/web/contractController.java | 6 ++++-- .../mappers/system/ClientsContractMapper.xml | 6 +++++- src/main/ui/static/sys/contract.js | 6 ++++-- .../static/sys/templates/contract_sign.html | 20 +++++++++++++++++-- 7 files changed, 35 insertions(+), 11 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientsContractMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientsContractMapper.java index b143de628..1b1f105ac 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientsContractMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientsContractMapper.java @@ -28,7 +28,7 @@ public interface ClientsContractMapper { @AutoSql(type = SqlType.SELECT) List list(); - PageList listWithClientInfo(PageBounds pagination); + PageList listWithClientInfo(JSONObject param,PageBounds pagination); List analysisSingstatus(); } diff --git a/src/main/java/au/com/royalpay/payment/manage/system/core/ClientContractService.java b/src/main/java/au/com/royalpay/payment/manage/system/core/ClientContractService.java index e9ea8072c..2511eb40c 100644 --- a/src/main/java/au/com/royalpay/payment/manage/system/core/ClientContractService.java +++ b/src/main/java/au/com/royalpay/payment/manage/system/core/ClientContractService.java @@ -17,7 +17,7 @@ public interface ClientContractService { void saveContract(int client_id, Date expire_date, String channel); - JSONObject list(PageBounds pagination); + JSONObject list(JSONObject param,PageBounds pagination); JSONObject analysis(); } diff --git a/src/main/java/au/com/royalpay/payment/manage/system/core/impl/ClientContractServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/system/core/impl/ClientContractServiceImpl.java index 5d6d6c470..40f83d625 100644 --- a/src/main/java/au/com/royalpay/payment/manage/system/core/impl/ClientContractServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/system/core/impl/ClientContractServiceImpl.java @@ -152,8 +152,8 @@ public class ClientContractServiceImpl implements ClientContractService { } @Override - public JSONObject list(PageBounds pagination) { - return PageListUtils.buildPageListResult(clientsContractMapper.listWithClientInfo(pagination)); + public JSONObject list(JSONObject param,PageBounds pagination) { + return PageListUtils.buildPageListResult(clientsContractMapper.listWithClientInfo(param,pagination)); } @Override diff --git a/src/main/java/au/com/royalpay/payment/manage/system/web/contractController.java b/src/main/java/au/com/royalpay/payment/manage/system/web/contractController.java index 631d910cd..61f5e931f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/system/web/contractController.java +++ b/src/main/java/au/com/royalpay/payment/manage/system/web/contractController.java @@ -25,8 +25,10 @@ public class contractController { private ManualSettleSupport manualSettleSupport; @ManagerMapping(value = "/contract/list", method = RequestMethod.GET) - public JSONObject contractList(@RequestParam(value = "page", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int limit) { - return clientContractService.list(new PageBounds(page,limit)); + public JSONObject contractList(@RequestParam(value = "page", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int limit,@RequestParam(required = false) String client_moniker) { + JSONObject params = new JSONObject(); + params.put("client_moniker",client_moniker); + return clientContractService.list(params,new PageBounds(page,limit)); } @ManagerMapping(value = "/contract", method = RequestMethod.GET) diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientsContractMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientsContractMapper.xml index 2dc237318..3719df3ad 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientsContractMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientsContractMapper.xml @@ -11,7 +11,11 @@ select c.client_moniker client_moniker,cc.create_time create_time,cc.confirm_time confirm_time,a.display_name display_name from sys_clients_contract cc left join sys_clients c on c.client_id = cc.client_id left join sys_accounts a on a.account_id = cc.sign_account_id - + + + c.client_moniker = #{client_moniker} + + + + +
+ +
+ + + +
+