From 729f3af10a01c2179d08d7f15b0015a0b86a6a08 Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期二, 18 三月 2025 15:39:29 +0800
Subject: [PATCH] bug修改

---
 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/IdentityInformationServiceImpl.java |   75 +++++++++++++++++++++++--------------
 1 files changed, 47 insertions(+), 28 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 90e7d05..60e8b34 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
@@ -8,7 +8,7 @@
 import com.panzhihua.sangeshenbian.service.IPartyMemberService;
 import com.panzhihua.sangeshenbian.service.ISystemUserService;
 import com.panzhihua.sangeshenbian.service.IdentityInformationService;
-import com.panzhihua.sangeshenbian.warpper.IdentityInformationVO;
+import com.panzhihua.sangeshenbian.warpper.IdentityInformation;
 import com.panzhihua.sangeshenbian.warpper.PermissionsVO;
 import lombok.RequiredArgsConstructor;
 import org.springframework.stereotype.Service;
@@ -22,8 +22,9 @@
     private final ISystemUserService systemUserService;
     private final IPartyMemberService partyMemberService;
     private final RedisUtils redisUtils;
+
     @Override
-    public IdentityInformationVO getIdentityInformationVO(LoginUserInfoVO loginUserInfo) {
+    public IdentityInformation getIdentityInformation(LoginUserInfoVO loginUserInfo) {
         // 获取党员信息
         PartyMember partyMember = partyMemberService.getOne(new LambdaQueryWrapper<PartyMember>()
                 .eq(PartyMember::getPhone, loginUserInfo.getPhone())
@@ -34,11 +35,13 @@
         // 获取身份
         Integer identity = (Integer) redisUtils.get("identity:" + loginUserInfo.getPhone());
         List<PermissionsVO> permissions = new ArrayList<>();
-        IdentityInformationVO identityInformationVO = new IdentityInformationVO();
+        IdentityInformation identityInformationVO = new IdentityInformation();
+        identityInformationVO.setPartyMember(partyMember);
+        identityInformationVO.setSystemUser(systemUser);
 
         // 获取提示内容是否确认
         Integer isConfirm = (Integer) redisUtils.get("confirmContent:" + loginUserInfo.getPhone());
-        identityInformationVO.setIsConfirmContent(isConfirm !=null && isConfirm == 1);
+        identityInformationVO.setIsConfirmContent(isConfirm != null && isConfirm == 1);
 
         if (partyMember != null) {
             identityInformationVO.setIsFrozen(partyMember.getFreezeStatus() == 1);
@@ -50,21 +53,20 @@
         if (identity == null && systemUser != null) {
             identityInformationVO.setIdentity(2);
             redisUtils.set("identity:" + loginUserInfo.getPhone(), 2);
-        }else if (identity == null && partyMember != null){
+        } else if (identity == null && partyMember != null) {
             identityInformationVO.setIdentity(1);
             redisUtils.set("identity:" + loginUserInfo.getPhone(), 1);
-        }
-        else {
+        } else {
             identityInformationVO.setIdentity(identity);
         }
 
-        if (identityInformationVO.getIdentity() != null){
-            if (identityInformationVO.getIdentity() == 1){
-                identityInformationVO.setIsFrozen(partyMember !=null && partyMember.getFreezeStatus() == 1);
-            }else if (identityInformationVO.getIdentity() == 2){
-                identityInformationVO.setIsFrozen(systemUser != null &&systemUser.getStatus() == 2);
+        if (identityInformationVO.getIdentity() != null) {
+            if (identityInformationVO.getIdentity() == 1) {
+                identityInformationVO.setIsFrozen(partyMember != null && partyMember.getFreezeStatus() == 1);
+            } else if (identityInformationVO.getIdentity() == 2) {
+                identityInformationVO.setIsFrozen(systemUser != null && systemUser.getStatus() == 2);
             }
-        }else {
+        } else {
             identityInformationVO.setIsFrozen(false);
         }
 
@@ -72,13 +74,7 @@
         identityInformationVO.setIsPartymember(partyMember != null && partyMember.getAuditStatus().equals(1));
         identityInformationVO.setIsConfirm(partyMember != null && partyMember.getIsConfirm() == 1);
         identityInformationVO.setAuditStatus(partyMember == null ? null : partyMember.getAuditStatus());
-        if (partyMember != null) {
-            PermissionsVO partyMemberPermissions = new PermissionsVO();
-            partyMemberPermissions.setIdentity(1);
-            partyMemberPermissions.setName(String.format("%s%s", partyMember.getCommunity(), "党员"));
-            partyMemberPermissions.setIsFrozen(partyMember.getFreezeStatus() == 1);
-            permissions.add(partyMemberPermissions);
-        }
+
         if (systemUser != null) {
             Integer accountLevel = systemUser.getAccountLevel();
             String districts = systemUser.getDistricts();
@@ -87,20 +83,43 @@
             PermissionsVO adminPermissions = new PermissionsVO();
             adminPermissions.setIdentity(2);
             adminPermissions.setIsFrozen(systemUser.getStatus() == 2);
-            if (accountLevel == 1){
-                adminPermissions.setName(String.format("%s%s%s%s%s", "攀枝花市",districts, street, community, "管理员"));
-            }if (accountLevel == 2) {
-                adminPermissions.setName(String.format("%s%s%s%s", districts, street, community, "管理员"));
+            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.setIdentity(2);
-                adminPermissions.setName(String.format("%s%s%s",  street, community, "管理员"));
+                adminPermissions.setName(String.format("%s%s%s", districts, street, "管理员"));
             } else if (accountLevel == 4) {
-                adminPermissions.setName(String.format("%s%s",   community, "管理员"));
-                adminPermissions.setIdentity(2);
+                adminPermissions.setName(String.format("%s%s%s%s", districts, street, community, "管理员"));
+            } else {
+                adminPermissions.setName("未知");
             }
             permissions.add(adminPermissions);
+        }
+
+        if (partyMember != null) {
+            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;
     }
+
+//    @Override
+//    public IdentityInformation getCurrentIdentityInformation(LoginUserInfoVO loginUserInfo) {
+//        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 {
+//            identityInformationVO.setIdentity(identity);
+//        }
+//        return null;
+//    }
 }

--
Gitblit v1.7.1