From 261f390eaa70cbb103b85e872e463c65d16cdeb1 Mon Sep 17 00:00:00 2001
From: luofl <1442745593@qq.com>
Date: 星期一, 17 三月 2025 11:43:44 +0800
Subject: [PATCH] 党员认证、党员上级角色切换

---
 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java |   30 +++++++++++++++++++++++++-----
 1 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java
index 5ddfd0c..36131d9 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java
@@ -9,6 +9,7 @@
 import com.deepoove.poi.XWPFTemplate;
 import com.panzhihua.common.model.vos.LoginUserInfoVO;
 import com.panzhihua.common.model.vos.sangeshenbian.SystemUserVo;
+import com.panzhihua.common.redis.RedisUtils;
 import com.panzhihua.sangeshenbian.enums.RateEnum;
 import com.panzhihua.sangeshenbian.model.dto.ComplaintCompletionDTO;
 import com.panzhihua.sangeshenbian.model.dto.ComplaintProcessDTO;
@@ -81,6 +82,7 @@
     private final IComplaintCommentService complaintCommentService;
     private final HttpServletResponse response;
     private final IPartyMemberService partyMemberService;
+    private final RedisUtils redisUtils;
 
     @Override
     public void saveComplaint(Complaint complaint, LoginUserInfoVO loginUserInfoVO) {
@@ -108,24 +110,32 @@
         complaint.setSerialNumber(serialNumber);
         Optional<SystemUser> systemUserOpt = systemUserService.getSystemUserAdminByPhone(loginUserInfoVO.getPhone());
         Integer accountLevel = 5;
-        if (systemUserOpt.isPresent()) {
+        //获取当前身份,1=党员,2=管理员
+        Integer identity = (Integer) redisUtils.get("identity:" + loginUserInfoVO.getPhone());
+        if (systemUserOpt.isPresent() && identity == 2) {
             SystemUser systemUser = systemUserOpt.get();
             accountLevel = systemUser.getAccountLevel();
             switch (accountLevel) {
                 case 1:
                     //市级
                     complaint.setCityCode(510400);
+                    complaint.setReportUserName(systemUser.getName());
+                    complaint.setReportUserPhone(systemUser.getPhone());
                     break;
                 case 2:
                     //区县级
                     complaint.setCityCode(510400);
                     complaint.setDistrictsCode(Integer.valueOf(systemUser.getDistrictsCode()));
+                    complaint.setReportUserName(systemUser.getName());
+                    complaint.setReportUserPhone(systemUser.getPhone());
                     break;
                 case 3:
                     //街道
                     complaint.setCityCode(510400);
                     complaint.setDistrictsCode(Integer.valueOf(systemUser.getDistrictsCode()));
                     complaint.setStreetId(Long.valueOf(systemUser.getStreetId()));
+                    complaint.setReportUserName(systemUser.getName());
+                    complaint.setReportUserPhone(systemUser.getPhone());
                     break;
                 case 4:
                     //社区
@@ -133,25 +143,31 @@
                     complaint.setDistrictsCode(Integer.valueOf(systemUser.getDistrictsCode()));
                     complaint.setStreetId(Long.valueOf(systemUser.getStreetId()));
                     complaint.setCommunityId(systemUser.getCommunityId());
+                    complaint.setReportUserName(systemUser.getName());
+                    complaint.setReportUserPhone(systemUser.getPhone());
                     break;
                 case 5:
-                    //社区
+                    //党员
                     complaint.setCityCode(510400);
                     complaint.setDistrictsCode(Integer.valueOf(systemUser.getDistrictsCode()));
                     complaint.setStreetId(Long.valueOf(systemUser.getStreetId()));
                     complaint.setCommunityId(systemUser.getCommunityId());
                     PartyMember partyMember = partyMemberService.getPartyMemberByPhone(loginUserInfoVO.getPhone());
                     complaint.setPartyMemberId(partyMember.getId());
+                    complaint.setReportUserName(partyMember.getName());
+                    complaint.setReportUserPhone(partyMember.getPhone());
                     break;
             }
         } else{
             PartyMember partyMember = partyMemberService.getPartyMemberByPhone(loginUserInfoVO.getPhone());
-            //社区
+            //党员
             complaint.setCityCode(510400);
             complaint.setDistrictsCode(Integer.valueOf(partyMember.getDistrictsCode()));
             complaint.setStreetId(Long.valueOf(partyMember.getStreetId()));
             complaint.setCommunityId(partyMember.getCommunityId());
             complaint.setPartyMemberId(partyMember.getId());
+            complaint.setReportUserName(partyMember.getName());
+            complaint.setReportUserPhone(partyMember.getPhone());
         }
         complaint.setReportType(accountLevel);
         // 设置其他字段
@@ -182,8 +198,10 @@
         Optional<SystemUser> systemUserByPhone = systemUserService.getSystemUserAdminByPhone(loginUserInfoVO.getPhone());
         Long targetId = null;
         Integer accountLevel = 5;
+        //获取当前身份,1=党员,2=管理员
+        Integer identity = (Integer) redisUtils.get("identity:" + loginUserInfoVO.getPhone());
         //上级
-        if (systemUserByPhone.isPresent()) {
+        if (systemUserByPhone.isPresent() && identity == 2) {
             SystemUser systemUser = systemUserByPhone.get();
             accountLevel = systemUser.getAccountLevel();
             switch (accountLevel) {
@@ -384,8 +402,10 @@
         Optional<SystemUser> systemUserByPhone = systemUserService.getSystemUserAdminByPhone(loginUserInfoVO.getPhone());
         String targetId = "";
         Integer accountLevel = 5;
+        //获取当前身份,1=党员,2=管理员
+        Integer identity = (Integer) redisUtils.get("identity:" + loginUserInfoVO.getPhone());
         //上级
-        if (systemUserByPhone.isPresent()) {
+        if (systemUserByPhone.isPresent() && identity == 2) {
             SystemUser systemUser = systemUserByPhone.get();
             accountLevel = systemUser.getAccountLevel();
             switch (accountLevel) {

--
Gitblit v1.7.1