From a9e1d653aad4255e365be36f0c7d00210631363f Mon Sep 17 00:00:00 2001 From: "eason.qian" Date: Tue, 9 Jan 2018 16:20:26 +0800 Subject: [PATCH] fix --- .../core/impls/SignInAccountServiceImpl.java | 34 +++---------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java index 4d20ee720..042a1149d 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java @@ -32,7 +32,10 @@ import org.thymeleaf.context.Context; import org.thymeleaf.spring4.SpringTemplateEngine; import javax.annotation.Resource; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * account service for sign in @@ -64,14 +67,11 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati @Cacheable(value = ":login:managers:", key = "''+#accountId") public JSONObject getManager(String accountId) { JSONObject manager = managerMapper.findById(accountId); - JSONObject org = null; if (manager == null) { throw new ForbiddenException("用户不存在或已禁用"); } if (manager.getInteger("org_id") != null) { - org = orgMapper.findOne(manager.getIntValue("org_id")); - manager.put("org", org); - manager.put("parent_org_id",org.getIntValue("parent_org_id")); + manager.put("org", orgMapper.findOne(manager.getIntValue("org_id"))); } List funcs = permissionManager.listUserFunctions(manager.getIntValue("role")); List funcIds = new ArrayList<>(); @@ -90,36 +90,12 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati modules.put(module, mod); } } - if(org != null && org.getIntValue("type")==0 && org.getString("parent_org_id") != null){ - if(modules.containsKey("org")){ - deleteOrgModule(modules,"org"); - } - if(modules.containsKey("manager_accounts")){ - deleteOrgModule(modules,"manager_accounts"); - } - } - if(org != null && org.getIntValue("type")==0 && org.getString("parent_org_id") == null){ - if(modules.containsKey("manager_accounts")){ - deleteOrgModule(modules,"manager_accounts"); - } - } - manager.put("available_func_ids", funcIds); manager.put("available_func_names", funcNames); manager.put("modules", modules.values()); manager.put("module_names", modules.keySet()); return manager; } - private void deleteOrgModule(Map modules,String module){ - Iterator iterator = modules.keySet().iterator(); - while (iterator.hasNext()) { - String key = (String) iterator.next(); - if (module.equals(key)) { - iterator.remove(); - modules.remove(key); - } - } - } @Override @Cacheable(value = ":login:clients:", key = "''+#accountId")