From 62ac35f2e387590d09fe154c179b6e57fd4d3b84 Mon Sep 17 00:00:00 2001
From: luofl <1442745593@qq.com>
Date: 星期四, 20 三月 2025 13:47:24 +0800
Subject: [PATCH] 修改按钮权限

---
 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/IdentityInformationServiceImpl.java |   87 ++++++++++++++++++++++---------------------
 1 files changed, 45 insertions(+), 42 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/IdentityInformationServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/IdentityInformationServiceImpl.java
index 2ca7360..51e95d5 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/IdentityInformationServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/IdentityInformationServiceImpl.java
@@ -53,18 +53,52 @@
 
 
         // 获取当前身份
-        if (identity == null && systemUser != null) {
-            identityInformationVO.setIdentity(2);
-            redisUtils.set("identity:" + loginUserInfo.getPhone(), 2);
-        } else if (identity == null && partyMember != null) {
-            identityInformationVO.setIdentity(1);
-            redisUtils.set("identity:" + loginUserInfo.getPhone(), 1);
-        } else if((partyMember == null || partyMember.getAuditStatus() !=1) && systemUser == null && identity != null){
-            identityInformationVO.setIdentity(null);
-            redisUtils.remove("identity:" + loginUserInfo.getPhone());
-        } else {
-            identityInformationVO.setIdentity(identity);
+        if (identity == null){
+            if (systemUser != null){
+                identityInformationVO.setIdentity(2);
+                Integer accountLevel = systemUser.getAccountLevel();
+                String districts = systemUser.getDistricts();
+                String street = systemUser.getStreet();
+                String community = systemUser.getCommunity();
+                PermissionsVO adminPermissions = new PermissionsVO();
+                adminPermissions.setIdentity(2);
+                adminPermissions.setIsFrozen(systemUser.getStatus() == 2);
+                if (accountLevel == 1) {
+                    adminPermissions.setName(String.format("%s%s", "攀枝花市", "管理员"));
+                } else if (accountLevel == 2) {
+                    adminPermissions.setName(String.format("%s%s", districts, "管理员"));
+                } else if (accountLevel == 3) {
+                    adminPermissions.setName(String.format("%s%s%s", districts, street, "管理员"));
+                } else if (accountLevel == 4) {
+                    adminPermissions.setName(String.format("%s%s%s%s", districts, street, community, "管理员"));
+                } else {
+                    adminPermissions.setName("未知");
+                }
+                permissions.add(adminPermissions);
+                redisUtils.set("identity:" + loginUserInfo.getPhone(), 2);
+            }else if (partyMember != null && partyMember.getAuditStatus() == 1){
+                identityInformationVO.setIdentity(1);
+                PermissionsVO partyMemberPermissions = new PermissionsVO();
+                partyMemberPermissions.setIdentity(1);
+                partyMemberPermissions.setName(String.format("%s%s", partyMember.getCommunity(), "党员"));
+                partyMemberPermissions.setIsFrozen(partyMember.getFreezeStatus() == 1);
+                permissions.add(partyMemberPermissions);
+                redisUtils.set("identity:" + loginUserInfo.getPhone(), 1);
+            }else {
+                identityInformationVO.setIdentity(null);
+            }
+        }else {
+            if (identity == 1 && (partyMember == null || partyMember.getAuditStatus() != 1)){
+                identityInformationVO.setIdentity(null);
+                redisUtils.remove("identity:" + loginUserInfo.getPhone());
+            }else if (identity == 2 && systemUser == null){
+                identityInformationVO.setIdentity(null);
+                redisUtils.remove("identity:" + loginUserInfo.getPhone());
+            }else {
+                identityInformationVO.setIdentity(identity);
+            }
         }
+
 
 
         // 获取是否冻结
@@ -85,37 +119,6 @@
         // 党员审核状态
         identityInformationVO.setAuditStatus(partyMember == null ? null : partyMember.getAuditStatus());
 
-        // 封装管理员信息
-        if (systemUser != null) {
-            Integer accountLevel = systemUser.getAccountLevel();
-            String districts = systemUser.getDistricts();
-            String street = systemUser.getStreet();
-            String community = systemUser.getCommunity();
-            PermissionsVO adminPermissions = new PermissionsVO();
-            adminPermissions.setIdentity(2);
-            adminPermissions.setIsFrozen(systemUser.getStatus() == 2);
-            if (accountLevel == 1) {
-                adminPermissions.setName(String.format("%s%s", "攀枝花市", "管理员"));
-            } else if (accountLevel == 2) {
-                adminPermissions.setName(String.format("%s%s", districts, "管理员"));
-            } else if (accountLevel == 3) {
-                adminPermissions.setName(String.format("%s%s%s", districts, street, "管理员"));
-            } else if (accountLevel == 4) {
-                adminPermissions.setName(String.format("%s%s%s%s", districts, street, community, "管理员"));
-            } else {
-                adminPermissions.setName("未知");
-            }
-            permissions.add(adminPermissions);
-        }
-
-        // 封装党员信息
-        if (partyMember != null && partyMember.getAuditStatus().equals(1)) {
-            PermissionsVO partyMemberPermissions = new PermissionsVO();
-            partyMemberPermissions.setIdentity(1);
-            partyMemberPermissions.setName(String.format("%s%s", partyMember.getCommunity(), "党员"));
-            partyMemberPermissions.setIsFrozen(partyMember.getFreezeStatus() == 1);
-            permissions.add(partyMemberPermissions);
-        }
         identityInformationVO.setPermissions(permissions);
         return identityInformationVO;
     }

--
Gitblit v1.7.1