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/ComplaintServiceImpl.java |   35 ++++++++++++++++++++++++++++++++---
 1 files changed, 32 insertions(+), 3 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 46d70ce..ca73787 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
@@ -13,6 +13,7 @@
 import com.panzhihua.common.model.vos.LoginUserInfoVO;
 import com.panzhihua.common.model.vos.sangeshenbian.SystemUserVo;
 import com.panzhihua.sangeshenbian.dao.ComplaintMapper;
+import com.panzhihua.sangeshenbian.enums.AuditStatusEnum;
 import com.panzhihua.sangeshenbian.enums.ProcessStatusEnum;
 import com.panzhihua.sangeshenbian.enums.RateEnum;
 import com.panzhihua.sangeshenbian.enums.ReportTypeEnum;
@@ -537,12 +538,29 @@
      */
     @Override
     public void saveResult(ComplaintCompletionDTO dto, LoginUserInfoVO loginUserInfoVO) {
+        //获取当前身份
+        IdentityInformation identityInformationVO = identityInformationService.getIdentityInformation(loginUserInfoVO);
+
+        List<PermissionsVO> permissions = identityInformationVO.getPermissions();
+        if (permissions.isEmpty()) {
+            throw new ServiceException("请先完善个人信息");
+        }
+        Integer accountLevel = null;
+        //上级
+        if (identityInformationVO.getIdentity() == 2) {
+            //1=党员,2=管理员
+            SystemUser systemUser = identityInformationVO.getSystemUser();
+            accountLevel = systemUser.getAccountLevel();
+        }else if (identityInformationVO.getIdentity() == 1){
+            accountLevel = 5;
+        }
         Complaint complaint = BeanUtil.copyProperties(dto, Complaint.class);
         complaint.setUpdateTime(new Date());
         complaint.setCompletionUserId(loginUserInfoVO.getUserId());
         complaint.setCompletionUsername(loginUserInfoVO.getNickName());
         complaint.setCompletionUserPhone(loginUserInfoVO.getPhone());
         complaint.setCompletionTime(new Date());
+        complaint.setCompletionUserLevel(accountLevel);
         this.updateById(complaint);
     }
 
@@ -1045,12 +1063,13 @@
         Complaint complaint = getById(id);
         ComplaintVO complaintVO = BeanUtil.copyProperties(complaint, ComplaintVO.class);
         //查询办理进度
-        List<ComplaintProgress> complaintProgresses = complaintProgressService.lambdaQuery().eq(ComplaintProgress::getComplaintId, id).orderByAsc(ComplaintProgress::getCreateTime).list();
+        List<ComplaintProgress> complaintProgresses = complaintProgressService.lambdaQuery()
+                .eq(ComplaintProgress::getComplaintId, id).orderByDesc(ComplaintProgress::getCreateTime).list();
         complaintVO.setComplaintProgresses(complaintProgresses);
         //查询诉求流转记录
         List<ComplaintFlow> complaintFlows = complaintFlowService.lambdaQuery()
                 .eq(ComplaintFlow::getComplaintId, id)
-                .orderByDesc(ComplaintFlow::getCreateTime)
+                .orderByAsc(ComplaintFlow::getCreateTime)
                 .list();
         complaintVO.setComplaintFlows(complaintFlows);
         //查询评价
@@ -1136,8 +1155,18 @@
                 if (Objects.nonNull(partyMember)) {
                     community = community + "-" + partyMember.getServiceTarget();
                 }
+                reportType = complaint.getCompletionUserLevel();
                 break;
             case 3:
+                //如果上报或下派了,取当前操作人的层级
+                ComplaintAuditRecord record = complaintAuditRecordService.lambdaQuery().eq(ComplaintAuditRecord::getComplaintId, complaint.getId())
+                        .in(ComplaintAuditRecord::getAuditType, 2, 3)
+                        .eq(ComplaintAuditRecord::getAuditStatus, AuditStatusEnum.APPROVED.getCode())
+                        .eq(ComplaintAuditRecord::getLatestFlag, true)
+                        .last("LIMIT 1").one();
+                if (Objects.nonNull(record)) {
+                    reportType = record.getReportType();
+                }
                 fileName = "协调通知单";
                 break;
         }
@@ -1145,7 +1174,7 @@
         map.put("community", community);
         map.put("problemType", complaint.getProblemType());
         map.put("descriptionContent", complaint.getDescriptionContent());
-        map.put("reportType", ReportTypeEnum.fromCode(reportType).getDescription());
+        map.put("reportType", ReportTypeEnum.getDescriptionByCode(reportType));
         map.put("partyOrganization", Objects.nonNull(partyMember) ? partyMember.getPartyOrganization() : "");
         map.put("name", complaint.getName());
         map.put("contactNumber", complaint.getContactNumber());

--
Gitblit v1.7.1