From 8f7d5f42c5359cd7e81a6241ec3551fc466c80ba Mon Sep 17 00:00:00 2001 From: luoyang14z7 <704328506@qq.com> Date: Mon, 9 Jul 2018 11:36:37 +0800 Subject: [PATCH] fix : develop_client_permission --- .../impls/PermissionPartnerManagerImpl.java | 14 ++++++++++++++ .../merchants/core/impls/ClientApplyImpl.java | 5 +++++ .../merchants/core/impls/ClientManagerImpl.java | 17 ++++------------- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java index 617536c3f..5489e2fbe 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java @@ -20,6 +20,7 @@ import org.springframework.cache.annotation.CacheEvict; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.math.BigInteger; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -111,6 +112,19 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager { return report; } + public void permissionClientModuleSave(int clientId,String clientMoniker) { + List moduleId = permissionPartnerModuleMapper.list(); + for (JSONObject moduleClientAdd : moduleId) { + moduleClientAdd.put("client_id", clientId); + moduleClientAdd.put("client_moniker", clientMoniker); + moduleClientAdd.put("module_id", moduleClientAdd.getString("id")); + moduleClientAdd.put("is_valid", 1); + permissionClientModuleMapper.save(moduleClientAdd); + } + + + } + @Override public List listModules() { return permissionPartnerModuleMapper.list(); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientApplyImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientApplyImpl.java index 94a7e4227..e67086828 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientApplyImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientApplyImpl.java @@ -1,6 +1,7 @@ package au.com.royalpay.payment.manage.merchants.core.impls; +import au.com.royalpay.payment.manage.management.sysconfig.core.impls.PermissionPartnerManagerImpl; import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper; import au.com.royalpay.payment.manage.mappers.system.ClientApplyMapper; import au.com.royalpay.payment.manage.mappers.system.ClientBDMapper; @@ -65,6 +66,8 @@ public class ClientApplyImpl implements ClientApply, ApplicationEventPublisherAw private ApplicationEventPublisher publisher; @Resource private ClientConfigService clientConfigService; + @Resource + private PermissionPartnerManagerImpl permissionPartnerManagerImpl; @Override @Transactional @@ -220,6 +223,8 @@ public class ClientApplyImpl implements ClientApply, ApplicationEventPublisherAw clientConfig.put("client_id",partner.getIntValue("client_id")); clientConfig.put("client_moniker",info.getClientMoniker()); clientConfigService.save(clientConfig); + permissionPartnerManagerImpl.permissionClientModuleSave(partner.getIntValue("client_id"),info.getClientMoniker()); + JSONObject client_bd = new JSONObject(); client_bd.put("client_id", partner.getIntValue("client_id")); 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 5322d56f9..de4e4b37a 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 @@ -13,6 +13,7 @@ import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper import au.com.royalpay.payment.manage.appclient.beans.AppClientBean; import au.com.royalpay.payment.manage.application.core.SimpleClientApplyService; import au.com.royalpay.payment.manage.device.core.DeviceManager; +import au.com.royalpay.payment.manage.management.sysconfig.core.impls.PermissionPartnerManagerImpl; import au.com.royalpay.payment.manage.mappers.financial.FinancialBDConfigMapper; import au.com.royalpay.payment.manage.mappers.log.*; import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper; @@ -268,6 +269,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid private PermissionPartnerModuleMapper permissionPartnerModuleMapper; @Resource private PermissionClientModuleMapper permissionClientModuleMapper; + @Resource + private PermissionPartnerManagerImpl permissionPartnerManagerImpl; @@ -567,19 +570,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid clientConfig.put("client_id", partner.getIntValue("client_id")); clientConfig.put("client_moniker", partner.getString("client_moniker")); clientConfigService.save(clientConfig); - - - List moduleId = permissionPartnerModuleMapper.list(); - for (JSONObject moduleClientAdd : moduleId) { - moduleClientAdd.put("client_id", partner.getIntValue("client_id")); - moduleClientAdd.put("client_moniker", partner.getString("client_moniker")); - moduleClientAdd.put("module_id", moduleClientAdd.getString("id")); - moduleClientAdd.put("is_valid", 1); - permissionClientModuleMapper.save(moduleClientAdd); - } - - - + permissionPartnerManagerImpl.permissionClientModuleSave(partner.getIntValue("client_id"),partner.getString("client_moniker")); } catch (Exception e) { throw new BadRequestException("error.partner.valid.dumplicate_client_moniker"); }