From cbcffe9a97d84f920439ec84aac7772eca0c5572 Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Wed, 17 Jan 2018 18:03:57 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BA=A4=E6=98=93=E6=B5=81=E6=B0=B4?= =?UTF-8?q?=EF=BC=8C=E5=90=88=E4=BC=99=E4=BA=BA=EF=BC=8C=E7=9B=91=E6=8E=A7?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E7=BB=84=E7=BB=87=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/ClientRatesAnalysisService.java | 2 +- .../analysis/core/OrgAnalysisService.java | 2 +- .../impls/ClientRatesAnalysisServiceImpl.java | 15 ++- .../core/impls/OrgAnalysisServiceImp.java | 10 +- .../analysis/web/ClientRatesController.java | 5 +- .../web/OrgSaleAnalysisController.java | 2 +- .../manage/organizations/core/OrgManager.java | 2 + .../core/impls/OrgManagerImpl.java | 37 ++++++ .../manage/tradelog/beans/TradeLogQuery.java | 13 ++ .../core/impls/TradeLogServiceImpl.java | 4 +- .../mappers/TransactionAnalysisMapper.xml | 3 + .../manage/mappers/payment/OrderMapper.xml | 2 - src/main/ui/manage.html | 2 +- src/main/ui/static/analysis/client_rates.js | 18 ++- .../analysis/org-tranaction-analysis.js | 36 +++++- .../analysis/org/templates/analysis_org.html | 4 +- .../analysis/templates/client_rates.html | 12 +- .../analysis/templates/org_sale_analysis.html | 47 ++++++- .../organizations/templates/new_org.html | 119 ++++++++++-------- .../organizations/templates/org_detail.html | 39 +++--- .../templates/org_detail_parent.html | 39 +++--- .../tradelog/templates/trade_logs.html | 36 +++++- .../payment/tradelog/tradelog-manage.js | 15 ++- 23 files changed, 343 insertions(+), 121 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/ClientRatesAnalysisService.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/ClientRatesAnalysisService.java index 02ead9905..7b5343f6e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/ClientRatesAnalysisService.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/ClientRatesAnalysisService.java @@ -8,7 +8,7 @@ import java.util.Date; * Created by yixian on 2016-11-08. */ public interface ClientRatesAnalysisService { - JSONObject listAnalysisOfBDUsers(JSONObject manager, Integer orgId, Date beginDate, Date endDate); + JSONObject listAnalysisOfBDUsers(JSONObject manager, String orgId,String orgIds, Date beginDate, Date endDate); JSONObject listAllClientRates(Integer orgId, ClientRateQueryBean query); diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/OrgAnalysisService.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/OrgAnalysisService.java index e2b453fbc..4e8faebf2 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/OrgAnalysisService.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/OrgAnalysisService.java @@ -8,7 +8,7 @@ import java.util.List; * Created by yishuqian on 27/02/2017. */ public interface OrgAnalysisService { - List getSalesAnalysis(JSONObject params); + List getSalesAnalysis(JSONObject params,JSONObject manager); List getPartnersSaleByOrgId(JSONObject params); } diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/ClientRatesAnalysisServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/ClientRatesAnalysisServiceImpl.java index cb87bae94..3d77137d3 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/ClientRatesAnalysisServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/ClientRatesAnalysisServiceImpl.java @@ -6,11 +6,13 @@ import au.com.royalpay.payment.manage.analysis.mappers.ClientRatesAnalysisMapper import au.com.royalpay.payment.manage.mappers.log.ClientReviewLogMapper; import au.com.royalpay.payment.manage.mappers.system.ManagerMapper; import au.com.royalpay.payment.manage.merchants.core.ClientManager; +import au.com.royalpay.payment.manage.organizations.core.OrgManager; import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import com.alibaba.fastjson.JSONObject; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -40,20 +42,25 @@ public class ClientRatesAnalysisServiceImpl implements ClientRatesAnalysisServic @Autowired(required = false) private ClientRateAnalysisEventLoader[] eventLoaders; + @Resource + private OrgManager orgManager; + @Override - public JSONObject listAnalysisOfBDUsers(JSONObject manager, Integer orgId, Date beginDate, Date endDate) { - if (manager.getIntValue("org_id") > 0) { - orgId = manager.getInteger("org_id"); - } + public JSONObject listAnalysisOfBDUsers(JSONObject manager, String orgId, String orgIds,Date beginDate, Date endDate) { JSONObject params = new JSONObject(); if (orgId != null) { params.put("org_id", orgId); } + if (StringUtils.isNotEmpty(orgIds)) { + params.put("org_ids", orgIds); + } + if (ManagerRole.BD_LEADER.hasRole(manager.getIntValue("role"))) { params.put("bd_group", manager.getString("manager_id")); } params.put("begin", beginDate); params.put("end", endDate); + orgManager.checkOrgIds(manager,params); JSONObject result = new JSONObject(); List bdAnalysis = clientRatesAnalysisMapper.analysisRatesForBDUsers(params); result.put("bds", bdAnalysis); diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/OrgAnalysisServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/OrgAnalysisServiceImp.java index ecc4dcf02..66510785d 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/OrgAnalysisServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/OrgAnalysisServiceImp.java @@ -2,6 +2,7 @@ package au.com.royalpay.payment.manage.analysis.core.impls; import au.com.royalpay.payment.manage.analysis.core.OrgAnalysisService; import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper; +import au.com.royalpay.payment.manage.organizations.core.OrgManager; import com.alibaba.fastjson.JSONObject; import org.springframework.stereotype.Service; @@ -16,9 +17,14 @@ public class OrgAnalysisServiceImp implements OrgAnalysisService { @Resource private TransactionAnalysisMapper transactionAnalysisMapper; + @Resource + private OrgManager orgManager; + @Override - public List getSalesAnalysis(JSONObject params) { - return transactionAnalysisMapper.getOrgTransactionAnalysis(params); + public List getSalesAnalysis(JSONObject params,JSONObject manager) { + orgManager.checkOrgIds(manager,params); + List OrgTransaction = transactionAnalysisMapper.getOrgTransactionAnalysis(params); + return OrgTransaction; } @Override diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/web/ClientRatesController.java b/src/main/java/au/com/royalpay/payment/manage/analysis/web/ClientRatesController.java index 12c15b9d2..8178181c8 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/web/ClientRatesController.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/web/ClientRatesController.java @@ -34,7 +34,8 @@ public class ClientRatesController { @RequestMapping("/bd_users") public JSONObject listAnalysisOfBDUsers(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, - @RequestParam(name = "org_id", required = false) Integer orgId, + @RequestParam(name = "org_id", required = false) String orgId, + @RequestParam(name = "org_ids", required = false) String orgIds, @RequestParam String begin, @RequestParam String end) { Date beginDate; try { @@ -48,7 +49,7 @@ public class ClientRatesController { } catch (ParseException e) { throw new ParamInvalidException("end", "error.payment.valid.invalid_date_format"); } - return clientRatesAnalysisService.listAnalysisOfBDUsers(manager, orgId, beginDate, endDate); + return clientRatesAnalysisService.listAnalysisOfBDUsers(manager,orgId, orgIds, beginDate, endDate); } @RequestMapping("/orgs/all") diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/web/OrgSaleAnalysisController.java b/src/main/java/au/com/royalpay/payment/manage/analysis/web/OrgSaleAnalysisController.java index 4b333a878..17ef61598 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/web/OrgSaleAnalysisController.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/web/OrgSaleAnalysisController.java @@ -23,7 +23,7 @@ public class OrgSaleAnalysisController { @ManagerMapping(value = "/sales",role = {ManagerRole.DIRECTOR,ManagerRole.OPERATOR,ManagerRole.ADMIN,ManagerRole.FINANCIAL_STAFF}) public List getSalesAnalysis(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { JSONObject params = analysis.toParams(null); - return orgAnalysisService.getSalesAnalysis(params); + return orgAnalysisService.getSalesAnalysis(params,manager); } @ManagerMapping(value = "/{org_id}/partners",role = {ManagerRole.DIRECTOR,ManagerRole.OPERATOR,ManagerRole.ADMIN,ManagerRole.FINANCIAL_STAFF}) diff --git a/src/main/java/au/com/royalpay/payment/manage/organizations/core/OrgManager.java b/src/main/java/au/com/royalpay/payment/manage/organizations/core/OrgManager.java index d3f35d221..d1f3778ca 100644 --- a/src/main/java/au/com/royalpay/payment/manage/organizations/core/OrgManager.java +++ b/src/main/java/au/com/royalpay/payment/manage/organizations/core/OrgManager.java @@ -28,4 +28,6 @@ public interface OrgManager { List listAllOrg(); JSONObject checkOrg(JSONObject manager, JSONObject params); + + JSONObject checkOrgIds(JSONObject manager, JSONObject params); } diff --git a/src/main/java/au/com/royalpay/payment/manage/organizations/core/impls/OrgManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/organizations/core/impls/OrgManagerImpl.java index 48a024f35..d68b1a2f2 100644 --- a/src/main/java/au/com/royalpay/payment/manage/organizations/core/impls/OrgManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/organizations/core/impls/OrgManagerImpl.java @@ -149,4 +149,41 @@ public class OrgManagerImpl implements OrgManager { return params; } + @Override + public JSONObject checkOrgIds(JSONObject manager, JSONObject params) { + if(params.getString("org_id") != null){ + if(params.getString("org_ids") == null){ + orgIds(params,manager); + }else { + params.put("org_id",params.getString("org_ids")); + params.remove("org_ids"); + } + }else { + if(params.getString("org_ids") == null){ + if(manager.getIntValue("org_id") > 0){ + List orgs = orgMapper.listOrgAndChild(manager.getIntValue("org_id")); + if (orgs.size()>1){ + List orgIds = orgs.stream().map(org->org.getIntValue("org_id")).collect(Collectors.toList()); + params.put("org_ids",orgIds); + }else { + params.put("org_id",manager.getIntValue("org_id")); + } + } + }else { + params.put("org_id",params.getString("org_ids")); + params.remove("org_ids"); + } + } + return params; + } + private void orgIds(JSONObject params,JSONObject manager){ + List orgs = orgMapper.listOrgAndChild(Integer.parseInt(params.getString("org_id"))); + if (orgs.size()>1){ + List orgIds = orgs.stream().map(org->org.getIntValue("org_id")).collect(Collectors.toList()); + params.put("org_ids",orgIds); + params.remove("org_id"); + }else { + params.put("org_id",params.getString("org_id")); + } + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/tradelog/beans/TradeLogQuery.java b/src/main/java/au/com/royalpay/payment/manage/tradelog/beans/TradeLogQuery.java index d21fded04..f3c271886 100644 --- a/src/main/java/au/com/royalpay/payment/manage/tradelog/beans/TradeLogQuery.java +++ b/src/main/java/au/com/royalpay/payment/manage/tradelog/beans/TradeLogQuery.java @@ -37,6 +37,7 @@ public class TradeLogQuery { private boolean onlyGroup = false; private int group_bd; private String org_id; + private String org_ids; public JSONObject toParams(String timezone) { JSONObject params = new JSONObject(); @@ -95,6 +96,10 @@ public class TradeLogQuery { if (org_id != null && org_id != "ALL") { params.put("org_id", org_id); } + + if (StringUtils.isNotEmpty(org_ids)) { + params.put("org_ids", org_ids); + } return params; } @@ -226,4 +231,12 @@ public class TradeLogQuery { public void setOrg_id(String org_id) { this.org_id = org_id; } + + public String getOrg_ids() { + return org_ids; + } + + public void setOrg_ids(String org_ids) { + this.org_ids = org_ids; + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java index 4f2ab89ab..00df0f5a2 100644 --- a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java @@ -170,7 +170,7 @@ public class TradeLogServiceImpl implements TradeLogService { @Override public JSONObject listAllTradeLogs(TradeLogQuery query, JSONObject manager) { JSONObject params = query.toParams(null); - if (ManagerRole.BD_USER.hasRole(manager.getIntValue("role"))) { + if (ManagerRole.BD_USER.hasRole(manager.getIntValue("role"))&& !ManagerRole.ORG_MANAGER.hasRole(manager.getIntValue("role"))) { params.put("bd_user", manager.getString("manager_id")); } if (query.isOnlyGroup() && ManagerRole.BD_LEADER.hasRole(manager.getIntValue("role"))) { @@ -180,7 +180,7 @@ public class TradeLogServiceImpl implements TradeLogService { params.put("bd_group_bd", query.getGroup_bd()); } } - orgManager.checkOrg(manager,params); + orgManager.checkOrgIds(manager,params); PageList logs = orderMapper.listOrders(params, new PageBounds(query.getPage(), query.getLimit(), Order.formString("create_time.desc"))); JSONObject result = PageListUtils.buildPageListResult(logs); JSONObject analysis = orderMapper.analysisOrders(params); 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 078381401..9f9ec40fb 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 @@ -651,6 +651,9 @@ ]]> and t.transaction_time >= #{begin} and t.transaction_time <= #{end} + and o.org_id=#{org_id} + and o.org_id in + #{org_id} GROUP BY o.org_id order by amount desc + + + +
+
@@ -47,7 +53,7 @@ + @@ -80,8 +124,9 @@
+
交易分布
-
+
diff --git a/src/main/ui/static/config/organizations/templates/new_org.html b/src/main/ui/static/config/organizations/templates/new_org.html index 6b54fde0c..85d6bfad2 100644 --- a/src/main/ui/static/config/organizations/templates/new_org.html +++ b/src/main/ui/static/config/organizations/templates/new_org.html @@ -10,30 +10,6 @@
- - - - - - - - - - - - - - - - - - - - - - - -
@@ -95,8 +71,11 @@ ng-class="{'has-error':org_form.rate_value.$invalid && org_form.rate_value.$dirty}">
- +
+ + % +
@@ -106,8 +85,11 @@ ng-class="{'has-error':org_form.rate_value.$invalid && org_form.rate_value.$dirty}">
- +
+ + % +
@@ -116,8 +98,11 @@ ng-class="{'has-error':org_form.alipay_rate_value.$invalid && org_form.alipay_rate_value.$dirty}">
- +
+ + % +
@@ -125,8 +110,11 @@ ng-class="{'has-error':org_form.wechat_rate_value.$invalid && org_form.wechat_rate_value.$dirty}">
- +
+ + % +
@@ -134,8 +122,12 @@ ng-class="{'has-error':org_form.bestpay_rate_value.$invalid && org_form.bestpay_rate_value.$dirty}">
- +
+ + % +
@@ -143,8 +135,11 @@ ng-class="{'has-error':org_form.jd_rate_value.$invalid && org_form.jd_rate_value.$dirty}">
- +
+ + % +
@@ -152,28 +147,37 @@ ng-class="{'has-error':org_form.alipayonline_rate_value.$invalid && org_form.alipayonline_rate_value.$dirty}">
- +
+ + % +
+
+
- +
+ + % +
-
- -
+
+ id="min_alipay_rate_input" name="min_alipay_rate" max="100" min="0" required> + % +
@@ -181,8 +185,13 @@ ng-class="{'has-error':org_form.min_bestpay_rate.$invalid && org_form.min_bestpay_rate.$dirty}">
- +
+ + % +
@@ -190,8 +199,11 @@ ng-class="{'has-error':org_form.min_jd_rate.$invalid && org_form.min_jd_rate.$dirty}">
- +
+ + % +
@@ -199,14 +211,16 @@ ng-class="{'has-error':org_form.min_alipayonline_rate.$invalid && org_form.min_alipayonline_rate.$dirty}">
- +
+ + % +
- -
@@ -239,7 +253,6 @@ id="remark-input" maxlength="1000">
-
diff --git a/src/main/ui/static/config/organizations/templates/org_detail.html b/src/main/ui/static/config/organizations/templates/org_detail.html index 740de3528..410f0b0f6 100644 --- a/src/main/ui/static/config/organizations/templates/org_detail.html +++ b/src/main/ui/static/config/organizations/templates/org_detail.html @@ -79,7 +79,7 @@
- + %
@@ -89,7 +89,7 @@
- + %
@@ -98,7 +98,7 @@
- + %
@@ -106,7 +106,7 @@
- + %
@@ -114,7 +114,7 @@
- + %
@@ -122,7 +122,7 @@
- + %
@@ -130,7 +130,7 @@
- + %
@@ -142,16 +142,18 @@ ng-class="{'has-error':org_form.min_wechat_rate.$invalid && org_form.min_wechat_rate.$dirty}">
- + + %
- + + %
@@ -159,8 +161,9 @@ ng-class="{'has-error':org_form.min_bestpay_rate.$invalid && org_form.min_bestpay_rate.$dirty}">
- + + %
@@ -168,8 +171,9 @@ ng-class="{'has-error':org_form.min_jd_rate.$invalid && org_form.min_jd_rate.$dirty}">
- + + %
@@ -177,8 +181,9 @@ ng-class="{'has-error':org_form.min_alipayonline_rate.$invalid && org_form.min_alipayonline_rate.$dirty}">
- + + %
diff --git a/src/main/ui/static/config/organizations/templates/org_detail_parent.html b/src/main/ui/static/config/organizations/templates/org_detail_parent.html index 3f4b23d70..d979c6b2c 100644 --- a/src/main/ui/static/config/organizations/templates/org_detail_parent.html +++ b/src/main/ui/static/config/organizations/templates/org_detail_parent.html @@ -216,7 +216,7 @@
- + %
@@ -226,7 +226,7 @@
- + %
@@ -235,7 +235,7 @@
- + %
@@ -243,7 +243,7 @@
- + %
@@ -251,7 +251,7 @@
- + %
@@ -259,7 +259,7 @@
- + %
@@ -267,7 +267,7 @@
- + %
@@ -278,16 +278,18 @@ ng-class="{'has-error':org_form.min_wechat_rate.$invalid && org_form.min_wechat_rate.$dirty}">
- + + %
- + + %
@@ -295,8 +297,9 @@ ng-class="{'has-error':org_form.min_bestpay_rate.$invalid && org_form.min_bestpay_rate.$dirty}">
- + + %
@@ -304,8 +307,9 @@ ng-class="{'has-error':org_form.min_jd_rate.$invalid && org_form.min_jd_rate.$dirty}">
- + + %
@@ -313,8 +317,9 @@ ng-class="{'has-error':org_form.min_alipayonline_rate.$invalid && org_form.min_alipayonline_rate.$dirty}">
- + + %
diff --git a/src/main/ui/static/payment/tradelog/templates/trade_logs.html b/src/main/ui/static/payment/tradelog/templates/trade_logs.html index b5b7cc556..43706c7fa 100644 --- a/src/main/ui/static/payment/tradelog/templates/trade_logs.html +++ b/src/main/ui/static/payment/tradelog/templates/trade_logs.html @@ -56,7 +56,39 @@ -
+ +
+
+ +
+ +
+ +
+ + +
+ +
diff --git a/src/main/ui/static/payment/tradelog/tradelog-manage.js b/src/main/ui/static/payment/tradelog/tradelog-manage.js index 7bac63aa5..79d07f627 100644 --- a/src/main/ui/static/payment/tradelog/tradelog-manage.js +++ b/src/main/ui/static/payment/tradelog/tradelog-manage.js @@ -76,13 +76,22 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) { $scope.params.datefrom = monthBegin; $scope.loadTradeLogs(1); }; + if (($scope.currentUser.role & parseInt('1000011', 2)) > 0 && !$scope.currentUser.org_id) { + /* $scope.showOrg = 'Organization';*/ + $http.get('/sys/orgs', {params: {}}).then(function (resp) { + $scope.orgs = resp.data; + }); + } $scope.loadOrgs = function () { - $http.get('/sys/orgs/orgChild').then(function (resp) { - $scope.orgs = resp.data; + var params = angular.copy($scope.params); + $http.get('/sys/orgs/orgChild',{params: params}).then(function (resp) { + $scope.orgs_child = resp.data; }) }; - $scope.loadOrgs(); + if(($scope.currentUser.role & parseInt('1000000000000', 2)) > 0 && ($scope.currentUser.org_id != null)){ + $scope.loadOrgs(); + } $scope.loadTradeLogs = function (page) { var params = angular.copy($scope.params); From 5e5882a857d63ee3dce54f3ab2c556cd5770463d Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Wed, 17 Jan 2018 18:09:32 +0800 Subject: [PATCH 2/5] fix~ --- src/main/ui/static/analysis/templates/client_rates.html | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/ui/static/analysis/templates/client_rates.html b/src/main/ui/static/analysis/templates/client_rates.html index c3755c9e4..ae630ab1c 100644 --- a/src/main/ui/static/analysis/templates/client_rates.html +++ b/src/main/ui/static/analysis/templates/client_rates.html @@ -19,7 +19,6 @@
-