From 960642e0286ebb748edc743586e1a466d459aee3 Mon Sep 17 00:00:00 2001 From: dalong306 <304592994@qq.com> Date: Sat, 9 Oct 2021 11:44:35 +0800 Subject: [PATCH] =?UTF-8?q?PartnerDashboard=20=E5=8A=A0=E8=BD=BD=E6=85=A2?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../analysis/core/DashboardService.java | 2 + .../core/impls/DashboardServiceImpl.java | 46 ++++++++++++++++--- .../web/PartnerDashboardController.java | 5 ++ .../ui/static/dashboard/partner-dashboard.js | 20 ++++++++ .../templates/partner_dashboard.html | 8 ++-- 5 files changed, 70 insertions(+), 11 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/DashboardService.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/DashboardService.java index ed0a43e65..2f04724b0 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/DashboardService.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/DashboardService.java @@ -39,6 +39,8 @@ public interface DashboardService { JSONObject getCommonAnalysis(JSONObject partner, AnalysisBean partnerAnalysisBean); + JSONObject getCommonAnalysisByChannel(JSONObject partner, AnalysisBean partnerAnalysisBean); + List getTradeAnalysisInHours(JSONObject partner, AnalysisBean partnerAnalysisBean); List getTradeAnalysisInDays(JSONObject partner, AnalysisBean partnerAnalysisBean); diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java index 4e498cbb4..0ef0aa84b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java @@ -335,13 +335,13 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT JSONObject yes = getTransJSONO(params); res.put("today",today); res.put("yes",yes); - res.put("not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params))); - params.put("channel", "system"); - res.put("sys_not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params))); - params.put("channel", "rpaypmt_card"); - res.put("rpaypmt_card_not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params))); - params.put("channel", "rpaypmt_dd"); - res.put("rpaypmt_dd_not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params))); +// res.put("not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params))); +// params.put("channel", "system"); +// res.put("sys_not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params))); +// params.put("channel", "rpaypmt_card"); +// res.put("rpaypmt_card_not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params))); +// params.put("channel", "rpaypmt_dd"); +// res.put("rpaypmt_dd_not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params))); res.put("trade_amount_rise",yes.getBigDecimal("trade_amount").compareTo(BigDecimal.ZERO)>0 ? (today.getBigDecimal("trade_amount").subtract(yes.getBigDecimal("trade_amount"))).divide(yes.getBigDecimal("trade_amount"), 4, RoundingMode.HALF_UP):BigDecimal.ZERO); res.put("trade_count_rise", yes.getIntValue("trade_count") > 0 ? (today.getBigDecimal("trade_count").subtract(yes.getBigDecimal("trade_count"))).divide(yes.getBigDecimal("trade_count"), 4, RoundingMode.HALF_UP) : 0); res.put("customers_rise", yes.getIntValue("customers") > 0 ? (today.getBigDecimal("customers").subtract(yes.getBigDecimal("customers"))).divide(yes.getBigDecimal("customers"), 4, RoundingMode.HALF_UP) : 0); @@ -351,6 +351,38 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT res.put("latest_settle",logs.isEmpty()?BigDecimal.ZERO:logs.get(0).getBigDecimal("income")); return res; } + + /** + * 根据渠道号分别加载未清算金额 + * @param partner + * @param partnerAnalysisBean + * @return + */ + @Override + public JSONObject getCommonAnalysisByChannel(JSONObject partner, AnalysisBean partnerAnalysisBean) { + String timezone = partner.getJSONObject("client").getString("timezone"); + JSONObject params = partnerAnalysisBean.toParams(timezone); + try { + clientManager.validateClients(partner.getIntValue("client_id"), params); + } catch (Exception e) { + logger.error("Dashboard analysis request including not permission client_id"); + params.remove("client_ids"); + } + + JSONObject res = new JSONObject(); + JSONObject mchConfig = merchantInfoProvider.getMchExtParams(partner.getIntValue("client_id")); + params.put("hide_sub_mch", mchConfig.getBooleanValue("hide_sub_mch")); + params.put("client_id", partner.getIntValue("client_id")); + clientManager.queryModifyClientIds(partner.getIntValue("client_id"), params); + params.put("begin",DateUtils.addDays(params.getDate("begin"),-1)); + params.put("end",DateUtils.addDays(params.getDate("end"),-1)); + String key="not_settled"; + if(StringUtils.isNotEmpty(params.getString("channel"))){ + key=params.getString("channel")+"_not_settled"; + } + res.put(key, new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params))); + return res; + } private JSONObject getTransJSONO(JSONObject params){ JSONObject res = new JSONObject(); JSONObject object = transactionAnalysisMapper.getClientTransaction(params); diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/web/PartnerDashboardController.java b/src/main/java/au/com/royalpay/payment/manage/analysis/web/PartnerDashboardController.java index 206ba609d..bd6395e23 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/web/PartnerDashboardController.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/web/PartnerDashboardController.java @@ -27,6 +27,11 @@ public class PartnerDashboardController { public JSONObject commonAnalysis(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner, AnalysisBean partnerAnalysisBean) { return dashboardService.getCommonAnalysis(partner,partnerAnalysisBean); } + @PartnerMapping("/common_analysis_channel") + @ReadOnlyConnection + public JSONObject commonAnalysisByChannel(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner, AnalysisBean partnerAnalysisBean) { + return dashboardService.getCommonAnalysisByChannel(partner,partnerAnalysisBean); + } @PartnerMapping("/trade_in_hours") @ReadOnlyConnection diff --git a/src/main/ui/static/dashboard/partner-dashboard.js b/src/main/ui/static/dashboard/partner-dashboard.js index 01a34eb07..e415d096f 100644 --- a/src/main/ui/static/dashboard/partner-dashboard.js +++ b/src/main/ui/static/dashboard/partner-dashboard.js @@ -685,6 +685,26 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct $http.get('/dashboard/partner/common_analysis',{params:params}).then(function (resp) { $scope.transcommon = resp.data; }); + var params_total = angular.copy(params); + params_total.channel=null; + $http.get('/dashboard/partner/common_analysis_channel',{params:params_total}).then(function (resp) { + $scope.transcommon_total = resp.data; + }); + var params_system = angular.copy(params); + params_system.channel='system'; + $http.get('/dashboard/partner/common_analysis_channel',{params:params_system}).then(function (resp) { + $scope.transcommon_system = resp.data; + }); + var params_rpaypmt_card = angular.copy(params); + params_rpaypmt_card.channel='rpaypmt_card'; + $http.get('/dashboard/partner/common_analysis_channel',{params:params_rpaypmt_card}).then(function (resp) { + $scope.transcommon_rpaypmt_card = resp.data; + }); + var params_rpaypmt_dd = angular.copy(params); + params_rpaypmt_dd.channel='rpaypmt_dd'; + $http.get('/dashboard/partner/common_analysis_channel',{params:params_rpaypmt_dd}).then(function (resp) { + $scope.transcommon_rpaypmt_dd = resp.data; + }); } function getExchangeRate() { diff --git a/src/main/ui/static/dashboard/templates/partner_dashboard.html b/src/main/ui/static/dashboard/templates/partner_dashboard.html index 805e0603d..055920206 100644 --- a/src/main/ui/static/dashboard/templates/partner_dashboard.html +++ b/src/main/ui/static/dashboard/templates/partner_dashboard.html @@ -357,17 +357,17 @@
- {{transcommon.not_settled|currency:'AUD '}} + {{transcommon_total.not_settled|currency:'AUD '}}
- Cross-border Payment : {{transcommon.sys_not_settled|currency:'AUD '}} + Cross-border Payment : {{transcommon_system.system_not_settled|currency:'AUD '}} - Card Payment : {{transcommon.rpaypmt_card_not_settled|currency:'AUD '}} + Card Payment : {{transcommon_rpaypmt_card.rpaypmt_card_not_settled|currency:'AUD '}} - Direct Debit : {{transcommon.rpaypmt_dd_not_settled|currency:'AUD '}} + Direct Debit : {{transcommon_rpaypmt_dd.rpaypmt_dd_not_settled|currency:'AUD '}}
UNSETTLED