From 73649e493450010aa6ddba90d1b80024f34d7d90 Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期六, 01 三月 2025 01:05:13 +0800
Subject: [PATCH] bug修改

---
 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java |   40 ++++++++++++++++++++++++++--------------
 1 files changed, 26 insertions(+), 14 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 2c269dd..9eeb578 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
@@ -32,6 +32,7 @@
 import com.panzhihua.sangeshenbian.service.ISystemUserService;
 import io.jsonwebtoken.lang.Collections;
 import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -53,6 +54,7 @@
  * @author
  * @since 2025-02-22
  */
+@Slf4j
 @Service
 @RequiredArgsConstructor(onConstructor_ = {@Lazy})
 public class ComplaintServiceImpl extends ServiceImpl<ComplaintMapper, Complaint> implements IComplaintService {
@@ -319,7 +321,7 @@
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void saveReport(ComplaintReportDTO dto, LoginUserInfoVO loginUserInfoVO) {
-        System.err.println("用户登录数据---》" + JSON.toJSONString(loginUserInfoVO));
+        log.info("用户登录数据----------------》" + JSON.toJSONString(loginUserInfoVO));
         String phone = loginUserInfoVO.getPhone();
 
         SystemUser adminUser = systemUserService.getOne(new LambdaQueryWrapper<SystemUser>()
@@ -439,9 +441,16 @@
         updateById(complaint);
         Long superiorOrgId = complaint.getSuperiorId();
         Integer superiorType = complaint.getSuperiorType();
-
+        //查询当前单位审核记录表数据
+        //查询上报审核记录
+        ComplaintAuditRecord complaintAuditRecord = complaintAuditRecordService.lambdaQuery()
+                .eq(ComplaintAuditRecord::getComplaintId, dto.getComplaintId())
+                .eq(ComplaintAuditRecord::getAuditType, 0)
+                .eq(ComplaintAuditRecord::getLatestFlag, true)
+                .eq(ComplaintAuditRecord::getReportType, adminUser.getAccountLevel())
+                .last("LIMIT 1").one();
         // 添加流转记录
-        complaintFlowService.createFlow(dto.getComplaintId(), superiorOrgId, superiorType, 1, loginUserInfoVO.getUserId());
+        complaintFlowService.createFlow(complaintAuditRecord, 1,loginUserInfoVO.getUserId());
 
         // 标记最新
         complaintAuditRecordService.update(new LambdaUpdateWrapper<ComplaintAuditRecord>()
@@ -497,6 +506,12 @@
                 .eq(ComplaintAuditRecord::getReportType, systemUser.getAccountLevel())
                 .eq(ComplaintAuditRecord::getSuperiorId, superiorId)
                 .last("LIMIT 1").one();
+        ComplaintAuditRecord lowLevelRecord = complaintAuditRecordService.lambdaQuery()
+                .eq(ComplaintAuditRecord::getComplaintId, complaintReporAuditDTO.getId())
+                .eq(ComplaintAuditRecord::getAuditType, 2)
+                .eq(ComplaintAuditRecord::getLatestFlag, true)
+                .eq(ComplaintAuditRecord::getReportType, systemUser.getAccountLevel()+1)
+                .last("LIMIT 1").one();
         if (Objects.isNull(complaintAuditRecord)) {
             throw new ServiceException("上报申请记录不存在");
         }
@@ -529,14 +544,8 @@
             record.setSuperiorId(superiorId);
             record.setSort(count + 1);
             complaintAuditRecordService.save(record);
-
-
-            if (Objects.nonNull(complaint.getSuperiorId())) {
-                complaintFlowService.createFlow(complaintAuditRecord.getComplaintId(), complaint.getSuperiorId(), complaint.getSuperiorType(), 0, loginUserInfoVO.getUserId());
-            } else {
-                complaintFlowService.createFlow(complaintAuditRecord.getComplaintId(), complaint.getCreateBy(), complaint.getReportType(), 0, loginUserInfoVO.getUserId());
-            }
-
+            //创建流程
+            complaintFlowService.createFlow(lowLevelRecord ,0, loginUserInfoVO.getUserId());
         } else {
 
             switch (systemUser.getAccountLevel() + 1) {
@@ -586,7 +595,7 @@
         int reportType;
         if (systemUser == null) {
             superiorId = loginUserInfoVO.getCommunityId();
-            currentId = loginUserInfoVO.getCommunityId();
+            currentId = loginUserInfoVO.getUserId();
             if (Objects.isNull(superiorId)) {
                 throw new ServiceException("上报失败,请绑定社区");
             }
@@ -608,6 +617,9 @@
             } else if (accountLevel == ReportTypeEnum.DISTRICT.getCode()) {
                 superiorId = 510400L; // 攀枝花市
                 currentId = Long.parseLong(systemUser.getDistrictsCode());
+            } else if (accountLevel == ReportTypeEnum.PARTY.getCode()) {
+                superiorId = systemUser.getCommunityId();
+                currentId = loginUserInfoVO.getUserId();
             } else {
                 // 处理未预期的账号等级
                 throw new ServiceException("未知的账号等级");
@@ -694,7 +706,7 @@
         //complaintAuditRecordService.audit(complaintAuditRecord, loginUserInfoVO.getUserId(),
         //        dto.getAuditResult(), dto.getRejectReason());
         //审核通过后,设置诉求延期
-        if (complaintAuditRecord.getAuditType().equals(1) && complaintAuditRecord.getAuditStatus().equals(1)) {
+        if (complaintAuditRecord.getAuditType().equals(1) && complaintAuditRecord.getAuditStatus().equals(0)) {
             Complaint complaint = getById(complaintAuditRecord.getComplaintId());
             complaint.setStatus(1);
             updateById(complaint);
@@ -710,7 +722,7 @@
         record1.setLatestFlag(true);
         record1.setAuditType(2);
         record1.setAuditorId(loginUserInfoVO.getUserId());
-        record1.setAuditStatus(2);
+        record1.setAuditStatus(dto.getAuditResult());
         record1.setCreateBy(loginUserInfoVO.getUserId());
         record1.setCreateTime(new Date(System.currentTimeMillis()));
         record1.setUpdateBy(loginUserInfoVO.getUserId());

--
Gitblit v1.7.1