From 0bef940daa3350fe6c0e9c949876418455eda411 Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Sun, 8 Apr 2018 10:01:03 +0800 Subject: [PATCH 01/19] =?UTF-8?q?=E4=BF=AE=E6=94=B9partner=20dashboard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/impls/DashboardServiceImpl.java | 19 +- .../web/PartnerDashboardController.java | 47 +- .../CustomerAndOrdersStatisticsMapper.xml | 2 +- src/main/ui/index.html | 1 + .../ui/static/css/new_partner_dashboard.css | 103 ++++ .../ui/static/dashboard/partner-dashboard.js | 534 +++++++++++++++++- .../templates/partner_dashboard.html | 257 ++++++++- 7 files changed, 918 insertions(+), 45 deletions(-) create mode 100644 src/main/ui/static/css/new_partner_dashboard.css 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 248197b91..2e6115587 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 @@ -231,22 +231,23 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT } JSONObject res = new JSONObject(); params.put("client_id", partner.getIntValue("client_id")); + JSONObject today = getTransJSONO(params); + params.put("begin",DateUtils.addDays(params.getDate("begin"),-1)); + params.put("end",DateUtils.addDays(params.getDate("end"),-1)); + JSONObject yes = getTransJSONO(params); + res.put("today",today); + res.put("yes",yes); + return res; + } + private JSONObject getTransJSONO(JSONObject params){ + JSONObject res = new JSONObject(); JSONObject object = transactionAnalysisMapper.getClientTransaction(params); res.put("trade_amount", object.getBigDecimal("trade_amount")); res.put("trade_count", object.getIntValue("trade_count")); - res.put("refund_amount", object.getBigDecimal("refund_amount")); res.put("not_settled", transactionAnalysisMapper.analysisNotSettled(params)); - res.put("pre_amount", transactionAnalysisMapper.analysisPreAmount(params)); - List topOrders = transactionAnalysisMapper.getTopOrders(params, new PageBounds(1, 1, Order.formString("aud_fee.desc"))); - if (!topOrders.isEmpty()) { - res.put("top_amount_order", topOrders.get(0)); - } - res.put("total_customers", transactionAnalysisMapper.countCustomers(params)); res.put("new_customers", transactionAnalysisMapper.countNewCustomers(params)); - res.put("old_customers", transactionAnalysisMapper.countOldCustomers(params)); return res; } - @Override public List getTradeAnalysisInHours(JSONObject partner, AnalysisBean partnerAnalysisBean) { String timezone = partner.getJSONObject("client").getString("timezone"); 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 7860afa83..dda589b27 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 @@ -2,13 +2,15 @@ package au.com.royalpay.payment.manage.analysis.web; import au.com.royalpay.payment.manage.analysis.beans.AnalysisBean; import au.com.royalpay.payment.manage.analysis.core.DashboardService; +import au.com.royalpay.payment.manage.analysis.core.PartnerCardDashboardService; +import au.com.royalpay.payment.manage.logview.beans.ClientLoginLogQueryBean; +import au.com.royalpay.payment.manage.management.clearing.core.CleanService; import au.com.royalpay.payment.manage.permission.manager.PartnerMapping; +import au.com.royalpay.payment.manage.signin.core.ClientLoginLogRepository; +import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery; import au.com.royalpay.payment.tools.CommonConsts; import com.alibaba.fastjson.JSONObject; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; @@ -22,6 +24,12 @@ public class PartnerDashboardController { @Resource private DashboardService dashboardService; + @Resource + private PartnerCardDashboardService partnerCardDashboardService; + + @Resource + private CleanService cleanService; + @PartnerMapping("/common_analysis") public JSONObject commonAnalysis(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner, AnalysisBean partnerAnalysisBean) { return dashboardService.getCommonAnalysis(partner,partnerAnalysisBean); @@ -41,4 +49,35 @@ public class PartnerDashboardController { public List customersInDays(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner,AnalysisBean partnerAnalysisBean) { return dashboardService.getCustomersAndOrdersInDays(partner,partnerAnalysisBean); } + + + @PartnerMapping("/trans_common") + public JSONObject transCommon(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner, AnalysisBean partnerAnalysisBean) { + return dashboardService.getCommonAnalysis(partner,partnerAnalysisBean); + } + @PartnerMapping("{client_moniker}/basic_info") + public JSONObject commonAnalysis(@PathVariable String client_moniker, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner) { + return partnerCardDashboardService.getCommonAnalysis(client_moniker); + } + + @PartnerMapping("/trans_type_analysis") + public List getTransTypesAnalysis(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner,AnalysisBean partnerAnalysisBean) { + JSONObject params = partnerAnalysisBean.toParams("timezone"); + params.put("client_id",partner.getString("client_id")); + return dashboardService.getTradeInTypes(params); + } + + @PartnerMapping("{client_moniker}/avg_order_customer") + public JSONObject getAvgOrderAndCustomer(@PathVariable String client_moniker, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner) { + return partnerCardDashboardService.getOrderAndCustomerPerDay(client_moniker); + } + + @PartnerMapping("{client_moniker}/settlement_logs") + public JSONObject getPartnerSettlementLog(@PathVariable String client_moniker, TradeLogQuery query, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner) { + return partnerCardDashboardService.getSettlementLog(client_moniker, query); + } + @PartnerMapping("/{client_id}/settlement_logs/{detailId}") + public JSONObject listClearingTransactions(@PathVariable int client_id, @PathVariable String detailId) { + return cleanService.getCleanLogTransactions(client_id, detailId); + } } 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 451e81553..2a904bd08 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 @@ -95,7 +95,7 @@ diff --git a/src/main/ui/index.html b/src/main/ui/index.html index 0c58df012..bd72a8ba5 100644 --- a/src/main/ui/index.html +++ b/src/main/ui/index.html @@ -24,6 +24,7 @@ + diff --git a/src/main/ui/static/css/new_partner_dashboard.css b/src/main/ui/static/css/new_partner_dashboard.css new file mode 100644 index 000000000..c7410eaf0 --- /dev/null +++ b/src/main/ui/static/css/new_partner_dashboard.css @@ -0,0 +1,103 @@ + +mdi { + display: inline-block; + font: normal normal normal 24px/1 "Material Design Icons"; + font-size: inherit; + text-rendering: auto; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + transform: translate(0, 0); +} +.mini-stat { + box-shadow: 1px 0 20px rgba(0, 0, 0, .05); + padding: 20px; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + margin-bottom: 30px; +} +.mini-stat-info { + font-size: 14px; + padding-top: 2px; +} +.mini-stat-info span { + display: block; + font-size: 24px; +} +.bg-white { + background-color: #fff!important; +} +.bg-success { + background-color: #6fd088!important; +} +.bg-info { + background-color: #0097a7!important; +} +.bg-light { + background-color: #f8f9fa!important; +} +.mini-stat-icon { + width: 60px; + height: 60px; + display: inline-block; + line-height: 60px; + text-align: center; + font-size: 30px; + -webkit-border-radius: 100%; + -moz-border-radius: 100%; + border-radius: 100%; + float: left; + margin-right: 10px; +} +.bg-light { + background-color: #f8f9fa!important; +} +.card { + position: relative; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -ms-flex-direction: column; + flex-direction: column; + min-width: 0; + word-wrap: break-word; + background-color: #fff; + background-clip: border-box; + border: 1px solid rgba(0, 0, 0, .125); + border-radius: .25rem; + box-shadow: 1px 0 20px rgba(0,0,0,.05); +} +.text-right { + text-align: right!important; +} +.text-light { + color: #f8f9fa!important; +} +.m-b-30 { + margin-bottom: 30px; +} +.card-body { + -webkit-box-flex: 1; + -ms-flex: 1 1 auto; + flex: 1 1 auto; + padding: 1.25rem;} +.header-title { + margin-bottom: 8px; + text-transform: uppercase; + letter-spacing: .02em; + font-size: 14px; +} +.mt-0, .my-0 { + margin-top: 0!important; +} +.m-t-20 { + margin-top: 20px; +} +.mb-0, .my-0 { + margin-bottom: 0!important; +} +.m-r-5 { + margin-right: 5px; +} diff --git a/src/main/ui/static/dashboard/partner-dashboard.js b/src/main/ui/static/dashboard/partner-dashboard.js index 37ce4672d..f95757588 100644 --- a/src/main/ui/static/dashboard/partner-dashboard.js +++ b/src/main/ui/static/dashboard/partner-dashboard.js @@ -12,7 +12,7 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct controller: 'partnerDashboardCtrl' }) }]); - app.controller('partnerDashboardCtrl', ['$scope', '$http', '$filter', '$uibModal','$timeout', 'chartParser', function ($scope, $http, $filter, $uibModal,$timeout, chartParser) { + /*app.controller('partnerDashboardCtrl', ['$scope', '$http', '$filter', '$uibModal','$timeout', 'chartParser', function ($scope, $http, $filter, $uibModal,$timeout, chartParser) { $scope.params = {}; $scope.chooseShow = 'All'; $scope.clients = [$scope.currentUser.client]; @@ -431,7 +431,7 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct } }, legend: { - data: ['Wechat', 'Alipay'/*,'Bestpay'*/], + data: ['Wechat', 'Alipay'/!*,'Bestpay'*!/], bottom: 0, height: '15%', width: '80%', @@ -442,7 +442,7 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct name: 'Exchange Rate', min: 'auto' } - /*color: colors*/ + /!*color: colors*!/ }, xAxis: { basic: { @@ -566,6 +566,534 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); }) } + }]);*/ + + app.controller('partnerDashboardCtrl', ['$scope', '$http', '$filter', '$uibModal','$timeout', 'chartParser', function ($scope, $http, $filter, $uibModal,$timeout, chartParser) { + $scope.scales = [ + { + key: 'today', + label: '今日', + params: function () { + return { + begin: $filter('date')(new Date(), 'yyyyMMdd'), + end: $filter('date')(new Date(), 'yyyyMMdd') + } + } + }, + { + key: 'yesterday', + label: '昨日', + params: function () { + var date = new Date(); + date = date.setDate(date.getDate() - 1); + return { + begin: $filter('date')(date, 'yyyyMMdd'), + end: $filter('date')(date, 'yyyyMMdd') + } + } + }, + { + key: 'seven', + label: '近7日', + params: function () { + var date = new Date(); + var end = $filter('date')(date, 'yyyyMMdd'); + date = date.setDate(date.getDate() - 6); + return { + begin: $filter('date')(date, 'yyyyMMdd'), + end: end + } + } + }, + { + key: 'month', + label: '本月', + params: function () { + var date = new Date(); + var end = $filter('date')(date, 'yyyyMMdd'); + date = date.setDate(1); + return { + begin: $filter('date')(date, 'yyyyMMdd'), + end: end + } + } + }, + { + key: 'lastmonth', + label: '上月', + params: function () { + var date = new Date(); + date = date.setDate(1); + var oneDay=1000*60*60*24; + var end = $filter('date')(date-oneDay, 'yyyyMMdd'); + + var date2 = new Date(); + date2.setMonth(date2.getMonth() - 1); + date2 = date2.setDate(1); + var begin = $filter('date')(date2, 'yyyyMMdd'); + return { + begin: begin, + end: end + } + } + } + ]; + $scope.params = {}; + $scope.pagination = {}; + $scope.clientMoniker = $scope.currentUser.client_moniker; + $scope.loadDashboard = function () { + loadBasicInfo() + loadTransCommon(); + getAvgOrderAndCustomer(); + + }; + $scope.loadDashboard(); + function loadBasicInfo() { + $http.get('/dashboard/partner/' + $scope.clientMoniker + '/basic_info').then(function (resp) { + $scope.basicinfo = resp.data; + }); + } + function loadTransCommon() { + var params = {begin: $filter('date')(new Date(), 'yyyyMMdd'), end: $filter('date')(new Date(), 'yyyyMMdd')}; + $http.get('/dashboard/partner/trans_common',{params:params}).then(function (resp) { + $scope.transcommon = resp.data; + }); + } + function loadTradeAmountInTypes(params) { + var tradeInTypeConfig = { + chart: { + tooltip: { + trigger: 'item', + formatter: "{a}
{b} : {c} ({d}%)" + }, + toolbox: { + show: true, + feature: { + mySeven: { + title: 'Last a week', + show: true, + icon: 'path://M3.59-4.07L32.38-4.07L32.38 0.04Q22.25 25.11 17.19 46.34L10.65 46.34Q16.14 26.94 26.19 1.41L3.59 1.41L3.59-4.07Z', + onclick: function () { + loadTradeAmountInTypes($scope.scales[2].params()) + } + }, + myThirty: { + title: 'Last a month', + show: true, + icon: 'path://M12.52 17.02L16.10 17.02Q20.71 17.02 22.43 15.72Q25.66 13.23 25.66 8.23Q25.66-0.63 17.61-0.63Q10.93-0.63 9.42 6.93L3.73 6.93Q4.50 2.19 7.03-0.91Q10.90-5.51 17.61-5.51Q23.24-5.51 26.89-2.28Q31.22 1.52 31.22 8.02Q31.22 16.78 23.38 19.48Q32.84 23.14 32.84 32.81Q32.84 39.00 29.32 42.97Q25.10 47.79 17.72 47.79Q10.79 47.79 6.68 43.04Q3.66 39.56 3.02 33.44L8.93 33.44Q9.67 42.83 17.72 42.83Q21.45 42.83 23.98 40.72Q27.14 38.01 27.14 32.81Q27.14 21.63 16.10 21.63L12.52 21.63L12.52 17.02ZM54-5.51Q67.99-5.51 67.99 21.14Q67.99 47.79 54 47.79Q40.04 47.79 40.04 21.14Q40.04-5.51 54-5.51M46.97 33.65L59.84 4.30Q57.80-0.55 53.93-0.55Q45.95-0.55 45.95 21.14Q45.95 28.52 46.97 33.65M48.16 37.91Q50.13 42.83 54 42.83Q62.09 42.83 62.09 21.07Q62.09 13.86 61.07 8.66L48.16 37.91Z', + onclick: function () { + var params = {}; + var dt = new Date(); + params.end = $filter('date')(dt, 'yyyyMMdd'); + dt.setDate(dt.getDate() - 29); + params.begin = $filter('date')(dt, 'yyyyMMdd'); + loadTradeAmountInTypes(params) + } + } + } + }, + color: colors + }, + series: [{ + basic: { + name: '交易渠道', type: 'pie', itemStyle: { + emphasis: { + shadowBlur: 10, + shadowOffsetX: 0, + shadowColor: 'rgba(0, 0, 0, 0.5)' + } + } + }, + column: {key: 'aud_fee', name: 'gateway_label'} + }] + }; + $http.get('/dashboard/partner/trans_type_analysis',{params:params}).then(function (resp) { + $scope.trade_type_chart = chartParser.parse(tradeInTypeConfig, resp.data); + }); + } + loadTradeAmountInTypes($scope.scales[4].params()); + function getAvgOrderAndCustomer() { + $http.get('/dashboard/partner/' + $scope.clientMoniker + '/avg_order_customer').then(function (resp) { + $scope.avgOrderAndCustomer = resp.data; + }); + } + + + function loadFeeAnalysis(params) { + var analysisConfig = { + chart: { + tooltip: { + trigger: 'axis', + formatter: '{b}:AUD {c}' + }, + toolbox: { + show: true, + feature: { + mySeven: { + title: 'Last a week', + show: true, + icon: 'path://M3.59-4.07L32.38-4.07L32.38 0.04Q22.25 25.11 17.19 46.34L10.65 46.34Q16.14 26.94 26.19 1.41L3.59 1.41L3.59-4.07Z', + onclick: function () { + loadFeeAnalysis($scope.scales[2].params()); + } + }, + myThirty: { + title: 'Last a month', + show: true, + icon: 'path://M12.52 17.02L16.10 17.02Q20.71 17.02 22.43 15.72Q25.66 13.23 25.66 8.23Q25.66-0.63 17.61-0.63Q10.93-0.63 9.42 6.93L3.73 6.93Q4.50 2.19 7.03-0.91Q10.90-5.51 17.61-5.51Q23.24-5.51 26.89-2.28Q31.22 1.52 31.22 8.02Q31.22 16.78 23.38 19.48Q32.84 23.14 32.84 32.81Q32.84 39.00 29.32 42.97Q25.10 47.79 17.72 47.79Q10.79 47.79 6.68 43.04Q3.66 39.56 3.02 33.44L8.93 33.44Q9.67 42.83 17.72 42.83Q21.45 42.83 23.98 40.72Q27.14 38.01 27.14 32.81Q27.14 21.63 16.10 21.63L12.52 21.63L12.52 17.02ZM54-5.51Q67.99-5.51 67.99 21.14Q67.99 47.79 54 47.79Q40.04 47.79 40.04 21.14Q40.04-5.51 54-5.51M46.97 33.65L59.84 4.30Q57.80-0.55 53.93-0.55Q45.95-0.55 45.95 21.14Q45.95 28.52 46.97 33.65M48.16 37.91Q50.13 42.83 54 42.83Q62.09 42.83 62.09 21.07Q62.09 13.86 61.07 8.66L48.16 37.91Z', + onclick: function () { + var params = {}; + var dt = new Date(); + params.end = $filter('date')(dt, 'yyyyMMdd'); + dt.setDate(dt.getDate() - 29); + params.begin = $filter('date')(dt, 'yyyyMMdd'); + loadFeeAnalysis(params); + } + } + } + }, + yAxis: { + type: 'value', + name: 'Amount(AUD)' + }, + color: colors + }, + xAxis: { + basic: { + type: 'category', + boundaryGap: false + }, + key: 'date_str' + }, + series: [ + { + basic: {type: 'line', label: {normal: {show: true}}, showAllSymbols: true}, + column: {key: 'aud_fee'} + } + ] + }; + $http.get('/dashboard/partner/fee_analysis', {params: params}).then(function (resp) { + $scope.trade_line = chartParser.parse(analysisConfig, resp.data); + }) + } + loadFeeAnalysis($scope.scales[4].params()); + + function getOrderCustomerChartAnalysis(params) { + $http.get('/dashboard/partner/customers',{params:params}).then(function (resp) { + var dates = []; + var new_customers = []; + var old_customers = []; + var total_amounts = []; + var orders = []; + resp.data.reverse().forEach(function (e) { + dates.push(e.trade_date); + new_customers.push(e.new_customers); + old_customers.push(e.old_customers); + orders.push(e.orders); + total_amounts.push(e.total); + }); + $scope.customersHistory = customersHistoryConfig(dates, old_customers, new_customers, orders); + }); + } + getOrderCustomerChartAnalysis($scope.scales[4].params()); + var customersHistoryConfig = function (date, old_customers, new_customers, orders) { + return { + color: colors, + tooltip: { + trigger: 'axis', + axisPointer: { // 坐标轴指示器,坐标轴触发有效 + type: 'shadow' // 默认为直线,可选为:'line' | 'shadow' + } + }, + toolbox: { + show: true, + feature: { + mySeven: { + title: 'Last a week', + show: true, + icon: 'path://M3.59-4.07L32.38-4.07L32.38 0.04Q22.25 25.11 17.19 46.34L10.65 46.34Q16.14 26.94 26.19 1.41L3.59 1.41L3.59-4.07Z', + onclick: function () { + getOrderCustomerChartAnalysis($scope.scales[2].params()) + } + }, + myThirty: { + title: 'Last a month', + show: true, + icon: 'path://M12.52 17.02L16.10 17.02Q20.71 17.02 22.43 15.72Q25.66 13.23 25.66 8.23Q25.66-0.63 17.61-0.63Q10.93-0.63 9.42 6.93L3.73 6.93Q4.50 2.19 7.03-0.91Q10.90-5.51 17.61-5.51Q23.24-5.51 26.89-2.28Q31.22 1.52 31.22 8.02Q31.22 16.78 23.38 19.48Q32.84 23.14 32.84 32.81Q32.84 39.00 29.32 42.97Q25.10 47.79 17.72 47.79Q10.79 47.79 6.68 43.04Q3.66 39.56 3.02 33.44L8.93 33.44Q9.67 42.83 17.72 42.83Q21.45 42.83 23.98 40.72Q27.14 38.01 27.14 32.81Q27.14 21.63 16.10 21.63L12.52 21.63L12.52 17.02ZM54-5.51Q67.99-5.51 67.99 21.14Q67.99 47.79 54 47.79Q40.04 47.79 40.04 21.14Q40.04-5.51 54-5.51M46.97 33.65L59.84 4.30Q57.80-0.55 53.93-0.55Q45.95-0.55 45.95 21.14Q45.95 28.52 46.97 33.65M48.16 37.91Q50.13 42.83 54 42.83Q62.09 42.83 62.09 21.07Q62.09 13.86 61.07 8.66L48.16 37.91Z', + onclick: function () { + var params = {}; + var dt = new Date(); + params.end = $filter('date')(dt, 'yyyyMMdd'); + dt.setDate(dt.getDate() - 29); + params.begin = $filter('date')(dt, 'yyyyMMdd'); + getOrderCustomerChartAnalysis(params) + } + } + } + }, + legend: { + data: ['Old Customers', 'New Customers', 'Order Counts'] + }, + grid: { + left: '3%', + right: '4%', + bottom: '3%', + containLabel: true + }, + xAxis: [ + { + type: 'category', + data: date + } + ], + yAxis: [ + { + type: 'value', + name: 'Customers' + }, { + type: 'value', + name: 'Orders' + } + ], + series: [ + { + name: 'Old Customers', + type: 'bar', + stack: 'customers', + data: old_customers + }, + { + name: 'New Customers', + type: 'bar', + stack: 'customers', + data: new_customers + }, + { + name: 'Order Counts', + type: 'line', + yAxisIndex: 1, + data: orders + } + ] + }; + }; + + /*function loadTradeTimeAnalysis(params) { + var timeAnalysis = { + chart: { + tooltip: { + trigger: 'axis' + }, + toolbox: { + show: true, + feature: { + mySeven: { + title: '最近7天', + show: true, + icon: 'path://M3.59-4.07L32.38-4.07L32.38 0.04Q22.25 25.11 17.19 46.34L10.65 46.34Q16.14 26.94 26.19 1.41L3.59 1.41L3.59-4.07Z', + onclick: function () { + loadTradeTimeAnalysis($scope.scales[2].params()); + } + }, + myThirty: { + title: '最近30天', + show: true, + icon: 'path://M12.52 17.02L16.10 17.02Q20.71 17.02 22.43 15.72Q25.66 13.23 25.66 8.23Q25.66-0.63 17.61-0.63Q10.93-0.63 9.42 6.93L3.73 6.93Q4.50 2.19 7.03-0.91Q10.90-5.51 17.61-5.51Q23.24-5.51 26.89-2.28Q31.22 1.52 31.22 8.02Q31.22 16.78 23.38 19.48Q32.84 23.14 32.84 32.81Q32.84 39.00 29.32 42.97Q25.10 47.79 17.72 47.79Q10.79 47.79 6.68 43.04Q3.66 39.56 3.02 33.44L8.93 33.44Q9.67 42.83 17.72 42.83Q21.45 42.83 23.98 40.72Q27.14 38.01 27.14 32.81Q27.14 21.63 16.10 21.63L12.52 21.63L12.52 17.02ZM54-5.51Q67.99-5.51 67.99 21.14Q67.99 47.79 54 47.79Q40.04 47.79 40.04 21.14Q40.04-5.51 54-5.51M46.97 33.65L59.84 4.30Q57.80-0.55 53.93-0.55Q45.95-0.55 45.95 21.14Q45.95 28.52 46.97 33.65M48.16 37.91Q50.13 42.83 54 42.83Q62.09 42.83 62.09 21.07Q62.09 13.86 61.07 8.66L48.16 37.91Z', + onclick: function () { + var params = {}; + var dt = new Date(); + params.end = $filter('date')(dt, 'yyyyMMdd'); + dt.setDate(dt.getDate() - 29); + params.begin = $filter('date')(dt, 'yyyyMMdd'); + loadTradeTimeAnalysis(params) + } + } + } + }, + legend: { + data: ['Total Amount', 'Total Count', 'Retail In-Store Amount', 'Retail In-Store Count', 'Retail API Amount', 'Retail API Count', + 'QR Code Amount', 'QR Code Count', + 'Online API Amount', 'Online API Count', 'WeChat HTML5 Amount', 'WeChat HTML5 Count'], + bottom: 0, + height: '15%', + width: '80%', + left: '10%' + }, + grid: { + top: 10, + bottom: '15%', + containLabel: true + }, + yAxis: [ + { + name: 'Avg Amount(AUD)', + type: 'value' + }, + { + name: 'Avg Count(Records)', + type: 'value' + } + ], + color: colors + }, + xAxis: { + basic: {type: 'category', boundaryGap: false, formatter: '{value}:00'}, + key: 'hour' + }, + series: [ + { + basic: { + name: 'Total Amount', + type: 'line', + symbol: 'triangle', + areaStyle: {normal: {}}, + yAxisIndex: 0 + }, + column: {key: 'total_fee'} + }, + { + basic: { + name: 'Total Count', + type: 'line', + yAxisIndex: 1 + }, + column: {key: 'total_count'} + }, + { + basic: { + name: 'Retail In-Store Amount', + type: 'line', + symbol: 'triangle', + areaStyle: {normal: {}}, + yAxisIndex: 0 + }, + column: {key: 'offline_fee'} + }, + { + basic: { + name: 'Retail In-Store Count', + type: 'line', + yAxisIndex: 1 + }, + column: {key: 'offline_count'} + }, + { + basic: { + name: 'Retail API Amount', + type: 'line', + symbol: 'triangle', + areaStyle: {normal: {}}, + yAxisIndex: 0 + }, + column: {key: 'offline_api_fee'} + }, + { + basic: { + name: 'Retail API Count', + type: 'line', + yAxisIndex: 1 + }, + column: {key: 'offline_api_count'} + }, + { + basic: { + name: 'QR Code Amount', + type: 'line', + symbol: 'triangle', + areaStyle: {normal: {}}, + yAxisIndex: 0 + }, + column: {key: 'client_code_fee'} + }, + { + basic: { + name: 'QR Code Count', + type: 'line', + yAxisIndex: 1 + }, + column: {key: 'client_code_count'} + }, + { + basic: { + name: 'Online API Amount', + type: 'line', + symbol: 'triangle', + areaStyle: {normal: {}}, + yAxisIndex: 0 + }, + column: {key: 'gateway_qrcode_fee'} + }, + { + basic: { + name: 'Online API Count', + type: 'line', + yAxisIndex: 1 + }, + column: {key: 'gateway_qrcode_count'} + }, + { + basic: { + name: 'WeChat HTML5 Amount', + type: 'line', + symbol: 'triangle', + areaStyle: {normal: {}}, + yAxisIndex: 0 + }, + column: {key: 'gateway_jsapi_fee'} + }, + { + basic: { + name: 'WeChat HTML5 Count', + type: 'line', + yAxisIndex: 1 + }, + column: {key: 'gateway_jsapi_count'} + } + ] + }; + $http.get('/dashboard/partner/trade_in_hours', {params: params}).then(function (resp) { + $scope.trade_time = chartParser.parse(timeAnalysis, resp.data); + }) + } + loadTradeTimeAnalysis($scope.scales[4].params());*/ + + + + $scope.loadSettlementLogs = function (page) { + var params = angular.copy($scope.params); + // if (params.datefrom) { + // params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd'); + // } + // if (params.dateto) { + // params.dateto = $filter('date')(params.dateto, 'yyyyMMdd'); + // } + params.page = page || $scope.pagination.page || 1; + params.limit = 8; + $http.get('/dashboard/partner/' + $scope.clientMoniker + '/settlement_logs', {params: params}).then(function (resp) { + $scope.settlementLogs = resp.data.data; + $scope.pagination = resp.data.pagination; + }); + }; + $scope.getClearingTransactions = function (client_id,detail_id) { + $uibModal.open({ + templateUrl: '/static/analysis/templates/settlement_transactions.html', + controller: 'managerClearingDetailCtrl', + resolve: { + detail: ['$http', '$stateParams', function ($http) { + return $http.get('/dashboard/partner/' + client_id+'/settlement_logs/'+detail_id); + }] + }, + size: 'lg' + }); + }; + $scope.loadSettlementLogs(1); + }]); + + app.filter('abs', function () { + return function (value) { + return Math.abs(value); + } + }); return app; }); \ No newline at end of file diff --git a/src/main/ui/static/dashboard/templates/partner_dashboard.html b/src/main/ui/static/dashboard/templates/partner_dashboard.html index 17db7d8b5..a153e6a79 100644 --- a/src/main/ui/static/dashboard/templates/partner_dashboard.html +++ b/src/main/ui/static/dashboard/templates/partner_dashboard.html @@ -1,4 +1,5 @@ + - - - - - - - - - - + <!–
–> + <!–
–> + <!––> + <!––> + <!–
–> + <!–
–>
@@ -75,10 +76,10 @@ - + <!––> - - + <!––> @@ -90,7 +91,7 @@
- + <!–
–> - - - - - - - - - - - - + <!–
–> + <!–
–> + <!–

Customers

–> + <!–

–> + <!– /–> + <!– /–> + <!––> + <!–

–> + <!–

Total/New/Old

–> + <!–
–> + <!–
–>

Customers

@@ -170,4 +171,204 @@
- \ No newline at end of file +--> + + + +
+

+ Dashboard +

+ +
+
+
+
+
+ +
+ 15852 + TRADING VOLUME +
+

Yesterday: {{transcommon.yes.trade_amount|currency:'AUD'}} + + + {{((transcommon.today.trade_amount-transcommon.yes.trade_amount)/transcommon.yes.trade_amount)|number:2|abs}}%

+
+
+
+
+ +
+ 956 + TRANSACTIONS +
+

Yesterday: {{transcommon.yes.trade_count}} + + + {{((transcommon.today.trade_count-transcommon.yes.trade_count)/transcommon.yes.trade_count)|number:2|abs}}%

+
+
+
+
+ +
+ 5210 + New Customers +
+

Yesterday: {{transcommon.yes.new_customers}} + + + {{((transcommon.today.trade_count-transcommon.yes.new_customers)/transcommon.yes.new_customers*100)|number:2|abs}}%

+
+
+
+
+ +
+ 20544 + UNSETTLED +
+

Latest settle: {{transcommon.yes.not_settled|currency:'AUD '}} + + + {{((transcommon.today.not_settled-transcommon.yes.not_settled)/transcommon.yes.not_settled)|number:2|abs}}%

+
+
+
+
+
+
+
+

Transaction Time Analysis

+
    +
  • +
    {{basicinfo.rate_value.wechat_rate_value}}%
    + Wechat +
  • +
  • +
    {{basicinfo.rate_value.ali_rate_value}}%
    + Alipay +
  • +
+
+
+
+
+
+
+ +
+
+
+

Customers Analysis

+ +
    +
  • +

    {{avgOrderAndCustomer.old_customers.toFixed(0)||0}}

    +
    AVG OLD CUSTOMER
    +
  • +
  • +

    {{avgOrderAndCustomer.new_customers.toFixed(0)||0}}

    +
    AVG NEW CUSTOME
    +
  • +
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+

Settlement Logs

+ +
+ + + + + + + + + + + + + + + + + + + + +
DateTransaction Amountto MerchantService FeeOperation
+ + + +
+
+ +
+
+
+
+
+
+

交易类型分布-交易量

+ +
+
+
+
+
+
From 1561c75e50ab2a9ffb738e6330641893e0d267cf Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Sun, 8 Apr 2018 11:43:21 +0800 Subject: [PATCH 02/19] =?UTF-8?q?=E4=BF=AE=E6=94=B9partner=5Fdashboard.htm?= =?UTF-8?q?l?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/analysis/core/impls/DashboardServiceImpl.java | 5 +++++ src/main/ui/static/dashboard/partner-dashboard.js | 6 +++--- .../ui/static/dashboard/templates/partner_dashboard.html | 8 ++++---- 3 files changed, 12 insertions(+), 7 deletions(-) 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 2e6115587..8ec122767 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 @@ -23,6 +23,7 @@ import org.slf4j.LoggerFactory; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; +import java.math.BigDecimal; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -236,6 +237,10 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT params.put("end",DateUtils.addDays(params.getDate("end"),-1)); JSONObject yes = getTransJSONO(params); res.put("today",today); + 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):BigDecimal.ZERO); + res.put("trade_count_rise", yes.getIntValue("trade_count") > 0 ? (today.getIntValue("trade_count")-yes.getIntValue("trade_count"))/yes.getIntValue("trade_count") : 0); + res.put("new_customers_rise", yes.getIntValue("new_customers") > 0 ? (today.getIntValue("new_customers")-yes.getIntValue("new_customers"))/yes.getIntValue("new_customers") : 0); + res.put("not_settled_rise",yes.getBigDecimal("not_settled").compareTo(BigDecimal.ZERO)>0 ? (today.getBigDecimal("not_settled").subtract(yes.getBigDecimal("not_settled"))).divide(yes.getBigDecimal("not_settled"),4):BigDecimal.ZERO); res.put("yes",yes); return res; } diff --git a/src/main/ui/static/dashboard/partner-dashboard.js b/src/main/ui/static/dashboard/partner-dashboard.js index f95757588..3c93d7418 100644 --- a/src/main/ui/static/dashboard/partner-dashboard.js +++ b/src/main/ui/static/dashboard/partner-dashboard.js @@ -711,7 +711,7 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct $scope.trade_type_chart = chartParser.parse(tradeInTypeConfig, resp.data); }); } - loadTradeAmountInTypes($scope.scales[4].params()); + loadTradeAmountInTypes($scope.scales[2].params()); function getAvgOrderAndCustomer() { $http.get('/dashboard/partner/' + $scope.clientMoniker + '/avg_order_customer').then(function (resp) { $scope.avgOrderAndCustomer = resp.data; @@ -776,7 +776,7 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct $scope.trade_line = chartParser.parse(analysisConfig, resp.data); }) } - loadFeeAnalysis($scope.scales[4].params()); + loadFeeAnalysis($scope.scales[2].params()); function getOrderCustomerChartAnalysis(params) { $http.get('/dashboard/partner/customers',{params:params}).then(function (resp) { @@ -795,7 +795,7 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct $scope.customersHistory = customersHistoryConfig(dates, old_customers, new_customers, orders); }); } - getOrderCustomerChartAnalysis($scope.scales[4].params()); + getOrderCustomerChartAnalysis($scope.scales[2].params()); var customersHistoryConfig = function (date, old_customers, new_customers, orders) { return { color: colors, diff --git a/src/main/ui/static/dashboard/templates/partner_dashboard.html b/src/main/ui/static/dashboard/templates/partner_dashboard.html index a153e6a79..244b84572 100644 --- a/src/main/ui/static/dashboard/templates/partner_dashboard.html +++ b/src/main/ui/static/dashboard/templates/partner_dashboard.html @@ -202,7 +202,7 @@

Yesterday: {{transcommon.yes.trade_amount|currency:'AUD'}} - {{((transcommon.today.trade_amount-transcommon.yes.trade_amount)/transcommon.yes.trade_amount)|number:2|abs}}%

+ {{transcommon.trade_amount_rise|abs}}%

@@ -215,7 +215,7 @@

Yesterday: {{transcommon.yes.trade_count}} - {{((transcommon.today.trade_count-transcommon.yes.trade_count)/transcommon.yes.trade_count)|number:2|abs}}%

+ {{transcommon.trade_count_rise|number:2|abs}}%

@@ -228,7 +228,7 @@

Yesterday: {{transcommon.yes.new_customers}} - {{((transcommon.today.trade_count-transcommon.yes.new_customers)/transcommon.yes.new_customers*100)|number:2|abs}}%

+ {{transcommon.new_customers_rise|abs}}%

@@ -241,7 +241,7 @@

Latest settle: {{transcommon.yes.not_settled|currency:'AUD '}} - {{((transcommon.today.not_settled-transcommon.yes.not_settled)/transcommon.yes.not_settled)|number:2|abs}}%

+ {{transcommon.not_settled_rise|number:2|abs}}%

From fbae009d06f93ec1987f0a9639083264864d69a9 Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Sun, 8 Apr 2018 16:07:07 +0800 Subject: [PATCH 03/19] modify html --- .../web/PartnerDashboardController.java | 5 ----- .../ui/static/dashboard/partner-dashboard.js | 22 +++++++++---------- .../templates/partner_dashboard.html | 14 +++++++----- 3 files changed, 18 insertions(+), 23 deletions(-) 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 dda589b27..d11025051 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 @@ -55,11 +55,6 @@ public class PartnerDashboardController { public JSONObject transCommon(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner, AnalysisBean partnerAnalysisBean) { return dashboardService.getCommonAnalysis(partner,partnerAnalysisBean); } - @PartnerMapping("{client_moniker}/basic_info") - public JSONObject commonAnalysis(@PathVariable String client_moniker, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner) { - return partnerCardDashboardService.getCommonAnalysis(client_moniker); - } - @PartnerMapping("/trans_type_analysis") public List getTransTypesAnalysis(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner,AnalysisBean partnerAnalysisBean) { JSONObject params = partnerAnalysisBean.toParams("timezone"); diff --git a/src/main/ui/static/dashboard/partner-dashboard.js b/src/main/ui/static/dashboard/partner-dashboard.js index 3c93d7418..c2dea5647 100644 --- a/src/main/ui/static/dashboard/partner-dashboard.js +++ b/src/main/ui/static/dashboard/partner-dashboard.js @@ -642,23 +642,27 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct $scope.pagination = {}; $scope.clientMoniker = $scope.currentUser.client_moniker; $scope.loadDashboard = function () { - loadBasicInfo() loadTransCommon(); getAvgOrderAndCustomer(); + getExchangeRate(); }; $scope.loadDashboard(); - function loadBasicInfo() { - $http.get('/dashboard/partner/' + $scope.clientMoniker + '/basic_info').then(function (resp) { - $scope.basicinfo = resp.data; - }); - } function loadTransCommon() { var params = {begin: $filter('date')(new Date(), 'yyyyMMdd'), end: $filter('date')(new Date(), 'yyyyMMdd')}; $http.get('/dashboard/partner/trans_common',{params:params}).then(function (resp) { $scope.transcommon = resp.data; }); } + function getExchangeRate() { + $http.get('/dashboard/system/exchange_rates', {params: $scope.scales[0].params()}).then(function (resp) { + if (resp.data && resp.data.length > 0) { + $scope.wechat_rate = resp.data[0].Wechat.exchange_rate; + $scope.alipay_rate = resp.data[0].Alipay.exchange_rate; + $scope.exchange_date = resp.data[0].date.substr(0, 10); + } + }); + } function loadTradeAmountInTypes(params) { var tradeInTypeConfig = { chart: { @@ -1061,12 +1065,6 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct $scope.loadSettlementLogs = function (page) { var params = angular.copy($scope.params); - // if (params.datefrom) { - // params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd'); - // } - // if (params.dateto) { - // params.dateto = $filter('date')(params.dateto, 'yyyyMMdd'); - // } params.page = page || $scope.pagination.page || 1; params.limit = 8; $http.get('/dashboard/partner/' + $scope.clientMoniker + '/settlement_logs', {params: params}).then(function (resp) { diff --git a/src/main/ui/static/dashboard/templates/partner_dashboard.html b/src/main/ui/static/dashboard/templates/partner_dashboard.html index 244b84572..fcab9e18b 100644 --- a/src/main/ui/static/dashboard/templates/partner_dashboard.html +++ b/src/main/ui/static/dashboard/templates/partner_dashboard.html @@ -220,7 +220,7 @@
- +
5210 New Customers @@ -250,13 +250,15 @@

Transaction Time Analysis

+
    +
  • Exchange Rate
  • -
    {{basicinfo.rate_value.wechat_rate_value}}%
    +
    {{wechat_rate}}%
    Wechat
  • -
    {{basicinfo.rate_value.ali_rate_value}}%
    +
    {{alipay_rate}}%
    Alipay
@@ -309,9 +311,9 @@
-->
-
+
-
+

Settlement Logs

@@ -365,7 +367,7 @@

交易类型分布-交易量

-
From 33b3795a58cc153dbe0ec07a7ef13e11bbdf2cd3 Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Sun, 8 Apr 2018 19:41:34 +0800 Subject: [PATCH 04/19] fix partner dashboard --- .../analysis/core/DashboardService.java | 4 + .../core/impls/DashboardServiceImpl.java | 45 +++- .../web/PartnerDashboardController.java | 14 +- .../CustomerAndOrdersStatisticsMapper.xml | 9 +- .../ui/static/dashboard/partner-dashboard.js | 216 +++++++++++++++++- .../templates/partner_dashboard.html | 25 +- 6 files changed, 279 insertions(+), 34 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 4ce8b420f..3b7510566 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 @@ -50,4 +50,8 @@ public interface DashboardService { void generateCustomersAndOrdersStatistics(Date analysisDate); + JSONObject getOrderAndCustomerPerDay(JSONObject partner,AnalysisBean partnerAnalysisBean); + + List getStatisticsCustomersAndOrdersInDays(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 8ec122767..8bba8302a 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 @@ -7,6 +7,7 @@ import au.com.royalpay.payment.manage.analysis.core.DashboardService; import au.com.royalpay.payment.manage.analysis.mappers.ClientAnalysisMapper; import au.com.royalpay.payment.manage.analysis.mappers.CustomerAndOrdersStatisticsMapper; import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper; +import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper; import au.com.royalpay.payment.manage.mappers.system.ClientMapper; import au.com.royalpay.payment.manage.mappers.system.ExchangeRateMapper; import au.com.royalpay.payment.manage.merchants.core.ClientManager; @@ -16,6 +17,7 @@ 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.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.time.DurationFormatUtils; import org.slf4j.Logger; @@ -55,6 +57,11 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT @Resource private ExchangeRateMapper exchangeRateMapper; + @Resource + private TransactionMapper transactionMapper; + + + @Override public JSONObject getCommonAnalysis1(JSONObject params) { JSONObject res = transactionAnalysisMapper.getClientTransaction(params); @@ -237,10 +244,17 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT params.put("end",DateUtils.addDays(params.getDate("end"),-1)); JSONObject yes = getTransJSONO(params); res.put("today",today); + BigDecimal not_settled = new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params)); + res.put("not_settled", not_settled); + JSONObject object = new JSONObject(); + object.put("client_id", partner.getIntValue("client_id")); + PageList logs = transactionMapper.listSettlementLog(object, new PageBounds(1, 1, Order.formString("clearing_time.desc"))); + BigDecimal latest_settle = logs.isEmpty()?BigDecimal.ZERO:logs.get(0).getBigDecimal("income"); + res.put("latest_settle",latest_settle); 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):BigDecimal.ZERO); res.put("trade_count_rise", yes.getIntValue("trade_count") > 0 ? (today.getIntValue("trade_count")-yes.getIntValue("trade_count"))/yes.getIntValue("trade_count") : 0); res.put("new_customers_rise", yes.getIntValue("new_customers") > 0 ? (today.getIntValue("new_customers")-yes.getIntValue("new_customers"))/yes.getIntValue("new_customers") : 0); - res.put("not_settled_rise",yes.getBigDecimal("not_settled").compareTo(BigDecimal.ZERO)>0 ? (today.getBigDecimal("not_settled").subtract(yes.getBigDecimal("not_settled"))).divide(yes.getBigDecimal("not_settled"),4):BigDecimal.ZERO); + res.put("not_settled_rise",not_settled.compareTo(BigDecimal.ZERO)>0 ? (not_settled.subtract(latest_settle)).divide(latest_settle,4):BigDecimal.ZERO); res.put("yes",yes); return res; } @@ -249,7 +263,6 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT JSONObject object = transactionAnalysisMapper.getClientTransaction(params); res.put("trade_amount", object.getBigDecimal("trade_amount")); res.put("trade_count", object.getIntValue("trade_count")); - res.put("not_settled", transactionAnalysisMapper.analysisNotSettled(params)); res.put("new_customers", transactionAnalysisMapper.countNewCustomers(params)); return res; } @@ -463,4 +476,32 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT resp.put("aliOnline_order_count",transactionAnalysisMapper.getPlatformAmount(params).getIntValue("order_count")); return resp; } + + @Override + public JSONObject getOrderAndCustomerPerDay(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"); + } + params.put("client_id", partner.getIntValue("client_id")); + return customerAndOrdersStatisticsMapper.getAvgOrderAndCustomerStatistics(params); + } + + @Override + public List getStatisticsCustomersAndOrdersInDays(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"); + } + params.put("client_id", partner.getIntValue("client_id")); + return customerAndOrdersStatisticsMapper.getPartnerCustomerAndOrderStatistics(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 d11025051..de6766610 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 @@ -42,19 +42,13 @@ public class PartnerDashboardController { @PartnerMapping("/fee_analysis") public List tradeInDays(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner,AnalysisBean partnerAnalysisBean) { - return dashboardService.getTradeAnalysisInDays(partner,partnerAnalysisBean); + return dashboardService.getStatisticsCustomersAndOrdersInDays(partner,partnerAnalysisBean); } @PartnerMapping("/customers") public List customersInDays(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner,AnalysisBean partnerAnalysisBean) { return dashboardService.getCustomersAndOrdersInDays(partner,partnerAnalysisBean); } - - - @PartnerMapping("/trans_common") - public JSONObject transCommon(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner, AnalysisBean partnerAnalysisBean) { - return dashboardService.getCommonAnalysis(partner,partnerAnalysisBean); - } @PartnerMapping("/trans_type_analysis") public List getTransTypesAnalysis(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner,AnalysisBean partnerAnalysisBean) { JSONObject params = partnerAnalysisBean.toParams("timezone"); @@ -62,9 +56,9 @@ public class PartnerDashboardController { return dashboardService.getTradeInTypes(params); } - @PartnerMapping("{client_moniker}/avg_order_customer") - public JSONObject getAvgOrderAndCustomer(@PathVariable String client_moniker, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner) { - return partnerCardDashboardService.getOrderAndCustomerPerDay(client_moniker); + @PartnerMapping("/avg_order_customer") + public JSONObject getAvgOrderAndCustomer(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner,AnalysisBean partnerAnalysisBean) { + return dashboardService.getOrderAndCustomerPerDay(partner,partnerAnalysisBean); } @PartnerMapping("{client_moniker}/settlement_logs") 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 2a904bd08..20e2a813e 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 @@ -192,9 +192,14 @@ + where + + s.client_id = #{client_id} + + and s.date >= #{begin} + and s.date < #{end} diff --git a/src/main/ui/static/dashboard/partner-dashboard.js b/src/main/ui/static/dashboard/partner-dashboard.js index c2dea5647..469c75db6 100644 --- a/src/main/ui/static/dashboard/partner-dashboard.js +++ b/src/main/ui/static/dashboard/partner-dashboard.js @@ -643,14 +643,13 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct $scope.clientMoniker = $scope.currentUser.client_moniker; $scope.loadDashboard = function () { loadTransCommon(); - getAvgOrderAndCustomer(); getExchangeRate(); }; $scope.loadDashboard(); function loadTransCommon() { var params = {begin: $filter('date')(new Date(), 'yyyyMMdd'), end: $filter('date')(new Date(), 'yyyyMMdd')}; - $http.get('/dashboard/partner/trans_common',{params:params}).then(function (resp) { + $http.get('/dashboard/partner/common_analysis',{params:params}).then(function (resp) { $scope.transcommon = resp.data; }); } @@ -716,11 +715,6 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct }); } loadTradeAmountInTypes($scope.scales[2].params()); - function getAvgOrderAndCustomer() { - $http.get('/dashboard/partner/' + $scope.clientMoniker + '/avg_order_customer').then(function (resp) { - $scope.avgOrderAndCustomer = resp.data; - }); - } function loadFeeAnalysis(params) { @@ -767,12 +761,12 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct type: 'category', boundaryGap: false }, - key: 'date_str' + key: 'date' }, series: [ { basic: {type: 'line', label: {normal: {show: true}}, showAllSymbols: true}, - column: {key: 'aud_fee'} + column: {key: 'total'} } ] }; @@ -783,6 +777,9 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct loadFeeAnalysis($scope.scales[2].params()); function getOrderCustomerChartAnalysis(params) { + $http.get('/dashboard/partner/avg_order_customer',{params:params}).then(function (resp) { + $scope.avgOrderAndCustomer = resp.data; + }); $http.get('/dashboard/partner/customers',{params:params}).then(function (resp) { var dates = []; var new_customers = []; @@ -817,6 +814,7 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct show: true, icon: 'path://M3.59-4.07L32.38-4.07L32.38 0.04Q22.25 25.11 17.19 46.34L10.65 46.34Q16.14 26.94 26.19 1.41L3.59 1.41L3.59-4.07Z', onclick: function () { + $scope.time_range = "Last a week"; getOrderCustomerChartAnalysis($scope.scales[2].params()) } }, @@ -830,6 +828,7 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct params.end = $filter('date')(dt, 'yyyyMMdd'); dt.setDate(dt.getDate() - 29); params.begin = $filter('date')(dt, 'yyyyMMdd'); + $scope.time_range = "Last a month"; getOrderCustomerChartAnalysis(params) } } @@ -1060,9 +1059,26 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct }) } loadTradeTimeAnalysis($scope.scales[4].params());*/ + $scope.displayExchangeRateHistory = function () { + $uibModal.open({ + templateUrl: '/static/dashboard/templates/exchange_rate_history_dialog.html', + controller: 'exchangeRateHistoryDialogCtrl', + size: 'lg' + }) + }; - - + $scope.getCurrentPartner = function () { + $http.get('/client/partner_info').then(function (resp) { + $scope.manual_settle = resp.data.manual_settle; + }) + }; + $scope.getCurrentPartner(); + $scope.toShowUnSettledDialog = function () { + $uibModal.open({ + templateUrl: '/static/dashboard/templates/partner_dashboard_unsettled_dialog.html', + controller: 'unSettledAmountHistoryDialogCtrl' + }) + }; $scope.loadSettlementLogs = function (page) { var params = angular.copy($scope.params); params.page = page || $scope.pagination.page || 1; @@ -1088,6 +1104,184 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct }]); + app.controller('exchangeRateHistoryDialogCtrl', ['$scope', '$http', '$filter', 'chartParser', function ($scope, $http, $filter, chartParser) { + $scope.loadExchangeRateHistory = function (days) { + var endDate = new Date(); + var startDate = new Date(); + startDate.setDate(startDate.getDate() - days); + $http.get('/dashboard/system/exchange_rates', { + params: { + begin: $filter('date')(startDate, 'yyyyMMdd'), + end: $filter('date')(endDate, 'yyyyMMdd') + } + }).then(function (resp) { + handleRateHistoryChart(resp.data); + }) + }; + $scope.loadExchangeRateHistory(7); + var rateHistoryConfig = { + chart: { + tooltip: { + trigger: 'axis', + }, + toolbox: { + show: true, + feature: { + mySeven: { + title: 'Last 7 Days', + show: true, + icon: 'path://M3.59-4.07L32.38-4.07L32.38 0.04Q22.25 25.11 17.19 46.34L10.65 46.34Q16.14 26.94 26.19 1.41L3.59 1.41L3.59-4.07Z', + onclick: function () { + $scope.loadExchangeRateHistory(7) + } + }, + myThirty: { + title: 'Last 30 Days', + show: true, + icon: 'path://M12.52 17.02L16.10 17.02Q20.71 17.02 22.43 15.72Q25.66 13.23 25.66 8.23Q25.66-0.63 17.61-0.63Q10.93-0.63 9.42 6.93L3.73 6.93Q4.50 2.19 7.03-0.91Q10.90-5.51 17.61-5.51Q23.24-5.51 26.89-2.28Q31.22 1.52 31.22 8.02Q31.22 16.78 23.38 19.48Q32.84 23.14 32.84 32.81Q32.84 39.00 29.32 42.97Q25.10 47.79 17.72 47.79Q10.79 47.79 6.68 43.04Q3.66 39.56 3.02 33.44L8.93 33.44Q9.67 42.83 17.72 42.83Q21.45 42.83 23.98 40.72Q27.14 38.01 27.14 32.81Q27.14 21.63 16.10 21.63L12.52 21.63L12.52 17.02ZM54-5.51Q67.99-5.51 67.99 21.14Q67.99 47.79 54 47.79Q40.04 47.79 40.04 21.14Q40.04-5.51 54-5.51M46.97 33.65L59.84 4.30Q57.80-0.55 53.93-0.55Q45.95-0.55 45.95 21.14Q45.95 28.52 46.97 33.65M48.16 37.91Q50.13 42.83 54 42.83Q62.09 42.83 62.09 21.07Q62.09 13.86 61.07 8.66L48.16 37.91Z', + onclick: function () { + $scope.loadExchangeRateHistory(30) + } + } + } + }, + legend: { + data: ['Wechat', 'Alipay'], + bottom: 0, + height: '15%', + width: '80%', + left: '10%' + }, + yAxis: { + type: 'value', + name: 'Exchange Rate', + min: 'auto' + } + }, + xAxis: { + basic: { + type: 'category', + boundaryGap: false + }, + key: 'date' + }, + series: [ + { + basic: { + name: 'Wechat', + type: 'line', + label: {normal: {show: true}}, + showAllSymbols: true, + showSymbol: true, + yAxisIndex: 0, + itemStyle : { + normal : { + color:'#09bb07', + lineStyle:{ + color:'#09bb07' + } + } + } + + }, + column: {key: 'Wechat.exchange_rate'} + }, + { + basic: { + name: 'Alipay', + type: 'line', + label: {normal: {show: true}}, + showAllSymbols: true, + showSymbol: true, + yAxisIndex: 0, + itemStyle : { + normal : { + color:'#00c0ef', + lineStyle:{ + color:'#00c0ef' + } + } + } + + }, + column: {key: 'Alipay.exchange_rate'} + } + ] + }; + + function handleRateHistoryChart(exchangeRates) { + $scope.rateHistory = chartParser.parse(rateHistoryConfig, exchangeRates); + } + }]); + + app.controller('unSettledAmountHistoryDialogCtrl', ['$scope', '$http', '$filter','commonDialog', function ($scope, $http, $filter,commonDialog) { + $scope.params = {isAll:true}; + $scope.settleParams = {}; + $scope.unSettledAmountHistory = function () { + $http.get('/client/manual_settle/today').then(function (resp) { + $scope.currentSettle = resp.data; + $scope.settleParams = angular.copy($scope.currentSettle); + if($scope.currentSettle.settle_to){ + $scope.params.isAll = false; + $scope.params.to_date = new Date($scope.currentSettle.settle_to); + } + $scope.params.maxData = $scope.currentSettle.unsettle[0].date_str; + }) + }; + $scope.unSettledAmountHistory(); + $scope.changeIsAll = function () { + if($scope.params.isAll){ + $scope.params.to_date = ''; + $scope.settleParams = angular.copy($scope.currentSettle); + }else { + if($scope.currentSettle.settle_to){ + $scope.params.to_date = new Date($scope.currentSettle.settle_to); + }else{ + $scope.params.to_date = $scope.params.maxData; + } + } + }; + $scope.$watch('params.to_date', function() { + $scope.settleParams = angular.copy($scope.currentSettle); + if($scope.params.to_date){ + $scope.params.isAll=false; + $scope.to_date = $filter('date')($scope.params.to_date, 'yyyy-MM-dd'); + var cashbackChoose = {}; + var count = 0; + var total_settle_amount = 0.00; + angular.forEach($scope.currentSettle.unsettle, function (unsettle) { + if (new Date(unsettle.date_str).getTime() <= new Date($scope.to_date).getTime()) { + cashbackChoose[count] = unsettle; + if(unsettle.settle_amount != null){ + total_settle_amount = decimal.add(unsettle.settle_amount,total_settle_amount).toFixed(2); + } + count++; + } + }); + $scope.settleParams.unsettle = cashbackChoose; + $scope.settleParams.total_settle_amount = total_settle_amount; + }else { + $scope.params.isAll = true; + } + try { + $scope.$digest(); + }catch (err){} + }); + $scope.manualSettle = function () { + if($scope.currentSettle.locked){ + alert("系统正好在执行清算任务,暂不能提现,请稍后再试!"); + return; + } + $scope.settle_to = $scope.params.to_date || $scope.params.maxData; + $scope.settle_to = $filter('date')($scope.settle_to, 'yyyy-MM-dd'); + $http.put('/client/manual_settle/today', {settle_to: $scope.settle_to}).then(function () { + commonDialog.alert({title: 'Success', content: 'Withdraw application has been submitted', type: 'success'}); + $scope.$close(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + } + }]); app.filter('abs', function () { return function (value) { return Math.abs(value); diff --git a/src/main/ui/static/dashboard/templates/partner_dashboard.html b/src/main/ui/static/dashboard/templates/partner_dashboard.html index fcab9e18b..811238c8a 100644 --- a/src/main/ui/static/dashboard/templates/partner_dashboard.html +++ b/src/main/ui/static/dashboard/templates/partner_dashboard.html @@ -235,13 +235,16 @@
- 20544 + 20544 UNSETTLED
-

Latest settle: {{transcommon.yes.not_settled|currency:'AUD '}} - - - {{transcommon.not_settled_rise|number:2|abs}}%

+

Latest: {{transcommon.latest_settle|currency:'AUD '}} + + + {{transcommon.not_settled_rise|number:2|abs}}% + + +

@@ -249,16 +252,18 @@
-

Transaction Time Analysis

+

Transaction Trade Analysis

-
    +
    • Exchange Rate
    • -
      {{wechat_rate}}%
      +
      {{wechat_rate}}
      Wechat
    • -
      {{alipay_rate}}%
      +
      {{alipay_rate}}
      Alipay
    @@ -276,6 +281,8 @@

    Customers Analysis

      +
    • Last a week
    • +
    • {{time_range}}
    • {{avgOrderAndCustomer.old_customers.toFixed(0)||0}}

      AVG OLD CUSTOMER
      From d367f9c61596320b4fff41b38bc0fb068b316743 Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Mon, 9 Apr 2018 10:05:51 +0800 Subject: [PATCH 05/19] fix bug --- .../core/impls/DashboardServiceImpl.java | 7 +--- .../ui/static/dashboard/partner-dashboard.js | 4 +- .../templates/partner_dashboard.html | 37 ++++++------------- 3 files changed, 16 insertions(+), 32 deletions(-) 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 8bba8302a..4432474f4 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 @@ -244,17 +244,14 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT params.put("end",DateUtils.addDays(params.getDate("end"),-1)); JSONObject yes = getTransJSONO(params); res.put("today",today); - BigDecimal not_settled = new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params)); - res.put("not_settled", not_settled); + res.put("not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params))); JSONObject object = new JSONObject(); object.put("client_id", partner.getIntValue("client_id")); PageList logs = transactionMapper.listSettlementLog(object, new PageBounds(1, 1, Order.formString("clearing_time.desc"))); - BigDecimal latest_settle = logs.isEmpty()?BigDecimal.ZERO:logs.get(0).getBigDecimal("income"); - res.put("latest_settle",latest_settle); + res.put("latest_settle",logs.isEmpty()?BigDecimal.ZERO:logs.get(0).getBigDecimal("income")); 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):BigDecimal.ZERO); res.put("trade_count_rise", yes.getIntValue("trade_count") > 0 ? (today.getIntValue("trade_count")-yes.getIntValue("trade_count"))/yes.getIntValue("trade_count") : 0); res.put("new_customers_rise", yes.getIntValue("new_customers") > 0 ? (today.getIntValue("new_customers")-yes.getIntValue("new_customers"))/yes.getIntValue("new_customers") : 0); - res.put("not_settled_rise",not_settled.compareTo(BigDecimal.ZERO)>0 ? (not_settled.subtract(latest_settle)).divide(latest_settle,4):BigDecimal.ZERO); res.put("yes",yes); return res; } diff --git a/src/main/ui/static/dashboard/partner-dashboard.js b/src/main/ui/static/dashboard/partner-dashboard.js index 469c75db6..7a2aed827 100644 --- a/src/main/ui/static/dashboard/partner-dashboard.js +++ b/src/main/ui/static/dashboard/partner-dashboard.js @@ -1082,7 +1082,7 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct $scope.loadSettlementLogs = function (page) { var params = angular.copy($scope.params); params.page = page || $scope.pagination.page || 1; - params.limit = 8; + params.limit = 10; $http.get('/dashboard/partner/' + $scope.clientMoniker + '/settlement_logs', {params: params}).then(function (resp) { $scope.settlementLogs = resp.data.data; $scope.pagination = resp.data.pagination; @@ -1284,7 +1284,7 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct }]); app.filter('abs', function () { return function (value) { - return Math.abs(value); + return Math.abs(value*100); } }); return app; diff --git a/src/main/ui/static/dashboard/templates/partner_dashboard.html b/src/main/ui/static/dashboard/templates/partner_dashboard.html index 811238c8a..91da75b2e 100644 --- a/src/main/ui/static/dashboard/templates/partner_dashboard.html +++ b/src/main/ui/static/dashboard/templates/partner_dashboard.html @@ -215,7 +215,7 @@

      Yesterday: {{transcommon.yes.trade_count}} - {{transcommon.trade_count_rise|number:2|abs}}%

      + {{transcommon.trade_count_rise|abs}}%

@@ -235,15 +235,13 @@
- 20544 + + {{transcommon.not_settled|currency:'AUD '}} + + UNSETTLED
-

Latest: {{transcommon.latest_settle|currency:'AUD '}} - - - {{transcommon.not_settled_rise|number:2|abs}}% - - +

Latest settlement: {{transcommon.latest_settle|currency:'AUD '}}

@@ -321,7 +319,12 @@
-

Settlement Logs

+

+ Settlement Logs + + more +

+ +
@@ -350,22 +353,6 @@
-
From bfc1617fcf9515902976a13ff7cd1810ca1133ff Mon Sep 17 00:00:00 2001 From: "eason.qian" Date: Mon, 9 Apr 2018 16:40:17 +0800 Subject: [PATCH 06/19] fix --- src/main/ui/static/dashboard/templates/partner_dashboard.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/ui/static/dashboard/templates/partner_dashboard.html b/src/main/ui/static/dashboard/templates/partner_dashboard.html index 91da75b2e..46c590b21 100644 --- a/src/main/ui/static/dashboard/templates/partner_dashboard.html +++ b/src/main/ui/static/dashboard/templates/partner_dashboard.html @@ -318,7 +318,7 @@
-
+

Settlement Logs + more @@ -361,7 +361,7 @@

交易类型分布-交易量

-

From e28adf6a236f3bac8a8154ef2c03d8ea7a943230 Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Tue, 10 Apr 2018 11:12:08 +0800 Subject: [PATCH 07/19] fix bug --- .../core/impls/DashboardServiceImpl.java | 14 +- .../web/PartnerDashboardController.java | 9 - .../CustomerAndOrdersStatisticsMapper.xml | 13 +- .../mappers/TransactionAnalysisMapper.xml | 10 +- .../ui/static/css/new_partner_dashboard.css | 9 + .../ui/static/dashboard/partner-dashboard.js | 304 ++++-------------- .../templates/partner_dashboard.html | 44 ++- 7 files changed, 127 insertions(+), 276 deletions(-) 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 4432474f4..06aa2ccd1 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 @@ -244,15 +244,15 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT params.put("end",DateUtils.addDays(params.getDate("end"),-1)); JSONObject yes = getTransJSONO(params); res.put("today",today); + res.put("yes",yes); res.put("not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params))); - JSONObject object = new JSONObject(); - object.put("client_id", partner.getIntValue("client_id")); - PageList logs = transactionMapper.listSettlementLog(object, new PageBounds(1, 1, Order.formString("clearing_time.desc"))); - res.put("latest_settle",logs.isEmpty()?BigDecimal.ZERO:logs.get(0).getBigDecimal("income")); - 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):BigDecimal.ZERO); - res.put("trade_count_rise", yes.getIntValue("trade_count") > 0 ? (today.getIntValue("trade_count")-yes.getIntValue("trade_count"))/yes.getIntValue("trade_count") : 0); + 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, BigDecimal.ROUND_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, BigDecimal.ROUND_HALF_UP) : 0); res.put("new_customers_rise", yes.getIntValue("new_customers") > 0 ? (today.getIntValue("new_customers")-yes.getIntValue("new_customers"))/yes.getIntValue("new_customers") : 0); - res.put("yes",yes); + params.remove("begin"); + params.remove("end"); + PageList logs = transactionMapper.listSettlementLog(params, new PageBounds(1, 1, Order.formString("clearing_time.desc"))); + res.put("latest_settle",logs.isEmpty()?BigDecimal.ZERO:logs.get(0).getBigDecimal("income")); return res; } private JSONObject getTransJSONO(JSONObject 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 de6766610..75e8f2337 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 @@ -60,13 +60,4 @@ public class PartnerDashboardController { public JSONObject getAvgOrderAndCustomer(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner,AnalysisBean partnerAnalysisBean) { return dashboardService.getOrderAndCustomerPerDay(partner,partnerAnalysisBean); } - - @PartnerMapping("{client_moniker}/settlement_logs") - public JSONObject getPartnerSettlementLog(@PathVariable String client_moniker, TradeLogQuery query, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner) { - return partnerCardDashboardService.getSettlementLog(client_moniker, query); - } - @PartnerMapping("/{client_id}/settlement_logs/{detailId}") - public JSONObject listClearingTransactions(@PathVariable int client_id, @PathVariable String detailId) { - return cleanService.getCleanLogTransactions(client_id, detailId); - } } 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 20e2a813e..0193e2c0f 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 @@ -194,12 +194,19 @@ SELECT AVG(total) total,avg(orders) orders,avg(single_amount)single_amount,avg(customers) customers,avg(new_customers) new_customers,avg(old_customers)old_customers FROM statistics_customer_order s ]]> - where - - s.client_id = #{client_id} + + + AND s.client_id IN + + #{client_id} + + + + and s.client_id=#{client_id} and s.date >= #{begin} and s.date < #{end} + diff --git a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/TransactionAnalysisMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/TransactionAnalysisMapper.xml index 0cc9af372..013fb8311 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/TransactionAnalysisMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/TransactionAnalysisMapper.xml @@ -202,7 +202,15 @@ INNER JOIN pmt_orders o ON o.order_id = l.order_id WHERE (l.transaction_type = 'Credit' or l.refund_id is not null) ]]> - AND l.client_id = #{client_id} + + AND l.client_id IN + + #{client_id} + + + + and l.client_id=#{client_id} + and o.create_time >= #{begin} and o.create_time <= #{end} and l.org_id=#{org_id} diff --git a/src/main/ui/static/css/new_partner_dashboard.css b/src/main/ui/static/css/new_partner_dashboard.css index c7410eaf0..d491780db 100644 --- a/src/main/ui/static/css/new_partner_dashboard.css +++ b/src/main/ui/static/css/new_partner_dashboard.css @@ -101,3 +101,12 @@ mdi { .m-r-5 { margin-right: 5px; } +list-inline { + padding-left: 0; + list-style: none; +} +.widget-chart li { + width: 31.5%; + display: inline-block; + padding: 0; +} \ No newline at end of file diff --git a/src/main/ui/static/dashboard/partner-dashboard.js b/src/main/ui/static/dashboard/partner-dashboard.js index 7a2aed827..ddd6a1ff4 100644 --- a/src/main/ui/static/dashboard/partner-dashboard.js +++ b/src/main/ui/static/dashboard/partner-dashboard.js @@ -568,7 +568,7 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct } }]);*/ - app.controller('partnerDashboardCtrl', ['$scope', '$http', '$filter', '$uibModal','$timeout', 'chartParser', function ($scope, $http, $filter, $uibModal,$timeout, chartParser) { + app.controller('partnerDashboardCtrl', ['$scope', '$http', '$filter', '$uibModal','$timeout', 'chartParser','clearingDetailService', function ($scope, $http, $filter, $uibModal,$timeout, chartParser,clearingDetailService) { $scope.scales = [ { key: 'today', @@ -598,61 +598,71 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct params: function () { var date = new Date(); var end = $filter('date')(date, 'yyyyMMdd'); - date = date.setDate(date.getDate() - 6); - return { - begin: $filter('date')(date, 'yyyyMMdd'), - end: end - } - } - }, - { - key: 'month', - label: '本月', - params: function () { - var date = new Date(); - var end = $filter('date')(date, 'yyyyMMdd'); - date = date.setDate(1); + date = date.setDate(date.getDate() - 7); return { begin: $filter('date')(date, 'yyyyMMdd'), end: end } } }, - { - key: 'lastmonth', - label: '上月', - params: function () { - var date = new Date(); - date = date.setDate(1); - var oneDay=1000*60*60*24; - var end = $filter('date')(date-oneDay, 'yyyyMMdd'); - - var date2 = new Date(); - date2.setMonth(date2.getMonth() - 1); - date2 = date2.setDate(1); - var begin = $filter('date')(date2, 'yyyyMMdd'); - return { - begin: begin, - end: end - } - } - } ]; $scope.params = {}; $scope.pagination = {}; $scope.clientMoniker = $scope.currentUser.client_moniker; + $scope.chooseShow = 'All'; + $scope.clients = [$scope.currentUser.client]; + if ($scope.currentUser.client.has_children) { + $scope.params.client_ids = []; + $http.get('/client/partner_info/sub_partners',$scope.req).then(function (resp) { + var clientList = resp.data; + clientList.forEach(function (client) { + $scope.clients.push(client); + }); + $scope.clients.forEach(function (client) { + $scope.params.client_ids.push(client.client_id); + }); + $scope.loadDashboard(); + }) + } + $scope.chooseClient = function (sub) { + $scope.params.client_ids = []; + if (sub == 'All') { + $scope.chooseShow = 'All'; + $scope.clients.forEach(function (client) { + $scope.params.client_ids.push(client.client_id); + }); + } else { + $scope.params.client_ids = [sub.client_id]; + $scope.chooseShow = sub.short_name; + } + $scope.loadDashboard(); + }; + $scope.loadSettlementLogs = function (page) { + var params = {limit:10}; + $http.get('/client/trans_flow/settlement/log', {params: angular.merge(params,$scope.params)}).then(function (resp) { + $scope.settlementLogs = resp.data.data; + }); + }; $scope.loadDashboard = function () { loadTransCommon(); getExchangeRate(); + loadTradeAmountInTypes(angular.merge($scope.scales[2].params(),angular.copy($scope.params))); + loadFeeAnalysis(angular.merge($scope.scales[2].params(),angular.copy($scope.params))); + getOrderCustomerChartAnalysis(angular.merge($scope.scales[2].params(),angular.copy($scope.params))); + $scope.loadSettlementLogs(1); }; - $scope.loadDashboard(); + if (!$scope.currentUser.client.has_children){ + $scope.loadDashboard(); + } function loadTransCommon() { - var params = {begin: $filter('date')(new Date(), 'yyyyMMdd'), end: $filter('date')(new Date(), 'yyyyMMdd')}; + var params = angular.copy($scope.params); + params = angular.merge(params, $scope.scales[0].params()); $http.get('/dashboard/partner/common_analysis',{params:params}).then(function (resp) { $scope.transcommon = resp.data; }); } + function getExchangeRate() { $http.get('/dashboard/system/exchange_rates', {params: $scope.scales[0].params()}).then(function (resp) { if (resp.data && resp.data.length > 0) { @@ -714,7 +724,6 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct $scope.trade_type_chart = chartParser.parse(tradeInTypeConfig, resp.data); }); } - loadTradeAmountInTypes($scope.scales[2].params()); function loadFeeAnalysis(params) { @@ -732,7 +741,7 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct show: true, icon: 'path://M3.59-4.07L32.38-4.07L32.38 0.04Q22.25 25.11 17.19 46.34L10.65 46.34Q16.14 26.94 26.19 1.41L3.59 1.41L3.59-4.07Z', onclick: function () { - loadFeeAnalysis($scope.scales[2].params()); + loadFeeAnalysis(angular.merge($scope.scales[2].params(),$scope.params)); } }, myThirty: { @@ -745,7 +754,7 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct params.end = $filter('date')(dt, 'yyyyMMdd'); dt.setDate(dt.getDate() - 29); params.begin = $filter('date')(dt, 'yyyyMMdd'); - loadFeeAnalysis(params); + loadFeeAnalysis(angular.merge(params,$scope.params)); } } } @@ -774,20 +783,20 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct $scope.trade_line = chartParser.parse(analysisConfig, resp.data); }) } - loadFeeAnalysis($scope.scales[2].params()); + function getOrderCustomerChartAnalysis(params) { $http.get('/dashboard/partner/avg_order_customer',{params:params}).then(function (resp) { $scope.avgOrderAndCustomer = resp.data; }); - $http.get('/dashboard/partner/customers',{params:params}).then(function (resp) { + $http.get('/dashboard/partner/fee_analysis',{params:angular.merge(params,$scope.params)}).then(function (resp) { var dates = []; var new_customers = []; var old_customers = []; var total_amounts = []; var orders = []; - resp.data.reverse().forEach(function (e) { - dates.push(e.trade_date); + resp.data.forEach(function (e) { + dates.push(e.date); new_customers.push(e.new_customers); old_customers.push(e.old_customers); orders.push(e.orders); @@ -796,7 +805,7 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct $scope.customersHistory = customersHistoryConfig(dates, old_customers, new_customers, orders); }); } - getOrderCustomerChartAnalysis($scope.scales[2].params()); + var customersHistoryConfig = function (date, old_customers, new_customers, orders) { return { color: colors, @@ -815,7 +824,7 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct icon: 'path://M3.59-4.07L32.38-4.07L32.38 0.04Q22.25 25.11 17.19 46.34L10.65 46.34Q16.14 26.94 26.19 1.41L3.59 1.41L3.59-4.07Z', onclick: function () { $scope.time_range = "Last a week"; - getOrderCustomerChartAnalysis($scope.scales[2].params()) + getOrderCustomerChartAnalysis(angular.merge($scope.scales[2].params(),$scope.params)) } }, myThirty: { @@ -829,7 +838,7 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct dt.setDate(dt.getDate() - 29); params.begin = $filter('date')(dt, 'yyyyMMdd'); $scope.time_range = "Last a month"; - getOrderCustomerChartAnalysis(params) + getOrderCustomerChartAnalysis(angular.merge(params,$scope.params)) } } } @@ -881,184 +890,6 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct }; }; - /*function loadTradeTimeAnalysis(params) { - var timeAnalysis = { - chart: { - tooltip: { - trigger: 'axis' - }, - toolbox: { - show: true, - feature: { - mySeven: { - title: '最近7天', - show: true, - icon: 'path://M3.59-4.07L32.38-4.07L32.38 0.04Q22.25 25.11 17.19 46.34L10.65 46.34Q16.14 26.94 26.19 1.41L3.59 1.41L3.59-4.07Z', - onclick: function () { - loadTradeTimeAnalysis($scope.scales[2].params()); - } - }, - myThirty: { - title: '最近30天', - show: true, - icon: 'path://M12.52 17.02L16.10 17.02Q20.71 17.02 22.43 15.72Q25.66 13.23 25.66 8.23Q25.66-0.63 17.61-0.63Q10.93-0.63 9.42 6.93L3.73 6.93Q4.50 2.19 7.03-0.91Q10.90-5.51 17.61-5.51Q23.24-5.51 26.89-2.28Q31.22 1.52 31.22 8.02Q31.22 16.78 23.38 19.48Q32.84 23.14 32.84 32.81Q32.84 39.00 29.32 42.97Q25.10 47.79 17.72 47.79Q10.79 47.79 6.68 43.04Q3.66 39.56 3.02 33.44L8.93 33.44Q9.67 42.83 17.72 42.83Q21.45 42.83 23.98 40.72Q27.14 38.01 27.14 32.81Q27.14 21.63 16.10 21.63L12.52 21.63L12.52 17.02ZM54-5.51Q67.99-5.51 67.99 21.14Q67.99 47.79 54 47.79Q40.04 47.79 40.04 21.14Q40.04-5.51 54-5.51M46.97 33.65L59.84 4.30Q57.80-0.55 53.93-0.55Q45.95-0.55 45.95 21.14Q45.95 28.52 46.97 33.65M48.16 37.91Q50.13 42.83 54 42.83Q62.09 42.83 62.09 21.07Q62.09 13.86 61.07 8.66L48.16 37.91Z', - onclick: function () { - var params = {}; - var dt = new Date(); - params.end = $filter('date')(dt, 'yyyyMMdd'); - dt.setDate(dt.getDate() - 29); - params.begin = $filter('date')(dt, 'yyyyMMdd'); - loadTradeTimeAnalysis(params) - } - } - } - }, - legend: { - data: ['Total Amount', 'Total Count', 'Retail In-Store Amount', 'Retail In-Store Count', 'Retail API Amount', 'Retail API Count', - 'QR Code Amount', 'QR Code Count', - 'Online API Amount', 'Online API Count', 'WeChat HTML5 Amount', 'WeChat HTML5 Count'], - bottom: 0, - height: '15%', - width: '80%', - left: '10%' - }, - grid: { - top: 10, - bottom: '15%', - containLabel: true - }, - yAxis: [ - { - name: 'Avg Amount(AUD)', - type: 'value' - }, - { - name: 'Avg Count(Records)', - type: 'value' - } - ], - color: colors - }, - xAxis: { - basic: {type: 'category', boundaryGap: false, formatter: '{value}:00'}, - key: 'hour' - }, - series: [ - { - basic: { - name: 'Total Amount', - type: 'line', - symbol: 'triangle', - areaStyle: {normal: {}}, - yAxisIndex: 0 - }, - column: {key: 'total_fee'} - }, - { - basic: { - name: 'Total Count', - type: 'line', - yAxisIndex: 1 - }, - column: {key: 'total_count'} - }, - { - basic: { - name: 'Retail In-Store Amount', - type: 'line', - symbol: 'triangle', - areaStyle: {normal: {}}, - yAxisIndex: 0 - }, - column: {key: 'offline_fee'} - }, - { - basic: { - name: 'Retail In-Store Count', - type: 'line', - yAxisIndex: 1 - }, - column: {key: 'offline_count'} - }, - { - basic: { - name: 'Retail API Amount', - type: 'line', - symbol: 'triangle', - areaStyle: {normal: {}}, - yAxisIndex: 0 - }, - column: {key: 'offline_api_fee'} - }, - { - basic: { - name: 'Retail API Count', - type: 'line', - yAxisIndex: 1 - }, - column: {key: 'offline_api_count'} - }, - { - basic: { - name: 'QR Code Amount', - type: 'line', - symbol: 'triangle', - areaStyle: {normal: {}}, - yAxisIndex: 0 - }, - column: {key: 'client_code_fee'} - }, - { - basic: { - name: 'QR Code Count', - type: 'line', - yAxisIndex: 1 - }, - column: {key: 'client_code_count'} - }, - { - basic: { - name: 'Online API Amount', - type: 'line', - symbol: 'triangle', - areaStyle: {normal: {}}, - yAxisIndex: 0 - }, - column: {key: 'gateway_qrcode_fee'} - }, - { - basic: { - name: 'Online API Count', - type: 'line', - yAxisIndex: 1 - }, - column: {key: 'gateway_qrcode_count'} - }, - { - basic: { - name: 'WeChat HTML5 Amount', - type: 'line', - symbol: 'triangle', - areaStyle: {normal: {}}, - yAxisIndex: 0 - }, - column: {key: 'gateway_jsapi_fee'} - }, - { - basic: { - name: 'WeChat HTML5 Count', - type: 'line', - yAxisIndex: 1 - }, - column: {key: 'gateway_jsapi_count'} - } - ] - }; - $http.get('/dashboard/partner/trade_in_hours', {params: params}).then(function (resp) { - $scope.trade_time = chartParser.parse(timeAnalysis, resp.data); - }) - } - loadTradeTimeAnalysis($scope.scales[4].params());*/ $scope.displayExchangeRateHistory = function () { $uibModal.open({ templateUrl: '/static/dashboard/templates/exchange_rate_history_dialog.html', @@ -1079,29 +910,10 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct controller: 'unSettledAmountHistoryDialogCtrl' }) }; - $scope.loadSettlementLogs = function (page) { - var params = angular.copy($scope.params); - params.page = page || $scope.pagination.page || 1; - params.limit = 10; - $http.get('/dashboard/partner/' + $scope.clientMoniker + '/settlement_logs', {params: params}).then(function (resp) { - $scope.settlementLogs = resp.data.data; - $scope.pagination = resp.data.pagination; - }); - }; - $scope.getClearingTransactions = function (client_id,detail_id) { - $uibModal.open({ - templateUrl: '/static/analysis/templates/settlement_transactions.html', - controller: 'managerClearingDetailCtrl', - resolve: { - detail: ['$http', '$stateParams', function ($http) { - return $http.get('/dashboard/partner/' + client_id+'/settlement_logs/'+detail_id); - }] - }, - size: 'lg' - }); - }; - $scope.loadSettlementLogs(1); + $scope.getClearingTransactions = function (client_id, detailId) { + clearingDetailService.clientClearingDetail(client_id, detailId, true) + }; }]); app.controller('exchangeRateHistoryDialogCtrl', ['$scope', '$http', '$filter', 'chartParser', function ($scope, $http, $filter, chartParser) { diff --git a/src/main/ui/static/dashboard/templates/partner_dashboard.html b/src/main/ui/static/dashboard/templates/partner_dashboard.html index 91da75b2e..0c5fed6ae 100644 --- a/src/main/ui/static/dashboard/templates/partner_dashboard.html +++ b/src/main/ui/static/dashboard/templates/partner_dashboard.html @@ -192,6 +192,20 @@
+
+
+
+ + +
+
+
@@ -255,14 +269,17 @@
    -
  • Exchange Rate
  • +
  • +

    Exchange Rate

    +
  • {{wechat_rate}}
    - Wechat +

    Wechat

    +
  • {{alipay_rate}}
    - Alipay +

    Alipay

@@ -278,16 +295,20 @@

Customers Analysis

-
    -
  • Last a week
  • -
  • {{time_range}}
  • +
      +
    • +

      Last a week

      +
    • +
    • +

      {time_range}}

      +
    • -

      {{avgOrderAndCustomer.old_customers.toFixed(0)||0}}

      -
      AVG OLD CUSTOMER
      +
      {{avgOrderAndCustomer.old_customers.toFixed(0)||0}}
      +

      Avg Old Customers

    • -

      {{avgOrderAndCustomer.new_customers.toFixed(0)||0}}

      -
      AVG NEW CUSTOME
      +
      {{avgOrderAndCustomer.new_customers.toFixed(0)||0}}
      +

      Avg New Customers

    @@ -348,6 +369,9 @@ + + + From dba05af35cf74919ee189cb593b65975543b7646 Mon Sep 17 00:00:00 2001 From: "eason.qian" Date: Tue, 10 Apr 2018 15:23:58 +0800 Subject: [PATCH 08/19] fix --- .../manage/analysis/core/impls/DashboardServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 06aa2ccd1..e2360fb9b 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 @@ -251,7 +251,7 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT res.put("new_customers_rise", yes.getIntValue("new_customers") > 0 ? (today.getIntValue("new_customers")-yes.getIntValue("new_customers"))/yes.getIntValue("new_customers") : 0); params.remove("begin"); params.remove("end"); - PageList logs = transactionMapper.listSettlementLog(params, new PageBounds(1, 1, Order.formString("clearing_time.desc"))); + List logs = transactionMapper.listSettlementLogTotal(params); res.put("latest_settle",logs.isEmpty()?BigDecimal.ZERO:logs.get(0).getBigDecimal("income")); return res; } From 025d24c358e4a766f87053b12b074f53cc7a865f Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Tue, 10 Apr 2018 17:14:08 +0800 Subject: [PATCH 09/19] fix bug --- .../analysis/core/impls/DashboardServiceImpl.java | 2 +- src/main/ui/static/dashboard/partner-dashboard.js | 2 +- .../static/dashboard/templates/partner_dashboard.html | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) 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 e2360fb9b..653ea880a 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 @@ -248,7 +248,7 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT res.put("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, BigDecimal.ROUND_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, BigDecimal.ROUND_HALF_UP) : 0); - res.put("new_customers_rise", yes.getIntValue("new_customers") > 0 ? (today.getIntValue("new_customers")-yes.getIntValue("new_customers"))/yes.getIntValue("new_customers") : 0); + res.put("new_customers_rise", yes.getIntValue("new_customers") > 0 ? (today.getBigDecimal("new_customers").subtract(yes.getBigDecimal("new_customers"))).divide(yes.getBigDecimal("new_customers"), 4, BigDecimal.ROUND_HALF_UP) : 0); params.remove("begin"); params.remove("end"); List logs = transactionMapper.listSettlementLogTotal(params); diff --git a/src/main/ui/static/dashboard/partner-dashboard.js b/src/main/ui/static/dashboard/partner-dashboard.js index ddd6a1ff4..c2a26c267 100644 --- a/src/main/ui/static/dashboard/partner-dashboard.js +++ b/src/main/ui/static/dashboard/partner-dashboard.js @@ -1096,7 +1096,7 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct }]); app.filter('abs', function () { return function (value) { - return Math.abs(value*100); + return Math.abs(value); } }); return app; diff --git a/src/main/ui/static/dashboard/templates/partner_dashboard.html b/src/main/ui/static/dashboard/templates/partner_dashboard.html index 8eb863b0a..384c5545b 100644 --- a/src/main/ui/static/dashboard/templates/partner_dashboard.html +++ b/src/main/ui/static/dashboard/templates/partner_dashboard.html @@ -216,7 +216,7 @@

    Yesterday: {{transcommon.yes.trade_amount|currency:'AUD'}} - {{transcommon.trade_amount_rise|abs}}%

    + {{transcommon.trade_amount_rise|abs|percentage:2}}

@@ -229,7 +229,7 @@

Yesterday: {{transcommon.yes.trade_count}} - {{transcommon.trade_count_rise|abs}}%

+ {{transcommon.trade_count_rise|abs|percentage:2}}

@@ -242,7 +242,7 @@

Yesterday: {{transcommon.yes.new_customers}} - {{transcommon.new_customers_rise|abs}}%

+ {{transcommon.new_customers_rise|abs|percentage:2}}

@@ -274,12 +274,12 @@
  • {{wechat_rate}}
    -

    Wechat

    +

    Wechat

  • {{alipay_rate}}
    -

    Alipay

    +

    Alipay

  • From 0a1feb96718c0790a1242cdd48317c331d78054b Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Wed, 11 Apr 2018 18:51:32 +0800 Subject: [PATCH 10/19] =?UTF-8?q?=E4=BF=AE=E6=94=B9html?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/ui/index.html | 731 +++- .../ui/static/css/new_partner_dashboard.css | 32 +- src/main/ui/static/css/style.css | 3051 +++++++++++++++++ .../templates/partner_dashboard.html | 43 +- 4 files changed, 3752 insertions(+), 105 deletions(-) create mode 100644 src/main/ui/static/css/style.css diff --git a/src/main/ui/index.html b/src/main/ui/index.html index bd72a8ba5..f0f665890 100644 --- a/src/main/ui/index.html +++ b/src/main/ui/index.html @@ -1,4 +1,4 @@ - + + <!– Tell the browser to be responsive to screen width –> - + <!– Bootstrap 3.3.5 –> - - + <!– Font Awesome –> + <!––> - + <!– Ionicons –> - + <!– Theme style –> - + <!– AdminLTE Skins. Choose a skin from the css/skins + folder instead of downloading all of them to reduce the load. –> + ( 1300-10-77-50 | + support@royalpay.com.au | + WeChat ) + + + +
    +<!– ./wrapper –> + +--> + + + + + + RoyalPay + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + royalpay +

    Easy Business,Easy Pay

    +
    +
    +
    + +
    +
    + + + + + +
    + + + + +
    + + + -
    +
    -