From 24191f31db13a485071cc7f37e3406f95e13eda4 Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Mon, 30 Jul 2018 14:02:19 +0800 Subject: [PATCH 1/7] fix html --- .../core/PartnersAnalysisService.java | 2 + .../impls/PartnersAnalysisServiceImpl.java | 7 +++- .../mappers/ClientAnalysisMapper.java | 2 + .../web/PartnersAnalysisController.java | 15 ++++++++ .../analysis/mappers/ClientAnalysisMapper.xml | 32 ++++++++++++++++ .../ui/static/analysis/partners-analysis.js | 37 +++++++++++++++++++ .../analysis/templates/partners_analysis.html | 35 +++++++++++++++++- 7 files changed, 128 insertions(+), 2 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/PartnersAnalysisService.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/PartnersAnalysisService.java index 1c2487e81..758a615ad 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/PartnersAnalysisService.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/PartnersAnalysisService.java @@ -13,4 +13,6 @@ public interface PartnersAnalysisService { List getTradePartnersAnalysis(JSONObject params); List getPartnersTypesAnalysis(JSONObject params); + + List getPartnersSettlementAnalysis(JSONObject params); } diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PartnersAnalysisServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PartnersAnalysisServiceImpl.java index 5d5ab581a..eef793d33 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PartnersAnalysisServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PartnersAnalysisServiceImpl.java @@ -47,7 +47,12 @@ public class PartnersAnalysisServiceImpl implements PartnersAnalysisService { return getPartnerTypes(key_2,result,2,6,types); } - private List getPartnerTypes(String keys[],List result,int short_length,int long_length,List types){ + @Override + public List getPartnersSettlementAnalysis(JSONObject params) { + return clientAnalysisMapper.countClientsSettlementCycle(params); + } + + private List getPartnerTypes(String keys[], List result, int short_length, int long_length, List types){ for(String key : keys){ int countValue = 0; JSONObject object = new JSONObject(); diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.java b/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.java index a84810107..e74edaa7b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.java @@ -35,4 +35,6 @@ public interface ClientAnalysisMapper { List countClientsTypes(JSONObject params); List notTradeSubMerchantId(); + + List countClientsSettlementCycle(JSONObject params); } diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/web/PartnersAnalysisController.java b/src/main/java/au/com/royalpay/payment/manage/analysis/web/PartnersAnalysisController.java index 12c832edd..74608a157 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/web/PartnersAnalysisController.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/web/PartnersAnalysisController.java @@ -66,4 +66,19 @@ public class PartnersAnalysisController { } return partnersAnalysisService.getPartnersTypesAnalysis(params); } + + @ManagerMapping("/settlement") + public List getPartnersSettlementAnalysis(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + JSONObject params = analysis.toParams(null); + if (manager.getInteger("org_id") != null) { + params.put("org_id", manager.getIntValue("org_id")); + } + if (analysis.isOnlyGroup() && ManagerRole.BD_LEADER.hasRole(manager.getIntValue("role"))) { + params.put("bd_group", manager.getString("manager_id")); + if (analysis.getGroup_bd()>0){ + params.put("bd_group_bd",analysis.getGroup_bd()); + } + } + return partnersAnalysisService.getPartnersSettlementAnalysis(params); + } } diff --git a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.xml index 007950b60..0713994d9 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.xml @@ -148,4 +148,36 @@ GROUP by c.sub_merchant_id + \ No newline at end of file diff --git a/src/main/ui/static/analysis/partners-analysis.js b/src/main/ui/static/analysis/partners-analysis.js index 5661ebc37..517098b21 100644 --- a/src/main/ui/static/analysis/partners-analysis.js +++ b/src/main/ui/static/analysis/partners-analysis.js @@ -176,6 +176,43 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts','./transaction/an series: series } }; + $scope.loadTradePartnersBySettlementCycle = function () { + var partnersBySettlementCycle = { + chart: { + tooltip: { + trigger: 'item', + formatter :"{a} {b} : {c} ({d}%)" + }, + color: colors + }, + series: [{ + basic: { + name: '周期', type: 'pie', + radius: '60%', + center: ['50%', '40%'], + itemStyle: { + emphasis: { + shadowBlur: 10, + shadowOffsetX: 0, + shadowColor: 'rgba(0, 0, 0, 0.5)' + }, + normal : { + label : { + position : 'outer', + formatter :"{a} {b} : {c} ({d}%)" + } + } + } + }, + column: {key: 'client_count', name: 'settlement_cycle'} + }] + }; + $http.get('/analysis/partners/settlement', {params:{}}).then(function (resp) { + $scope.settlementCycle = resp.data; + $scope.partners_settlement_chart = chartParser.parse(partnersBySettlementCycle, resp.data); + }); + }; + $scope.loadTradePartnersBySettlementCycle(); /*var partnerTypesConfig = function (legend) { return { chart: { diff --git a/src/main/ui/static/analysis/templates/partners_analysis.html b/src/main/ui/static/analysis/templates/partners_analysis.html index 47c786dfb..60adf7334 100644 --- a/src/main/ui/static/analysis/templates/partners_analysis.html +++ b/src/main/ui/static/analysis/templates/partners_analysis.html @@ -59,7 +59,13 @@
-
+
+
+ + +
+
+

各类型商家数量分布

@@ -92,6 +98,33 @@
+
+
+
+

商户结算周期分布

+
+
+
+

结算周期列表

+ + + + + + + + + + + + + +
Clean DaysPartners
+
+
+
From f114f89dd2d99a4dbfee2063ee73e8f44b02a714 Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Mon, 30 Jul 2018 16:49:30 +0800 Subject: [PATCH 2/7] fix html --- .../manage/analysis/beans/AnalysisBean.java | 9 +++ .../web/PartnersAnalysisController.java | 3 + .../analysis/mappers/ClientAnalysisMapper.xml | 12 ++-- .../ui/static/analysis/partners-analysis.js | 69 ++++++++++--------- .../analysis/templates/partners_analysis.html | 15 ++-- 5 files changed, 65 insertions(+), 43 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/beans/AnalysisBean.java b/src/main/java/au/com/royalpay/payment/manage/analysis/beans/AnalysisBean.java index 5b92ba4af..a6934c5d3 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/beans/AnalysisBean.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/beans/AnalysisBean.java @@ -36,6 +36,7 @@ public class AnalysisBean { private String amount_from; private String amount_to; private String bd_name; + private boolean recent_client = false; public JSONObject toParams(String timezone) { JSONObject params = new JSONObject(); if (timezone != null) { @@ -94,6 +95,14 @@ public class AnalysisBean { return params; } + public boolean isRecent_client() { + return recent_client; + } + + public void setRecent_client(boolean recent_client) { + this.recent_client = recent_client; + } + public String getBegin() { return begin; } diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/web/PartnersAnalysisController.java b/src/main/java/au/com/royalpay/payment/manage/analysis/web/PartnersAnalysisController.java index 74608a157..52c98e681 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/web/PartnersAnalysisController.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/web/PartnersAnalysisController.java @@ -79,6 +79,9 @@ public class PartnersAnalysisController { params.put("bd_group_bd",analysis.getGroup_bd()); } } + if (analysis.isRecent_client()){ + params.put("recent_client",true); + } return partnersAnalysisService.getPartnersSettlementAnalysis(params); } } diff --git a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.xml index 0713994d9..f626edc57 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.xml @@ -157,14 +157,13 @@ THEN 'T+2' WHEN 3 THEN 'T+3' - END AS settlement_cycle + END AS clean_days FROM sys_clients c - c.client_id IS not null AND c.merchant_id IS NOT NULL - AND (c.approve_result = 1 OR c.approve_result= 2) AND c.is_valid = 1 + c.client_id IS not null AND (c.approve_result = 1 OR c.approve_result= 2) AND c.is_valid = 1 and org_id=#{org_id} and org_id in - #{org_id} + #{org_id} and c.client_id in (SELECT b.client_id FROM sys_client_bd b INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id @@ -173,9 +172,8 @@ and c.manager_id=#{bd_group_bd}) - c.client_id in - (SELECT p.client_id FROM sys_clients p INNER JOIN statistics_customer_order o ON o.client_id = p.client_id AND o.client_id !=0 - WHERE datediff(now(), o.date) 30 AND p.client_id is not null GROUP BY p.client_id) + AND c.client_id in (SELECT p.client_id FROM sys_clients p INNER JOIN statistics_customer_order o ON o.client_id = p.client_id AND o.client_id !=0 + WHERE datediff(now(), o.date) 230 AND p.client_id is not null GROUP BY p.client_id) GROUP by c.clean_days diff --git a/src/main/ui/static/analysis/partners-analysis.js b/src/main/ui/static/analysis/partners-analysis.js index 517098b21..b63e17fef 100644 --- a/src/main/ui/static/analysis/partners-analysis.js +++ b/src/main/ui/static/analysis/partners-analysis.js @@ -23,6 +23,7 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts','./transaction/an if (!$scope.params.onlyGroup){ $scope.loadPartnersInTypes(); $scope.doAnalysis(); + $scope.loadTradePartnersBySettlementCycle(); return; } if (groupBD == 'all') { @@ -36,6 +37,7 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts','./transaction/an } $scope.loadPartnersInTypes(); $scope.doAnalysis(); + $scope.loadTradePartnersBySettlementCycle(); }; $scope.loadRoyalpayindustry = function () { $http.get('/static/data/royalpayindustry.json').then(function (resp) { @@ -177,42 +179,47 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts','./transaction/an } }; $scope.loadTradePartnersBySettlementCycle = function () { - var partnersBySettlementCycle = { - chart: { - tooltip: { - trigger: 'item', - formatter :"{a} {b} : {c} ({d}%)" - }, - color: colors - }, - series: [{ - basic: { - name: '周期', type: 'pie', - radius: '60%', - center: ['50%', '40%'], - itemStyle: { - emphasis: { - shadowBlur: 10, - shadowOffsetX: 0, - shadowColor: 'rgba(0, 0, 0, 0.5)' - }, - normal : { - label : { - position : 'outer', - formatter :"{a} {b} : {c} ({d}%)" - } - } - } - }, - column: {key: 'client_count', name: 'settlement_cycle'} - }] - }; - $http.get('/analysis/partners/settlement', {params:{}}).then(function (resp) { + var params = angular.copy($scope.params); + $http.get('/analysis/partners/settlement', {params:params}).then(function (resp) { $scope.settlementCycle = resp.data; $scope.partners_settlement_chart = chartParser.parse(partnersBySettlementCycle, resp.data); }); }; $scope.loadTradePartnersBySettlementCycle(); + $scope.chooseThirtyDays = function () { + $scope.params.recent_client = true; + $scope.loadTradePartnersBySettlementCycle(); + }; + var partnersBySettlementCycle = { + chart: { + tooltip: { + trigger: 'item', + formatter :"{a} {b} : {c} ({d}%)" + }, + color: colors + }, + series: [{ + basic: { + name: '周期', type: 'pie', + radius: '60%', + center: ['50%', '40%'], + itemStyle: { + emphasis: { + shadowBlur: 10, + shadowOffsetX: 0, + shadowColor: 'rgba(0, 0, 0, 0.5)' + }, + normal : { + label : { + position : 'outer', + formatter :"{a} {b} : {c} ({d}%)" + } + } + } + }, + column: {key: 'client_count', name: 'clean_days'} + }] + }; /*var partnerTypesConfig = function (legend) { return { chart: { diff --git a/src/main/ui/static/analysis/templates/partners_analysis.html b/src/main/ui/static/analysis/templates/partners_analysis.html index 60adf7334..bc93ec323 100644 --- a/src/main/ui/static/analysis/templates/partners_analysis.html +++ b/src/main/ui/static/analysis/templates/partners_analysis.html @@ -61,8 +61,8 @@
- - + +
@@ -101,8 +101,13 @@
-

商户结算周期分布

-
商户结算周期分布 + + + + +

+
@@ -117,7 +122,7 @@ - + From 968ce024e7b9ac2e4cf474635c3126ff9fc9345c Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Tue, 31 Jul 2018 18:11:01 +0800 Subject: [PATCH 3/7] fix html --- .../manage/analysis/beans/AnalysisBean.java | 9 ------ .../web/PartnersAnalysisController.java | 3 -- .../manage/mappers/system/ClientMapper.java | 3 ++ .../manage/merchants/core/ClientManager.java | 3 ++ .../core/impls/ClientManagerImpl.java | 29 +++++++++++++++++++ .../web/PartnerManageController.java | 5 ++++ .../analysis/mappers/ClientAnalysisMapper.xml | 15 +++++++--- .../ui/static/analysis/partners-analysis.js | 29 +++++++++++++++++-- .../analysis/templates/partners_analysis.html | 19 +++++++----- .../static/payment/partner/partner-manage.js | 27 +++++++++++++++++ .../partner/templates/add_partner.html | 2 +- .../templates/add_sub_partner_dialog.html | 2 +- .../templates/client_sub_merchant_id_log.html | 2 ++ .../partner/templates/partner_detail.html | 2 +- .../partner/templates/partner_edit.html | 2 +- .../templates/partner_payment_info.html | 10 +++++++ 16 files changed, 131 insertions(+), 31 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/beans/AnalysisBean.java b/src/main/java/au/com/royalpay/payment/manage/analysis/beans/AnalysisBean.java index a6934c5d3..5b92ba4af 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/beans/AnalysisBean.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/beans/AnalysisBean.java @@ -36,7 +36,6 @@ public class AnalysisBean { private String amount_from; private String amount_to; private String bd_name; - private boolean recent_client = false; public JSONObject toParams(String timezone) { JSONObject params = new JSONObject(); if (timezone != null) { @@ -95,14 +94,6 @@ public class AnalysisBean { return params; } - public boolean isRecent_client() { - return recent_client; - } - - public void setRecent_client(boolean recent_client) { - this.recent_client = recent_client; - } - public String getBegin() { return begin; } diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/web/PartnersAnalysisController.java b/src/main/java/au/com/royalpay/payment/manage/analysis/web/PartnersAnalysisController.java index 52c98e681..74608a157 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/web/PartnersAnalysisController.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/web/PartnersAnalysisController.java @@ -79,9 +79,6 @@ public class PartnersAnalysisController { params.put("bd_group_bd",analysis.getGroup_bd()); } } - if (analysis.isRecent_client()){ - params.put("recent_client",true); - } return partnersAnalysisService.getPartnersSettlementAnalysis(params); } } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java index 0633dc328..cee3b2458 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java @@ -88,4 +88,7 @@ public interface ClientMapper { PageList simpleQuery(JSONObject params, PageBounds pagination); + @AutoSql(type = SqlType.SELECT) + JSONObject findByWechatInstitutionMerchantId(@Param("wechat_institution_merchant_id") String wechat_institution_merchant_id); + } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java index 207d21377..79e5d760b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java @@ -63,6 +63,9 @@ public interface ClientManager { @Transactional void updateAliSubMerchantId(JSONObject manager, String clientMoniker, JSONObject aliSubMerchantInfo); + @Transactional + void refreshWechatInstitutionMerchantId(JSONObject manager, String clientMoniker, JSONObject refreshWechatInstitutionMerchantId); + @Transactional(noRollbackFor = EmailException.class) void auditClient(JSONObject manager, String clientMoniker, int pass); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index a5d36dfeb..36683e2a7 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -742,11 +742,40 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid clientInfoCacheSupport.clearClientCache(clientId); } + @Override + public void refreshWechatInstitutionMerchantId(JSONObject manager, String clientMoniker, JSONObject refreshWechatInstitutionMerchantId) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + checkOrgPermission(manager, client); + JSONObject update = new JSONObject(); + int clientId = client.getIntValue("client_id"); + update.put("client_id", clientId); + String wechatInstitutionMerchantId = RandomStringUtils.random(6, true, true).toUpperCase(); + if(StringUtils.isEmpty(refreshWechatInstitutionMerchantId.getString("wechat_institution_merchant_id"))){ + update.put("wechat_institution_merchant_id",wechatInstitutionMerchantId); + }else { + update.put("wechat_institution_merchant_id",createWechatInstitutionMerchantId(wechatInstitutionMerchantId)) ; + } + clientMapper.update(update); + clientInfoCacheSupport.clearClientCache(clientId); + } + private String createWechatInstitutionMerchantId(String wechatInstitutionMerchantId){ + JSONObject client = clientMapper.findByWechatInstitutionMerchantId(wechatInstitutionMerchantId); + if(client == null){ + return wechatInstitutionMerchantId; + }else { + return createWechatInstitutionMerchantId(RandomStringUtils.random(6, true, true).toUpperCase()); + } + } + private void recordSubMerchantLog(JSONObject client, JSONObject subMerchantInfo, JSONObject manager) { JSONObject log = new JSONObject(); log.put("sub_merchant_id_after", subMerchantInfo.getString("sub_merchant_id")); log.put("operator", manager.getString("display_name")); log.put("create_time", new Date()); + log.put("wechat_institution_merchant_id", client.getString("wechat_institution_merchant_id")); log.put("client_id", client.getIntValue("client_id")); log.put("sub_merchant_id_before", client.getString("sub_merchant_id")); logClientSubMerchantIdMapper.save(log); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java index 00675ce7a..5958044d2 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java @@ -159,6 +159,11 @@ public class PartnerManageController { clientManager.updateAliSubMerchantId(manager, clientMoniker, aliSubMerchantInfo); } + @ManagerMapping(value = "/{clientMoniker}/wechat_institution_merchant_id", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR}) + public void refreshWechatInsMerchantId(@PathVariable String clientMoniker, @RequestBody JSONObject refreshWechatInstitutionMerchantId, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + clientManager.refreshWechatInstitutionMerchantId(manager, clientMoniker, refreshWechatInstitutionMerchantId); + } + @ManagerMapping(value = "/{clientMoniker}/qrcode_surcharge", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.SERVANT}) public void setClientPaySurCharge(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) { clientManager.setClientQRCodePaySurCharge(manager,clientMoniker, config.getBooleanValue("qrcode_surcharge")); diff --git a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.xml index f626edc57..c5462dae2 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.xml @@ -160,7 +160,7 @@ END AS clean_days FROM sys_clients c - c.client_id IS not null AND (c.approve_result = 1 OR c.approve_result= 2) AND c.is_valid = 1 + (c.approve_result = 1 OR c.approve_result= 2) AND c.is_valid = 1 and org_id=#{org_id} and org_id in #{org_id} @@ -171,9 +171,16 @@ AND (c.bd_group=#{bd_group} or c.manager_id=#{bd_group}) and c.manager_id=#{bd_group_bd}) - - AND c.client_id in (SELECT p.client_id FROM sys_clients p INNER JOIN statistics_customer_order o ON o.client_id = p.client_id AND o.client_id !=0 - WHERE datediff(now(), o.date) 230 AND p.client_id is not null GROUP BY p.client_id) + + AND c.client_id in (SELECT o.client_id FROM statistics_customer_order o + + + o.date >=#{begin} + + + o.date > #{end} + + ) GROUP by c.clean_days diff --git a/src/main/ui/static/analysis/partners-analysis.js b/src/main/ui/static/analysis/partners-analysis.js index b63e17fef..fe4100c96 100644 --- a/src/main/ui/static/analysis/partners-analysis.js +++ b/src/main/ui/static/analysis/partners-analysis.js @@ -12,7 +12,7 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts','./transaction/an app.controller('partnersAnalysisCtrl', ['$scope', '$http', '$filter', '$timeout', 'commonDialog', 'chartParser','industryMap', function ($scope, $http, $filter, $timeout, commonDialog, chartParser,industryMap) { $scope.params = {}; - + $scope.analysis = {}; if (($scope.currentUser.role & parseInt('1000000000', 2)) > 0 && $scope.currentUser.org_id) { $http.get('/sys/manager_accounts/group/group_bds').then(function (resp) { $scope.bd_group_bds = resp.data; @@ -179,15 +179,38 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts','./transaction/an } }; $scope.loadTradePartnersBySettlementCycle = function () { - var params = angular.copy($scope.params); + var params = angular.copy($scope.analysis); + params.onlyGroup = $scope.params.onlyGroup; + if ($scope.params.group_bd){ + params.group_bd=angular.copy($scope.params.group_bd); + } $http.get('/analysis/partners/settlement', {params:params}).then(function (resp) { $scope.settlementCycle = resp.data; $scope.partners_settlement_chart = chartParser.parse(partnersBySettlementCycle, resp.data); }); }; $scope.loadTradePartnersBySettlementCycle(); + $scope.chooseAll = function () { + $scope.analysis = {}; + $scope.loadTradePartnersBySettlementCycle() + }; $scope.chooseThirtyDays = function () { - $scope.params.recent_client = true; + $scope.analysis = {}; + $scope.analysis.end = $filter('date')(new Date(), 'yyyyMMdd'); + var day = new Date(); + day.setDate(day.getDate() - 30); + $scope.analysis.begin = $filter('date')(day, 'yyyyMMdd'); + $scope.loadTradePartnersBySettlementCycle(); + }; + $scope.chooseLastMonth = function () { + $scope.analysis = {}; + var monthFinish = new Date(); + monthFinish.setDate(0); + $scope.analysis.end = $filter('date')(monthFinish, 'yyyyMMdd'); + var monthBegin = new Date(); + monthBegin.setDate(0); + monthBegin.setDate(1); + $scope.analysis.begin = $filter('date')(monthBegin, 'yyyyMMdd'); $scope.loadTradePartnersBySettlementCycle(); }; var partnersBySettlementCycle = { diff --git a/src/main/ui/static/analysis/templates/partners_analysis.html b/src/main/ui/static/analysis/templates/partners_analysis.html index bc93ec323..5240b0ca6 100644 --- a/src/main/ui/static/analysis/templates/partners_analysis.html +++ b/src/main/ui/static/analysis/templates/partners_analysis.html @@ -62,7 +62,7 @@
- +
@@ -101,18 +101,21 @@
-

商户结算周期分布 - - - - -

+

商户清算周期分布

-

结算周期列表

+
+

+ + + +

+

+

清算周期列表

+
diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index 09e331a58..b96568073 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -522,6 +522,10 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }; $scope.showFile(); $scope.passClient = function () { + if(!$scope.partner.wechat_institution_merchant_id){ + commonDialog.alert({title: 'info', content: 'Wechat Institution Merchant Id not Refresh', type: 'info'}); + return; + } if ($scope.partner.enable_hf) { if($scope.partner.hfindustry == null){ alert("已开启HF支付通道,HF行业不可为空!"); @@ -570,6 +574,10 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }); }; $scope.pass2GreenChannel = function () { + if(!$scope.partner.wechat_institution_merchant_id){ + commonDialog.alert({title: 'info', content: 'Wechat Institution Merchant Id not Refresh', type: 'info'}); + return; + } commonDialog.confirm({ title: 'Green Channel Audit Partner', content: 'Are you sure to mark partner ' + $scope.partner.company_name + ' green channel audited ?' @@ -1108,6 +1116,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter } }]); app.controller('partnerPaymentInfoCtrl', ['$scope', '$http', '$state', 'commonDialog','$uibModal', function ($scope, $http, $state, commonDialog,$uibModal) { + $scope.refresh = false; $scope.loadPartnerPaymentInfo = function () { $http.get('/sys/partners/' + $scope.partner.client_moniker).then(function (resp) { $scope.paymentInfo = resp.data; @@ -1232,12 +1241,30 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }; $scope.ctrl = {}; $scope.saveSubMerchantId = function () { + if(!$scope.refresh){ + commonDialog.alert({title: 'info', content: 'Wechat Institution Merchant Id not Refresh', type: 'info'}); + return; + } $http.put('/sys/partners/' + $scope.partner.client_moniker + '/payment_config', {sub_merchant_id: $scope.paymentInfo.sub_merchant_id}).then(function (resp) { commonDialog.alert({ title: 'Success', content: 'Modify Wechat Sub Merchant ID successfully', type: 'success' }); + $scope.refresh = false; + $scope.loadPartnerPaymentInfo(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + }); + }; + $scope.refreshWechatInstitutionMerchantId = function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/wechat_institution_merchant_id', {wechat_institution_merchant_id: $scope.paymentInfo.wechat_institution_merchant_id}).then(function (resp) { + commonDialog.alert({ + title: 'Success', + content: 'Refresh Wechat Institution Merchant Id successfully', + type: 'success' + }); + $scope.refresh = true; $scope.loadPartnerPaymentInfo(); }, function (resp) { commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) diff --git a/src/main/ui/static/payment/partner/templates/add_partner.html b/src/main/ui/static/payment/partner/templates/add_partner.html index 7d48d93d0..70595e710 100644 --- a/src/main/ui/static/payment/partner/templates/add_partner.html +++ b/src/main/ui/static/payment/partner/templates/add_partner.html @@ -332,7 +332,7 @@
+ Major Products/Service
diff --git a/src/main/ui/static/payment/partner/templates/client_sub_merchant_id_log.html b/src/main/ui/static/payment/partner/templates/client_sub_merchant_id_log.html index 287bb7742..86951e407 100644 --- a/src/main/ui/static/payment/partner/templates/client_sub_merchant_id_log.html +++ b/src/main/ui/static/payment/partner/templates/client_sub_merchant_id_log.html @@ -19,6 +19,7 @@
+ @@ -27,6 +28,7 @@ + diff --git a/src/main/ui/static/payment/partner/templates/partner_detail.html b/src/main/ui/static/payment/partner/templates/partner_detail.html index 9aeb551e1..4e218de2d 100644 --- a/src/main/ui/static/payment/partner/templates/partner_detail.html +++ b/src/main/ui/static/payment/partner/templates/partner_detail.html @@ -390,7 +390,7 @@
- +

diff --git a/src/main/ui/static/payment/partner/templates/partner_edit.html b/src/main/ui/static/payment/partner/templates/partner_edit.html index 91eff8e1f..c351e7a31 100644 --- a/src/main/ui/static/payment/partner/templates/partner_edit.html +++ b/src/main/ui/static/payment/partner/templates/partner_edit.html @@ -307,7 +307,7 @@
- +
diff --git a/src/main/ui/static/payment/partner/templates/partner_payment_info.html b/src/main/ui/static/payment/partner/templates/partner_payment_info.html index b68472e36..2ec731a81 100644 --- a/src/main/ui/static/payment/partner/templates/partner_payment_info.html +++ b/src/main/ui/static/payment/partner/templates/partner_payment_info.html @@ -39,6 +39,16 @@
+
+ +
+

+ {{paymentInfo.wechat_institution_merchant_id||'初始化'}} + +

+
+
+
From 655acd41e3e7c050b0c1f73a375dde2872a29bf5 Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Tue, 31 Jul 2018 18:15:29 +0800 Subject: [PATCH 4/7] fix html --- src/main/ui/static/payment/partner/partner-manage.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index b96568073..196e39946 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -1245,6 +1245,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter commonDialog.alert({title: 'info', content: 'Wechat Institution Merchant Id not Refresh', type: 'info'}); return; } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/payment_config', {sub_merchant_id: $scope.paymentInfo.sub_merchant_id}).then(function (resp) { commonDialog.alert({ title: 'Success', From 57fc6a1ac17df4623f6453ad54fcfba06e357353 Mon Sep 17 00:00:00 2001 From: eason Date: Tue, 31 Jul 2018 18:24:43 +0800 Subject: [PATCH 5/7] fix wechat sign --- .../royalpay/payment/manage/mappers/system/ManagerMapper.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.java index 712ac48ca..8881b2a62 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.java @@ -45,6 +45,7 @@ public interface ManagerMapper { List listByRole(JSONObject params); @AutoSql(type = SqlType.SELECT) + @AdvanceSelect(addonWhereClause = "is_valid=1") JSONObject findByWxOpenId(@Param("wx_openid") String openid); List listOpenIdsOfCompliances(); From 918f20359d249e9f33d70fbd648111d3c22b00f3 Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Tue, 31 Jul 2018 18:53:55 +0800 Subject: [PATCH 6/7] fix html --- .../payment/partner/templates/client_partner_detail.html | 4 ++-- .../static/payment/partner/templates/client_partner_edit.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/ui/static/payment/partner/templates/client_partner_detail.html b/src/main/ui/static/payment/partner/templates/client_partner_detail.html index 1fb94fbac..5725d8577 100644 --- a/src/main/ui/static/payment/partner/templates/client_partner_detail.html +++ b/src/main/ui/static/payment/partner/templates/client_partner_detail.html @@ -160,7 +160,7 @@
- +

@@ -480,7 +480,7 @@
- +
From e11a5b4d92b65b3f7b102d51e793de729d2b567c Mon Sep 17 00:00:00 2001 From: yixian Date: Wed, 1 Aug 2018 00:08:15 +0800 Subject: [PATCH 7/7] settlement detail --- .../clearing/core/impl/CleanServiceImpl.java | 9 ++++++++ .../analysis/templates/settlement_detail.html | 23 +++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java index 34c828f70..745a34693 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java @@ -205,6 +205,9 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider total.put("wechat_charge", 0); total.put("royalpay_charge", 0); total.put("net_amount", 0); + total.put("total_charge", 0); + total.put("tax_amount", 0); + total.put("charge_cashback", 0); List details = new ArrayList<>(); for (JSONObject log : logs) { @@ -214,6 +217,9 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider addBigDecimal(total, log, "wechat_charge"); addBigDecimal(total, log, "royalpay_charge"); addBigDecimal(total, log, "net_amount"); + addBigDecimal(total, log, "total_charge"); + addBigDecimal(total, log, "charge_cashback"); + addBigDecimal(total, log, "tax_amount"); int clearingId = log.getIntValue("clearing_id"); List logDetails = clearingDetailMapper.listReportsOfSettlement(clearingId); details.addAll(logDetails); @@ -226,6 +232,9 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider .map(detail -> detail.getBigDecimal("clearing_amount")) .reduce(BigDecimal::add) ); + data.put("clients", logDetails.stream() + .filter(detail -> bank.equals(detail.getString("settle_bank"))) + .count()); return data; }).collect(Collectors.toList()); log.put("bank_statistics", bankStatistics); diff --git a/src/main/ui/static/analysis/templates/settlement_detail.html b/src/main/ui/static/analysis/templates/settlement_detail.html index 51d386d05..9992dbbf1 100644 --- a/src/main/ui/static/analysis/templates/settlement_detail.html +++ b/src/main/ui/static/analysis/templates/settlement_detail.html @@ -87,7 +87,12 @@
  • - + + Total Amount: + + Clients: + +
  • @@ -119,7 +124,7 @@
    Total Charge + ng-bind="currentAnalysis.total_charge|currency:''">
    Channel Charge @@ -129,6 +134,17 @@ RoyalPay Charge
    +
    + Charge Cashback + +
    +
    +
    +
    + GST + +
    Operate Time
      -
    • +
    Sub Merchant Id Before Sub Merchant Id AfterWechat Institution Merchant Id Operator Create Time