Browse Source

修正权限判断

zhang 6 years ago
parent
commit
778742581d
1 changed files with 22 additions and 21 deletions
  1. 22 21
      kmall-admin/src/main/java/com/kmall/admin/utils/ParamUtils.java

+ 22 - 21
kmall-admin/src/main/java/com/kmall/admin/utils/ParamUtils.java

@@ -22,32 +22,33 @@ public class ParamUtils {
      */
     public static void setQueryPowerByRoleType(Map params, String storeKey, String merchKey, boolean bothSet) {
         SysUserEntity user = ShiroUtils.getUserEntity();
-        if (user != null) {
-            if (bothSet) {
-                if (Dict.roleType.item_2.getItem().equals(user.getRoleType()) ||
-                    Dict.roleType.item_3.getItem().equals(user.getRoleType())) {
-                    if (storeKey == null && merchKey == null) {
-                        throw new RRException("参数错误");
-                    }
-
-                    if (storeKey != null && merchKey != null) {
-                        throw new RRException("参数错误");
-                    }
-
-                    if (storeKey != null) {
-                        params.put(storeKey, user.getStoreId());
-                    } else if (merchKey != null) {
-                        params.put(merchKey, user.getMerchSn());
-                    }
+        if (user == null) {
+            throw new RRException("用户登录超时,请重新登录");
+        }
+
+        if (bothSet) {
+            if (Dict.roleType.item_2.getItem().equals(user.getRoleType()) ||
+                Dict.roleType.item_3.getItem().equals(user.getRoleType())) {
+                if (storeKey == null && merchKey == null) {
+                    throw new RRException("参数错误");
+                }
+
+                if (storeKey != null && merchKey != null) {
+                    throw new RRException("参数错误");
                 }
-            } else {
-                if (Dict.roleType.item_2.getItem().equals(user.getRoleType())) {
+
+                if (storeKey != null) {
                     params.put(storeKey, user.getStoreId());
-                } else if (Dict.roleType.item_3.getItem().equals(user.getRoleType())) {
+                } else if (merchKey != null) {
                     params.put(merchKey, user.getMerchSn());
                 }
             }
-
+        } else {
+            if (Dict.roleType.item_2.getItem().equals(user.getRoleType())) {
+                params.put(storeKey, user.getStoreId());
+            } else if (Dict.roleType.item_3.getItem().equals(user.getRoleType())) {
+                params.put(merchKey, user.getMerchSn());
+            }
         }
     }
 }