From 078d74f85d84a9280c9afc4c1461997a2433b7b2 Mon Sep 17 00:00:00 2001 From: luoyang Date: Wed, 15 Apr 2020 11:06:33 +0800 Subject: [PATCH 1/3] add cashier disable --- .../cashiers/core/impls/CashierOrderServiceImp.java | 8 +++++--- .../manage/cashiers/core/impls/CashierServiceImp.java | 7 +++++++ .../manage/mappers/cashiers/CashierMapper.java | 11 ++++++++--- .../static/payment/cashiers/templates/cashiers.html | 10 ++++++---- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/cashiers/core/impls/CashierOrderServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/cashiers/core/impls/CashierOrderServiceImp.java index 2a49581a6..3b279a7ce 100644 --- a/src/main/java/au/com/royalpay/payment/manage/cashiers/core/impls/CashierOrderServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/cashiers/core/impls/CashierOrderServiceImp.java @@ -4,13 +4,13 @@ import au.com.royalpay.payment.manage.cashiers.beans.CashierQueryBean; import au.com.royalpay.payment.manage.cashiers.core.CashierOrderService; import au.com.royalpay.payment.manage.mappers.cashiers.CashierMapper; import au.com.royalpay.payment.manage.mappers.cashiers.CashierOrderMapper; +import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.utils.PageListUtils; import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageList; import org.springframework.stereotype.Service; -import org.springframework.util.Assert; import javax.annotation.Resource; @@ -36,8 +36,10 @@ public class CashierOrderServiceImp implements CashierOrderService { @Override public JSONObject listCashierOrders(String cashier_id, JSONObject partner, CashierQueryBean query) { - JSONObject cashier = cashierMapper.findOne(cashier_id); - Assert.notNull(cashier, "cashier not found"); + JSONObject cashier = cashierMapper.findIsValidById(cashier_id); + if (cashier == null) { + throw new BadRequestException("Cashier Not Found Or Disabled"); + } String timezone = partner.getJSONObject("client").getString("timezone"); JSONObject params = query.params(timezone); params.put("client_id", partner.getIntValue("client_id")); diff --git a/src/main/java/au/com/royalpay/payment/manage/cashiers/core/impls/CashierServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/cashiers/core/impls/CashierServiceImp.java index b7a5862cd..09d4343e9 100644 --- a/src/main/java/au/com/royalpay/payment/manage/cashiers/core/impls/CashierServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/cashiers/core/impls/CashierServiceImp.java @@ -82,6 +82,13 @@ public class CashierServiceImp implements CashierService { throw new ForbiddenException("You have no permission!"); } cashier.put("is_valid", isValid); + if (!isValid) { + cashier.put("wechat_openid", null); + cashier.put("nick_name", null); + cashier.put("headimgurl", null); + cashier.put("phone", null); + cashier.put("photo", null); + } cashierMapper.update(cashier); } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/cashiers/CashierMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/cashiers/CashierMapper.java index c495ca7b6..b52161bc7 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/cashiers/CashierMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/cashiers/CashierMapper.java @@ -1,11 +1,12 @@ package au.com.royalpay.payment.manage.mappers.cashiers; -import com.yixsoft.support.mybatis.autosql.annotations.AutoMapper; -import com.yixsoft.support.mybatis.autosql.annotations.AutoSql; -import com.yixsoft.support.mybatis.autosql.annotations.SqlType; import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageList; +import com.yixsoft.support.mybatis.autosql.annotations.AdvanceSelect; +import com.yixsoft.support.mybatis.autosql.annotations.AutoMapper; +import com.yixsoft.support.mybatis.autosql.annotations.AutoSql; +import com.yixsoft.support.mybatis.autosql.annotations.SqlType; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -26,6 +27,10 @@ public interface CashierMapper { @AutoSql(SqlType.SELECT) JSONObject findOne(@Param("cashier_id") String cashier_id); + @AutoSql(SqlType.SELECT) + @AdvanceSelect(addonWhereClause = "is_valid=1") + JSONObject findIsValidById(@Param("cashier_id") String cashier_id); + @AutoSql(SqlType.INSERT) void save(JSONObject cashier); diff --git a/src/main/ui/static/payment/cashiers/templates/cashiers.html b/src/main/ui/static/payment/cashiers/templates/cashiers.html index 725b26446..cfe9f8637 100644 --- a/src/main/ui/static/payment/cashiers/templates/cashiers.html +++ b/src/main/ui/static/payment/cashiers/templates/cashiers.html @@ -70,14 +70,16 @@ - - | - + | + - | + + | Disable Enable From fa4357a69c6cde515cf34e370e4fe3c6e44a48d9 Mon Sep 17 00:00:00 2001 From: luoyang Date: Wed, 15 Apr 2020 14:52:15 +0800 Subject: [PATCH 2/3] =?UTF-8?q?add=20=E5=A2=9E=E5=8A=A0=E5=8D=A1=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E6=8A=A5=E5=A4=87=E4=BF=A1=E6=81=AF=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../payment/manage/merchants/core/ClientManager.java | 2 ++ .../merchants/core/impls/ClientManagerImpl.java | 12 +++++++++++- .../merchants/web/PartnerManageController.java | 5 +++++ .../ui/static/commons/templates/order_detail.html | 6 +++--- .../dashboard/templates/partner_dashboard.html | 2 +- src/main/ui/static/payment/partner/partner-manage.js | 7 +++++-- .../templates/partner_new_card_payment_rate.html | 6 +++--- .../partner/templates/sub_merchant_id_apply.html | 2 +- .../templates/partner_trade_detail_edit.html | 6 +++--- 9 files changed, 34 insertions(+), 14 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java index 5ec1b35b2..73059b3ab 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java @@ -571,4 +571,6 @@ public interface ClientManager { RPayMerchantEntity applyMWMerchantId(String clientMoniker, JSONObject manager); RPayMerchantEntity queryMWMerchantIdStatus(String clientMoniker, JSONObject manager); + + RPayMerchantEntity queryMWMerchantInfo(String clientMoniker, JSONObject manager); } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index 7d53238bb..6e50ed185 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -2063,7 +2063,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (StringUtils.equalsIgnoreCase("rpaypmt_card", config.getString("type"))) { JSONObject extRateParams = new JSONObject(){{ put("domestic_rate_value", config.getBigDecimal("rate_value")); - put("overseas_rate_value", config.getBigDecimal("international_rate_value")); + put("overseas_rate_value", config.getJSONObject("ext_rates").getBigDecimal("international_rate_value")); }}; newConfig.put("ext_rates", extRateParams.toJSONString()); } @@ -6862,6 +6862,16 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid return rPayPaymentCardSvcApi.findMerchant(client); } + @Override + public RPayMerchantEntity queryMWMerchantInfo(String clientMoniker, JSONObject manager) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + JSONObject bankAccount = getBankAccountByClientId(client.getIntValue("client_id")); + return (new RPayMerchantEntity()).applyClientInfo(client).applyBankAccount(bankAccount); + } + private boolean isAddCardPaymentRate(JSONObject config, int clientId) { if (!StringUtils.equalsIgnoreCase("rpaypmt_card", config.getString("type")) && !StringUtils.equalsIgnoreCase("rpaypmt_dd", config.getString("type"))) { diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java index ba7beafc9..9286f8051 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java @@ -898,4 +898,9 @@ public class PartnerManageController { @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager){ return clientManager.queryMWMerchantIdStatus(clientMoniker,manager); } + + @ManagerMapping(value = "/{clientMoniker}/query/mw_info", method = RequestMethod.GET, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) + public RPayMerchantEntity queryMWMerchantInfo(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + return clientManager.queryMWMerchantInfo(clientMoniker, manager); + } } diff --git a/src/main/ui/static/commons/templates/order_detail.html b/src/main/ui/static/commons/templates/order_detail.html index 200b25ade..58b4b1713 100644 --- a/src/main/ui/static/commons/templates/order_detail.html +++ b/src/main/ui/static/commons/templates/order_detail.html @@ -175,9 +175,9 @@

-
-
-

+
+
+

{{order.card_bank}}

diff --git a/src/main/ui/static/dashboard/templates/partner_dashboard.html b/src/main/ui/static/dashboard/templates/partner_dashboard.html index 7cd046263..805e0603d 100644 --- a/src/main/ui/static/dashboard/templates/partner_dashboard.html +++ b/src/main/ui/static/dashboard/templates/partner_dashboard.html @@ -361,7 +361,7 @@
- System : {{transcommon.sys_not_settled|currency:'AUD '}} + Cross-border Payment : {{transcommon.sys_not_settled|currency:'AUD '}} Card Payment : {{transcommon.rpaypmt_card_not_settled|currency:'AUD '}} diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index 8d13cc065..43c2ea609 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -4964,9 +4964,11 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }) }; $scope.applyMWSubMerchantId = function () { - commonDialog.confirm({ + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/mw_info').then(function (resp) { + commonDialog.confirm({ title: 'Apply Merchant Warrior Sub Merchant Id', - contentHtml: $sce.trustAsHtml('Are you sure to apply merchant Warrior sub merchant id for [' + $scope.partner.company_name + ']?') + contentHtml: $sce.trustAsHtml('Are you sure to apply merchant Warrior sub merchant id for [' + $scope.partner.company_name + ']?'), + json: resp.data }).then(function () { $http.put('/sys/partners/' + $scope.partner.client_moniker + '/applyMWMerchantId').then(function (res) { commonDialog.alert({ @@ -4979,6 +4981,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); }) }) + }); }; $scope.applyRpaySubMerchantId = function () { $uibModal.open({ diff --git a/src/main/ui/static/payment/partner/templates/partner_new_card_payment_rate.html b/src/main/ui/static/payment/partner/templates/partner_new_card_payment_rate.html index 3dbbdfe8d..18f5807c8 100644 --- a/src/main/ui/static/payment/partner/templates/partner_new_card_payment_rate.html +++ b/src/main/ui/static/payment/partner/templates/partner_new_card_payment_rate.html @@ -48,7 +48,7 @@
-
%
@@ -91,13 +91,13 @@
-
+ min="0" step="0.1" id="transaction_fee_input" required>
$
diff --git a/src/main/ui/static/payment/partner/templates/sub_merchant_id_apply.html b/src/main/ui/static/payment/partner/templates/sub_merchant_id_apply.html index 9ba3cb101..8fee5858c 100644 --- a/src/main/ui/static/payment/partner/templates/sub_merchant_id_apply.html +++ b/src/main/ui/static/payment/partner/templates/sub_merchant_id_apply.html @@ -183,7 +183,7 @@
  • Category - +
  • Hide..... diff --git a/src/main/ui/static/payment/tradelog/templates/partner_trade_detail_edit.html b/src/main/ui/static/payment/tradelog/templates/partner_trade_detail_edit.html index cce854e87..16d03d7ba 100644 --- a/src/main/ui/static/payment/tradelog/templates/partner_trade_detail_edit.html +++ b/src/main/ui/static/payment/tradelog/templates/partner_trade_detail_edit.html @@ -148,9 +148,9 @@
  • -
    -
    -

    +
    +
    +

    {{order.card_bank}}

    From 1db449cd481a46168ec00e52101c83118e20bb0b Mon Sep 17 00:00:00 2001 From: luoyang Date: Wed, 15 Apr 2020 14:59:01 +0800 Subject: [PATCH 3/3] fix dashboard card payment amount --- .../analysis/mappers/CustomerAndOrdersStatisticsMapper.xml | 4 ++-- src/main/ui/static/analysis/templates/trans_analysis.html | 4 ++-- .../ui/static/analysis/templates/trans_analysis_monthly.html | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.xml index d7bd716c5..0cd8a813d 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.xml @@ -356,10 +356,10 @@ ifnull(sum(CASE WHEN s.channel = 'LakalaPay' THEN s.total ELSE 0 END),0) lakalapayamount, ifnull(sum(CASE WHEN s.channel = 'LakalaPay' THEN s.orders ELSE 0 END),0) lakalapay_order_count, ifnull(COUNT(DISTINCT s.client_id,IF(s.channel = 'LakalaPay',TRUE,NULL)),0) lakala_client_count, - ifnull(sum(CASE WHEN s.channel = 'rpaypmt_card' THEN s.total ELSE 0 END),0) rpaypmt_cardpayamount, + ifnull(sum(CASE WHEN s.channel = 'rpaypmt_card' THEN s.total ELSE 0 END),0) rpaypmt_cardamount, ifnull(sum(CASE WHEN s.channel = 'rpaypmt_card' THEN s.orders ELSE 0 END),0) rpaypmt_card_order_count, ifnull(COUNT(DISTINCT s.client_id,IF(s.channel = 'rpaypmt_card',TRUE,NULL)),0) rpaypmt_card_client_count, - ifnull(sum(CASE WHEN s.channel = 'rpaypmt_dd' THEN s.total ELSE 0 END),0) rpaypmt_ddpayamount, + ifnull(sum(CASE WHEN s.channel = 'rpaypmt_dd' THEN s.total ELSE 0 END),0) rpaypmt_ddamount, ifnull(sum(CASE WHEN s.channel = 'rpaypmt_dd' THEN s.orders ELSE 0 END),0) rpaypmt_dd_order_count, ifnull(COUNT(DISTINCT s.client_id,IF(s.channel = 'rpaypmt_dd',TRUE,NULL)),0) rpaypmt_dd_client_count, ifnull(sum(s.orders), 0) all_count, diff --git a/src/main/ui/static/analysis/templates/trans_analysis.html b/src/main/ui/static/analysis/templates/trans_analysis.html index ee403d5cf..30299c8ff 100644 --- a/src/main/ui/static/analysis/templates/trans_analysis.html +++ b/src/main/ui/static/analysis/templates/trans_analysis.html @@ -272,7 +272,7 @@
    Card Payment

    + ng-bind="totalChannelAmount.rpaypmt_cardamount|currency: ' $ '">
    @@ -283,7 +283,7 @@
    Direct Debit

    + ng-bind="totalChannelAmount.rpaypmt_ddamount|currency: ' $ '">
    diff --git a/src/main/ui/static/analysis/templates/trans_analysis_monthly.html b/src/main/ui/static/analysis/templates/trans_analysis_monthly.html index 62c471336..f84776489 100644 --- a/src/main/ui/static/analysis/templates/trans_analysis_monthly.html +++ b/src/main/ui/static/analysis/templates/trans_analysis_monthly.html @@ -239,7 +239,7 @@
    Card Payment

    + ng-bind="totalChannelAmount.rpaypmt_cardamount|currency: ' $ '">
    @@ -250,7 +250,7 @@
    Direct Debit

    + ng-bind="totalChannelAmount.rpaypmt_ddamount|currency: ' $ '">