From 08f1b1f1804a8bd833d42f257908d80e88387b55 Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期五, 14 三月 2025 11:27:47 +0800
Subject: [PATCH] 3.5增加登录验证、修改密码、人员列表调整

---
 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.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/ComplaintServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java
index 654ac2f..35f9664 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
@@ -1,6 +1,8 @@
 package com.panzhihua.sangeshenbian.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.collection.CollUtil;
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -28,7 +30,9 @@
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.panzhihua.sangeshenbian.model.vo.ComplaintVO;
 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;
@@ -50,6 +54,7 @@
  * @author
  * @since 2025-02-22
  */
+@Slf4j
 @Service
 @RequiredArgsConstructor(onConstructor_ = {@Lazy})
 public class ComplaintServiceImpl extends ServiceImpl<ComplaintMapper, Complaint> implements IComplaintService {
@@ -259,7 +264,7 @@
         detail.setAuditButtonStatus(1);
         Long superiorId = detail.getSuperiorId();
         Integer superiorType = detail.getSuperiorType();
-        if(detail.getStatus() == 5 && systemUserByPhone.isPresent()){
+        if((detail.getStatus() == 5 || detail.getStatus() == 7) && systemUserByPhone.isPresent()){
             if(superiorType.equals(accountLevel) && superiorId.toString().equals(targetId)){
                 detail.setAuditButtonStatus(0);
             }
@@ -316,6 +321,7 @@
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void saveReport(ComplaintReportDTO dto, LoginUserInfoVO loginUserInfoVO) {
+        log.info("用户登录数据----------------》" + JSON.toJSONString(loginUserInfoVO));
         String phone = loginUserInfoVO.getPhone();
 
         SystemUser adminUser = systemUserService.getOne(new LambdaQueryWrapper<SystemUser>()
@@ -365,6 +371,9 @@
         //complaint.setReportType(+);
         complaint.setSuperiorType(reportType);
         complaint.setSuperiorId(superiorId);
+        if (complaint.getStatus() != 0) {
+            complaint.setStatus(0);
+        }
         updateById(complaint);
 
         // 标记最新
@@ -435,9 +444,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>()
@@ -493,6 +509,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("上报申请记录不存在");
         }
@@ -525,14 +547,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) {
@@ -576,17 +592,13 @@
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void saveDelay(ComplaintDelayDTO dto, LoginUserInfoVO loginUserInfoVO) {
-        // 清除最新记录
-        complaintAuditRecordService.update(new LambdaUpdateWrapper<ComplaintAuditRecord>()
-                .eq(ComplaintAuditRecord::getComplaintId, dto.getComplaintId())
-                .set(ComplaintAuditRecord::getLatestFlag, false));
         SystemUser systemUser = systemUserService.getSystemUserByPhone(loginUserInfoVO.getPhone()).orElse(null);
         Long superiorId;
         Long currentId;
         int reportType;
         if (systemUser == null) {
             superiorId = loginUserInfoVO.getCommunityId();
-            currentId = loginUserInfoVO.getCommunityId();
+            currentId = loginUserInfoVO.getUserId();
             if (Objects.isNull(superiorId)) {
                 throw new ServiceException("上报失败,请绑定社区");
             }
@@ -608,6 +620,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("未知的账号等级");
@@ -621,7 +636,7 @@
         // 添加审核记录
         //complaintAuditRecordService.createComplaintAuditRecord(dto.getComplaintId(), 1, dto.getComment(), loginUserInfoVO, systemUser);
 
-
+        // 清除最新记录
         complaintAuditRecordService.update(new LambdaUpdateWrapper<ComplaintAuditRecord>()
                 .eq(ComplaintAuditRecord::getComplaintId, dto.getComplaintId())
                 .set(ComplaintAuditRecord::getLatestFlag, false));
@@ -629,7 +644,7 @@
         ComplaintAuditRecord record1 = new ComplaintAuditRecord();
         record1.setComplaintId(complaint.getId());
         record1.setLatestFlag(true);
-        record1.setAuditType(2);
+        record1.setAuditType(1);
         record1.setAuditStatus(0);
         record1.setCreateBy(loginUserInfoVO.getUserId());
         record1.setCreateTime(new Date(System.currentTimeMillis()));
@@ -639,12 +654,13 @@
         record1.setReportType(Objects.isNull(systemUser) ? 5 : systemUser.getAccountLevel());
         record1.setSuperiorId(currentId);
         record1.setSort(count + 1);
+        record1.setComment(dto.getComment());
         complaintAuditRecordService.save(record1);
 
         ComplaintAuditRecord record2 = new ComplaintAuditRecord();
         record2.setComplaintId(complaint.getId());
         record2.setLatestFlag(true);
-        record2.setAuditType(2);
+        record2.setAuditType(1);
         record2.setAuditStatus(0);
         record2.setCreateBy(loginUserInfoVO.getUserId());
         record2.setCreateTime(new Date(System.currentTimeMillis()));
@@ -654,6 +670,7 @@
         record2.setReportType(reportType);
         record2.setSuperiorId(superiorId);
         record2.setSort(count + 2);
+        record1.setComment(dto.getComment());
         complaintAuditRecordService.save(record2);
     }
 
@@ -682,8 +699,8 @@
                 .eq(ComplaintAuditRecord::getAuditType, 1)
                 .eq(ComplaintAuditRecord::getLatestFlag, 1)
                 .eq(ComplaintAuditRecord::getAuditStatus, 0)
-                .eq(ComplaintAuditRecord::getSuperiorId, cunrrentId)
-                .eq(ComplaintAuditRecord::getReportType, accountLevel)
+                .ne(ComplaintAuditRecord::getSuperiorId, cunrrentId)
+                .eq(ComplaintAuditRecord::getReportType, accountLevel+1)
                 .eq(ComplaintAuditRecord::getComplaintId, dto.getComplaintId())
                 .last("LIMIT 1"));
 
@@ -691,10 +708,10 @@
         if (Objects.isNull(complaintAuditRecord)) {
             throw new ServiceException("诉求延期申请不存在");
         }
-        complaintAuditRecordService.audit(complaintAuditRecord, loginUserInfoVO.getUserId(),
-                dto.getAuditResult(), dto.getRejectReason());
+        //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) && dto.getAuditResult().equals(1)) {
             Complaint complaint = getById(complaintAuditRecord.getComplaintId());
             complaint.setStatus(1);
             updateById(complaint);
@@ -708,18 +725,20 @@
         ComplaintAuditRecord record1 = new ComplaintAuditRecord();
         record1.setComplaintId(dto.getComplaintId());
         record1.setLatestFlag(true);
-        record1.setAuditType(2);
+        record1.setAuditType(1);
         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());
         record1.setUpdateTime(new Date(System.currentTimeMillis()));
         record1.setReporter(complaintAuditRecord.getReporter());
-        record1.setReportType(systemUser.getAccountLevel());
-        record1.setSuperiorId(cunrrentId);
+        record1.setReportType(complaintAuditRecord.getReportType());
+        record1.setSuperiorId(complaintAuditRecord.getSuperiorId());
         record1.setSort(count + 1);
+        record1.setRejectReason(dto.getRejectReason());
         complaintAuditRecordService.save(record1);
+
     }
 
     @Override

--
Gitblit v1.7.1