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] 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||'初始化'}} + +

+
+
+
Sub Merchant Id Before Sub Merchant Id AfterWechat Institution Merchant Id Operator Create Time