diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/CustomersAnalysisServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/CustomersAnalysisServiceImp.java index 8d05ba78b..62d967da8 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/CustomersAnalysisServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/CustomersAnalysisServiceImp.java @@ -70,53 +70,7 @@ public class CustomersAnalysisServiceImp implements CustomersAnalysisService { @Override public JSONObject getChannelAmountAnalysis(JSONObject params) { - JSONObject result = new JSONObject(); - -// params.put("client_id",0); - params.put("channel", "Wechat"); - JSONObject wechatPayAmount = customerAndOrdersStatisticsMapper.getSumCustomersChannelAnalysis(params); - if (wechatPayAmount != null) { - result.put("wechatPayAmount", wechatPayAmount.getBigDecimal("total_amount")); - } else { - result.put("wechatPayAmount", 0.00); - } - - params.put("channel", "Bestpay"); - JSONObject bestPayAmount = customerAndOrdersStatisticsMapper.getSumCustomersChannelAnalysis(params); - if (bestPayAmount != null) { - result.put("bestPayAmount", bestPayAmount.getBigDecimal("total_amount")); - } else { - result.put("bestPayAmount", 0.00); - } - params.put("channel", "Alipay"); - JSONObject aliPayAmount = customerAndOrdersStatisticsMapper.getSumCustomersChannelAnalysis(params); - if (aliPayAmount != null) { - result.put("aliPayAmount", aliPayAmount.getBigDecimal("total_amount")); - } else { - result.put("aliPayAmount", 0.00); - } - params.put("channel", "jd"); - JSONObject jdPayAmount = customerAndOrdersStatisticsMapper.getSumCustomersChannelAnalysis(params); - if (jdPayAmount != null) { - result.put("jdPayAmount", jdPayAmount.getBigDecimal("total_amount")); - } else { - result.put("jdPayAmount", 0.00); - } - params.put("channel", "AlipayOnline"); - JSONObject aliOnlineAmount = customerAndOrdersStatisticsMapper.getSumCustomersChannelAnalysis(params); - if (aliOnlineAmount != null) { - result.put("aliOnlineAmount", aliOnlineAmount.getBigDecimal("total_amount")); - } else { - result.put("aliOnlineAmount", 0.00); - } - params.put("channel", "hf"); - JSONObject hfPayAmount = customerAndOrdersStatisticsMapper.getSumCustomersChannelAnalysis(params); - if (hfPayAmount != null) { - result.put("hfPayAmount", hfPayAmount.getBigDecimal("total_amount")); - } else { - result.put("hfPayAmount", 0.00); - } - return result; + return customerAndOrdersStatisticsMapper.getChannelCommonCount(params); } @Override 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 aab25203f..fc20ac668 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 @@ -322,8 +322,16 @@ ]]> s.client_id != 0 - and s.date >= #{begin} - and s.date <= #{end} + and c.client_id in + (SELECT b.client_id FROM sys_client_bd b + INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id + where b.is_valid=1 and b.start_date<=now() and (b.end_date is null or b.end_date >= now()) + AND (c.bd_group=#{bd_group} or c.manager_id=#{bd_group}) + and c.manager_id=#{bd_group_bd} + ) + + and s.date >= #{begin} + and s.date < #{end} and c.org_id=#{org_id} and c.org_id in #{org_id} diff --git a/src/main/ui/static/analysis/templates/trans_analysis.html b/src/main/ui/static/analysis/templates/trans_analysis.html index 134046425..17f6b602a 100644 --- a/src/main/ui/static/analysis/templates/trans_analysis.html +++ b/src/main/ui/static/analysis/templates/trans_analysis.html @@ -52,10 +52,10 @@ datepicker-options="{minDate:params.begin,maxDate:today}"> -
+
Yesterday @@ -143,7 +143,7 @@
Wechat
+ ng-bind="totalChannelAmount.wechatamount|currency: ' $ '">
@@ -153,7 +153,7 @@
Bestpay
+ ng-bind="totalChannelAmount.bestpayamount|currency: ' $ '">
@@ -163,7 +163,7 @@
Alipay
+ ng-bind="totalChannelAmount.alipayamount|currency: ' $ '">
@@ -173,7 +173,7 @@
AlipayOnline
+ ng-bind="totalChannelAmount.alipayonlineamount|currency: ' $ '">
@@ -183,7 +183,7 @@
JD Pay
+ ng-bind="totalChannelAmount.jdamount|currency: ' $ '">
@@ -193,7 +193,7 @@
HF Pay
+ ng-bind="totalChannelAmount.hfamount|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 86fdf9740..c507e7de6 100644 --- a/src/main/ui/static/analysis/templates/trans_analysis_monthly.html +++ b/src/main/ui/static/analysis/templates/trans_analysis_monthly.html @@ -103,7 +103,7 @@
Wechat
+ ng-bind="totalChannelAmount.wechatamount|currency: ' $ '">
@@ -113,7 +113,7 @@
Bestpay
+ ng-bind="totalChannelAmount.bestpayamount|currency: ' $ '">
@@ -123,7 +123,7 @@
Alipay
+ ng-bind="totalChannelAmount.alipayamount|currency: ' $ '">
@@ -133,7 +133,7 @@
AlipayOnline
+ ng-bind="totalChannelAmount.alipayonlineamount|currency: ' $ '">
@@ -143,7 +143,7 @@
JD Pay
+ ng-bind="totalChannelAmount.jdamount|currency: ' $ '">
@@ -153,7 +153,7 @@
HF Pay
+ ng-bind="totalChannelAmount.hfamount|currency: ' $ '">
diff --git a/src/main/ui/static/analysis/trans-analysis-monthly.js b/src/main/ui/static/analysis/trans-analysis-monthly.js index 4a41f0726..a53eb2a79 100644 --- a/src/main/ui/static/analysis/trans-analysis-monthly.js +++ b/src/main/ui/static/analysis/trans-analysis-monthly.js @@ -67,7 +67,7 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts','./transaction/an params.begin = $filter('date')(new Date(), 'yyyyMMdd'); } if (params.end) { - params.end = $filter('date')(params.end, 'yyyyMMdd'); + params.end = $filter('date')(params.end.setMonth(params.end.getMonth()+1), 'yyyyMMdd'); } else { params.end = $filter('date')(new Date(), 'yyyyMMdd'); } diff --git a/src/main/ui/static/analysis/trans-analysis.js b/src/main/ui/static/analysis/trans-analysis.js index f19b571d6..2087785c3 100644 --- a/src/main/ui/static/analysis/trans-analysis.js +++ b/src/main/ui/static/analysis/trans-analysis.js @@ -38,7 +38,7 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts','./transaction/an } $scope.listTransLogs(); $scope.params = {}; - $scope.today = new Date(); + $scope.today = new Date(new Date().getTime() - 24*60*60*1000); if (($scope.currentUser.role & parseInt('1000000000', 2)) > 0 && $scope.currentUser.org_id) { $http.get('/sys/manager_accounts/group/group_bds').then(function (resp) { @@ -74,14 +74,14 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts','./transaction/an $scope.doAnalysis(1); }; $scope.chooseLast7Days = function () { - $scope.params.end = new Date(); + $scope.params.end = new Date(new Date().getTime() - 24*60*60*1000); var day = new Date(); - day.setDate(day.getDate() - 7); + day.setDate(day.getDate() - 8); $scope.params.begin = day; $scope.doAnalysis(1); }; $scope.thisMonth = function () { - $scope.params.end = new Date(); + $scope.params.end = new Date(new Date().getTime() - 24*60*60*1000); var monthBegin = new Date(); monthBegin.setDate(1); $scope.params.begin = monthBegin; @@ -98,7 +98,7 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts','./transaction/an $scope.doAnalysis(1); }; $scope.thisYear = function () { - var yearFinish = new Date(); + var yearFinish = new Date(new Date().getTime() - 24*60*60*1000); $scope.params.end = yearFinish; var currentYearFirstDate = new Date(new Date().getFullYear(), 0, 1); $scope.params.begin = currentYearFirstDate;