mitao
2025-02-25 ee2bff3a8eaaafcea4675931db3b8c6ac04c273f
修改bug
11个文件已修改
369 ■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/controller/HomeController.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/dto/ComplaintReporAuditDTO.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/Complaint.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/query/ComplaintQuery.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/vo/ComplaintVO.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/IComplaintAuditRecordService.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/IMessageNotificationService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintAuditRecordServiceImpl.java 52 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java 112 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/MessageNotificationServiceImpl.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/ComplaintMapper.xml 115 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/controller/HomeController.java
@@ -20,6 +20,7 @@
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -34,7 +35,7 @@
 */
@RestController
@RequestMapping("/applet/home")
@RequiredArgsConstructor
@RequiredArgsConstructor(onConstructor_=@Lazy)
@Api(tags = "首页相关接口")
public class HomeController extends BaseController {
    private final IBannerService bannerService;
@@ -72,4 +73,13 @@
    public R<SystemUser> getCurrentUserInfo() {
        return R.ok(systemUserService.getSystemUserByPhone(getLoginUserInfo().getPhone()).orElse(null));
    }
    /**
     * 标记已读
     */
    @PostMapping("/read")
    @ApiOperation("标记已读")
    public R<?> read(){
        messageNotificationService.read(getLoginUserInfo());
        return R.ok();
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/dto/ComplaintReporAuditDTO.java
@@ -5,7 +5,7 @@
@Data
public class ComplaintReporAuditDTO {
    @ApiModelProperty(value = "审核记录id")
    @ApiModelProperty(value = "诉求id")
    private Long id;
    @ApiModelProperty(value = "审核结果: 1-通过 2-驳回")
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/Complaint.java
@@ -84,7 +84,7 @@
    @TableField("videos")
    private String videos;
    @ApiModelProperty(value = "流转状态:0-正在办理 1-延期办理 2-超时办理 3-已办结 4-群众撤销 5-上报待审核 6-上级驳回")
    @ApiModelProperty(value = "流转状态:0-正在办理 1-延期办理 2-超时办理 3-已办结 4-群众撤销 5-上报待审核 6-上级驳回 7-延期待审核")
    @TableField("status")
    private Integer status;
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/query/ComplaintQuery.java
@@ -15,4 +15,9 @@
    @ApiModelProperty("全部:不传,上报待审核:0,正在办理:1, 办结:2")
    private Integer type;
    /**
     * 当前登录用户id
     */
    private Long userId;
}
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/vo/ComplaintVO.java
@@ -37,6 +37,18 @@
    @ApiModelProperty(value = "联系方式")
    private String phone;
    @ApiModelProperty(value = "审核人")
    private String auditorName;
    @ApiModelProperty(value = "审核人联系方式")
    private String auditorPhone;
    @ApiModelProperty(value = "驳回原因")
    private String rejectReason;
    @ApiModelProperty(value = "审核时间")
    private Date auditTime;
    @ApiModelProperty(value = "诉求流转记录")
    List<ComplaintFlow> complaintFlows;
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/IComplaintAuditRecordService.java
@@ -1,9 +1,9 @@
package com.panzhihua.sangeshenbian.service;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.utlis.DateUtils;
import com.panzhihua.sangeshenbian.model.entity.ComplaintAuditRecord;
import com.baomidou.mybatisplus.extension.service.IService;
import com.panzhihua.sangeshenbian.model.entity.SystemUser;
/**
 * <p>
@@ -15,9 +15,9 @@
 */
public interface IComplaintAuditRecordService extends IService<ComplaintAuditRecord> {
    // 创建审核记录
    void createComplaintAuditRecord(Long complaintId, Integer auditType, String comment, Long userId);
    void createComplaintAuditRecord(Long complaintId, Integer auditType, String comment, LoginUserInfoVO loginUserInfoVO, SystemUser adminUser);
    // 审核
    void audit(Long id, Long userId, Integer auditResult, String rejectReason);
    void audit(ComplaintAuditRecord complaintAuditRecord, Long userId, Integer auditResult, String rejectReason);
}
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/IMessageNotificationService.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.sangeshenbian.model.entity.MessageNotification;
import com.panzhihua.sangeshenbian.model.query.BasePage;
import com.panzhihua.sangeshenbian.model.vo.MessageNotificationVO;
@@ -18,4 +19,10 @@
    IPage<MessageNotification> list(MessageNotificationList query);
    Page<MessageNotificationVO> getMessageList(BasePage page, Long userId);
    /**
     * 标记已读
     * @param loginUserInfoVO
     */
    void read(LoginUserInfoVO loginUserInfoVO);
}
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintAuditRecordServiceImpl.java
@@ -1,13 +1,15 @@
package com.panzhihua.sangeshenbian.service.impl;
import com.panzhihua.common.utlis.DateUtils;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.sangeshenbian.model.entity.ComplaintAuditRecord;
import com.panzhihua.sangeshenbian.dao.ComplaintAuditRecordMapper;
import com.panzhihua.sangeshenbian.model.entity.SystemUser;
import com.panzhihua.sangeshenbian.service.IComplaintAuditRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.Objects;
/**
 * <p>
@@ -21,30 +23,50 @@
public class ComplaintAuditRecordServiceImpl extends ServiceImpl<ComplaintAuditRecordMapper, ComplaintAuditRecord> implements IComplaintAuditRecordService {
    @Override
    public void createComplaintAuditRecord(Long complaintId, Integer auditType, String comment, Long userId) {
    public void createComplaintAuditRecord(Long complaintId, Integer auditType, String comment, LoginUserInfoVO loginUserInfoVO, SystemUser adminUser) {
        ComplaintAuditRecord auditRecord = new ComplaintAuditRecord();
        auditRecord.setComplaintId(complaintId);
        auditRecord.setLatestFlag(true);
        auditRecord.setAuditType(1);
        auditRecord.setAuditType(auditType);
        auditRecord.setAuditStatus(0);
        auditRecord.setComment(comment);
        auditRecord.setCreateBy(userId);
        auditRecord.setCreateBy(loginUserInfoVO.getUserId());
        auditRecord.setCreateTime(new Date());
        auditRecord.setUpdateBy(userId);
        auditRecord.setUpdateBy(loginUserInfoVO.getUserId());
        auditRecord.setUpdateTime(new Date());
        String departmentName = "";
        String reporter = loginUserInfoVO.getNickName();
        if (Objects.nonNull(adminUser) && adminUser.getIsAdmin().equals(1)){
            switch (adminUser.getAccountLevel()) {
                case 1:
                    departmentName = "攀枝花市";//默认市级
                    break;
                case 2:
                    departmentName = adminUser.getDistricts();
                    break;
                case 3:
                    departmentName = adminUser.getStreet();
                    break;
                case 4:
                    departmentName = adminUser.getCommunity();
                    break;
            }
            auditRecord.setDepartmentName(departmentName);
            reporter = adminUser.getName();
        }
        auditRecord.setReporter(reporter);
        save(auditRecord);
    }
    @Override
    public void audit(Long id, Long userId, Integer auditResult, String rejectReason) {
        ComplaintAuditRecord auditRecord = getById(id);
        if (auditRecord == null) {
            throw new RuntimeException("审核记录不存在");
        }
        auditRecord.setAuditStatus(auditResult);
        auditRecord.setRejectReason(rejectReason);
        auditRecord.setUpdateBy(userId);
        auditRecord.setUpdateTime(new Date());
        save(auditRecord);
    public void audit(ComplaintAuditRecord complaintAuditRecord, Long userId, Integer auditResult, String rejectReason) {
        complaintAuditRecord.setAuditStatus(auditResult);
        complaintAuditRecord.setRejectReason(rejectReason);
        complaintAuditRecord.setAuditorId(userId);
        complaintAuditRecord.setUpdateBy(userId);
        complaintAuditRecord.setUpdateTime(new Date());
        updateById(complaintAuditRecord);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java
@@ -29,12 +29,10 @@
import com.panzhihua.sangeshenbian.model.vo.ComplaintVO;
import com.panzhihua.sangeshenbian.service.ISystemUserService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
@@ -63,6 +61,7 @@
    private final IBcRegionService bcRegionService;
    private final IComStreetService comStreetService;
    private final IComActService comActService;
    private final IWorkOrderItemConfigService workOrderItemConfigService;
    @Override
    public void saveComplaint(Complaint complaint, Long userId) {
@@ -95,7 +94,12 @@
        complaint.setCreateBy(userId);
        complaint.setUpdateBy(userId);
        complaint.setUpdateTime(new Date(System.currentTimeMillis()));
        //查询系统配置诉求处理期限,设置截止日期
        WorkOrderItemConfig config = workOrderItemConfigService.lambdaQuery().orderByDesc(WorkOrderItemConfig::getId).last("LIMIT 1").one();
        if (Objects.isNull(config)){
            throw new ServiceException("工单事项未配置,请联系管理员");
        }
        complaint.setClosingTime(new Date(System.currentTimeMillis() + config.getDemandProcessingTime() * 24 * 60 * 60 * 1000));
        // 保存诉求记录
        save(complaint);
    }
@@ -140,6 +144,7 @@
            targetId = loginUserInfoVO.getUserId().toString();
        }
        //查询对应诉求
        query.setUserId(loginUserInfoVO.getUserId());//当前登录用户id
        page = baseMapper.selectComplaintPage(page, query, targetId,isSuperior);
        return page;
    }
@@ -189,7 +194,8 @@
        Complaint complaint = BeanUtil.copyProperties(dto, Complaint.class);
        complaint.setUpdateTime(new Date());
        complaint.setCompletionUserId(loginUserInfoVO.getUserId());
        complaint.setCompletionUsername(loginUserInfoVO.getName());
        complaint.setCompletionUsername(loginUserInfoVO.getNickName());
        complaint.setCompletionUserPhone(loginUserInfoVO.getPhone());
        complaint.setCompletionTime(new Date());
        this.updateById(complaint);
    }
@@ -206,6 +212,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void saveReport(ComplaintReportDTO dto, LoginUserInfoVO loginUserInfoVO) {
        String phone = loginUserInfoVO.getPhone();
@@ -228,7 +235,7 @@
            if (accountLevel == 1) {
                throw new ServiceException("市级账号,无法上报!");
            }
            reportType = accountLevel + 1;
            reportType = accountLevel - 1;
            // 使用基本类型比较并补充默认分支
            if (accountLevel == ReportTypeEnum.COMMUNITY.getCode()) {
@@ -254,10 +261,11 @@
                .set(ComplaintAuditRecord::getLatestFlag,false));
        // 添加审核记录
        complaintAuditRecordService.createComplaintAuditRecord(dto.getComplaintId(), 2, dto.getComment(), loginUserInfoVO.getUserId());
        complaintAuditRecordService.createComplaintAuditRecord(dto.getComplaintId(), 2, dto.getComment(), loginUserInfoVO,adminUser);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void saveDispatch(ComplaintDispatch dto, LoginUserInfoVO loginUserInfoVO) {
        String phone = loginUserInfoVO.getPhone();
        SystemUser adminUser = systemUserService.getOne(new LambdaQueryWrapper<SystemUser>()
@@ -286,13 +294,13 @@
            superiorId = Long.parseLong(adminUser.getDistrictsCode());
        } else {
            // 处理未预期的账号等级
            throw new ServiceException("未知的账号等级2");
            throw new ServiceException("未知的账号等级");
        }
        Long superiorOrgId;
        Complaint complaint = getById(dto.getComplaintId());
        superiorOrgId = complaint.getSuperiorId();
        complaint.setReportType(accountLevel - 1);
        complaint.setReportType(accountLevel + 1);
        complaint.setSuperiorId(superiorId);
        updateById(complaint);
@@ -301,14 +309,27 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void reportAudit(ComplaintReporAuditDTO complaintReporAuditDTO, LoginUserInfoVO loginUserInfoVO) {
        complaintAuditRecordService.audit(complaintReporAuditDTO.getId(), loginUserInfoVO.getUserId(),
        Optional<SystemUser> systemUserByPhone = systemUserService.getSystemUserByPhone(loginUserInfoVO.getPhone());
        if (!systemUserByPhone.isPresent()) {
            throw new ServiceException("无权审核");
        }
        //查询上报审核记录
        ComplaintAuditRecord complaintAuditRecord = complaintAuditRecordService.lambdaQuery().eq(ComplaintAuditRecord::getComplaintId, complaintReporAuditDTO.getId())
                .eq(ComplaintAuditRecord::getAuditType, 2)
                .eq(ComplaintAuditRecord::getLatestFlag, true)
                .last("LIMIT 1").one();
        if (Objects.isNull(complaintAuditRecord)) {
            throw new ServiceException("上报申请记录不存在");
        }
        //查询待审核诉求
        complaintAuditRecordService.audit(complaintAuditRecord,  loginUserInfoVO.getUserId(),
                complaintReporAuditDTO.getAuditResult(), complaintReporAuditDTO.getRejectReason());
        // 添加流转记录
        ComplaintAuditRecord complaintAuditRecord = complaintAuditRecordService.getById(complaintReporAuditDTO.getId());
        Complaint complaint = getById(complaintAuditRecord.getComplaintId());
        Long superiorId = null;
        if (Objects.nonNull(complaint)) {
            superiorId = complaint.getCreateBy();
@@ -317,23 +338,86 @@
            }
            complaintFlowService.createFlow(complaintAuditRecord.getComplaintId(), superiorId,complaint.getReportType(),0, loginUserInfoVO.getUserId());
        }
        //审核通过后,将诉求转移给上级
        if (complaintAuditRecord.getAuditType().equals(2) && complaintAuditRecord.getAuditStatus().equals(1)){
            SystemUser systemUser = systemUserByPhone.get();
                switch (systemUser.getAccountLevel()) {
                    case 1:
                        superiorId = 510400L;//默认市级
                        break;
                    case 2:
                        superiorId = Long.parseLong(systemUser.getDistrictsCode());
                        break;
                    case 3:
                        superiorId = Long.parseLong(systemUser.getStreetId());
                        break;
                    case 4:
                        superiorId = systemUser.getCommunityId();
                        break;
                }
            }
            complaint.setSuperiorId(superiorId);
            updateById(complaint );
    }
    @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;
        int reportType;
        if (systemUser == null) {
            superiorId = loginUserInfoVO.getCommunityId();
            if (Objects.isNull(superiorId)){
                throw new ServiceException("上报失败,请绑定社区");
            }
            reportType = ReportTypeEnum.COMMUNITY.getCode();
        } else {
            int accountLevel = systemUser.getAccountLevel(); // 改为基本类型
            if (accountLevel == 1) {
                throw new ServiceException("市级账号,无法上报!");
            }
            reportType = accountLevel + 1;
            // 使用基本类型比较并补充默认分支
            if (accountLevel == ReportTypeEnum.COMMUNITY.getCode()) {
                superiorId = Long.parseLong(systemUser.getStreetId());
            } else if (accountLevel == ReportTypeEnum.STREET.getCode()) {
                superiorId = Long.parseLong(systemUser.getDistrictsCode());
            } else if (accountLevel == ReportTypeEnum.DISTRICT.getCode()) {
                superiorId = 510400L; // 攀枝花市
            } else {
                // 处理未预期的账号等级
                throw new ServiceException("未知的账号等级");
            }
        }
        Complaint complaint = getById(dto.getComplaintId());
        complaint.setReportType(reportType);
        complaint.setSuperiorId(superiorId);
        updateById(complaint);
        // 添加审核记录
        complaintAuditRecordService.createComplaintAuditRecord(dto.getComplaintId(), 1, dto.getComment(), loginUserInfoVO.getUserId());
        complaintAuditRecordService.createComplaintAuditRecord(dto.getComplaintId(), 1, dto.getComment(), loginUserInfoVO, systemUser);
    }
    @Override
    public void delayAudit(ComplaintDelayAuditDTO complaintDelayAuditDTO, LoginUserInfoVO loginUserInfoVO) {
        complaintAuditRecordService.audit(complaintDelayAuditDTO.getId(), loginUserInfoVO.getUserId(),
        //查询待审核诉求
        ComplaintAuditRecord complaintAuditRecord = complaintAuditRecordService.lambdaQuery().eq(ComplaintAuditRecord::getComplaintId, complaintDelayAuditDTO.getComplaintId())
                .eq(ComplaintAuditRecord::getAuditType, 1)
                .eq(ComplaintAuditRecord::getAuditStatus, 0)
                .eq(ComplaintAuditRecord::getLatestFlag, true)
                .last("LIMIT 1").one();
        if (Objects.isNull(complaintAuditRecord)) {
            throw new ServiceException("诉求延期申请不存在");
        }
        complaintAuditRecordService.audit(complaintAuditRecord, loginUserInfoVO.getUserId(),
                complaintDelayAuditDTO.getAuditResult(), complaintDelayAuditDTO.getRejectReason());
    }
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/MessageNotificationServiceImpl.java
@@ -4,21 +4,31 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.service.sangeshenbian.SystemUserService;
import com.panzhihua.sangeshenbian.dao.MessageNotificationMapper;
import com.panzhihua.sangeshenbian.model.entity.MessageNotification;
import com.panzhihua.sangeshenbian.model.entity.SystemUser;
import com.panzhihua.sangeshenbian.model.query.BasePage;
import com.panzhihua.sangeshenbian.model.vo.MessageNotificationVO;
import com.panzhihua.sangeshenbian.service.IMessageNotificationService;
import com.panzhihua.sangeshenbian.service.ISystemUserService;
import com.panzhihua.sangeshenbian.warpper.MessageNotificationList;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import java.util.Objects;
import java.util.Optional;
/**
 * @author zhibing.pu
 * @Date 2025/2/23 3:04
 */
@Service
@RequiredArgsConstructor(onConstructor_ = {@Lazy})
public class MessageNotificationServiceImpl extends ServiceImpl<MessageNotificationMapper, MessageNotification> implements IMessageNotificationService {
    private final ISystemUserService systemUserService;
    
    @Override
    public IPage<MessageNotification> list(MessageNotificationList query) {
@@ -35,4 +45,36 @@
        Page<MessageNotification> page = lambdaQuery().page(new Page<>(basePage.getPageNum(),basePage.getPageSize()));
        return (Page<MessageNotificationVO>) page.convert(item-> BeanUtil.copyProperties(item, MessageNotificationVO.class));
    }
    /**
     * 标记已读
     * @param loginUserInfoVO
     */
    @Override
    public void read(LoginUserInfoVO loginUserInfoVO) {
        String undertakerUserId = "";
        Optional<SystemUser> systemUserByPhone = systemUserService.getSystemUserByPhone(loginUserInfoVO.getPhone());
        if (systemUserByPhone.isPresent()) {
            SystemUser systemUser = systemUserByPhone.get();
            if (systemUser.getIsAdmin().equals(1)){
                switch (systemUser.getAccountLevel()) {
                    case 1:
                        undertakerUserId = "510400";//默认市级
                        break;
                    case 2:
                        undertakerUserId = systemUser.getDistrictsCode();
                        break;
                    case 3:
                        undertakerUserId = systemUser.getStreetId();
                        break;
                    case 4:
                        undertakerUserId = systemUser.getCommunityId().toString();
                        break;
                }
            }
        }else {
            undertakerUserId = loginUserInfoVO.getUserId().toString();
        }
        this.lambdaUpdate().eq(MessageNotification::getUndertakerUserId, undertakerUserId).set(MessageNotification::getReadStatus, 1).update();
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/ComplaintMapper.xml
@@ -16,8 +16,9 @@
               sc.images,
               sc.videos,
               CASE
                   WHEN scar.audit_type = 1 AND scar.audit_status = 1 THEN 5
                   WHEN scar.audit_type = 2 AND scar.audit_status = 2 THEN 6
                   WHEN scar.audit_type = 1 AND scar.audit_status = 0 THEN 7
                   WHEN scar.audit_type = 2 AND scar.audit_status = 0 THEN 5
                   WHEN scar.audit_status = 2 THEN 6
                   ELSE sc.status
                   END          AS status,
               sc.report_type,
@@ -51,10 +52,8 @@
        FROM sgsb_complaint sc
                 LEFT JOIN sgsb_complaint_audit_record scar ON scar.complaint_id = sc.id AND scar.latest_flag = 1
        <where>
            <if test="query.type ==null">
                (scar.audit_type = 1 AND scar.audit_status = 1)
                OR (scar.audit_type = 2 AND scar.audit_status = 2)
                OR (sc.status IS NOT NULL)
            <if test="query.type ==null and isSuperior == 1">
                 AND (scar.auditor_id IS NULL OR scar.auditor_id != #{query.userId})
            </if>
            <if test="isSuperior == 1 and targetId != null">
                AND sc.superior_id = #{targetId}
@@ -63,10 +62,10 @@
                AND sc.create_by = #{targetId}
            </if>
            <if test="query.type!=null and query.type == 0">
                AND scar.audit_type = 2 AND scar.audit_status = 2
                AND(scar.audit_type = 1 AND scar.audit_status = 0) OR (scar.audit_type = 2 AND scar.audit_status = 0)
            </if>
            <if test="query.type!=null and query.type == 1">
                AND sc.status = 0
                AND sc.status IN(0,1,2)
            </if>
            <if test="query.type!=null and query.type == 2">
                AND sc.status = 3
@@ -76,56 +75,62 @@
    </select>
    <select id="getDetail" resultType="com.panzhihua.sangeshenbian.model.vo.ComplaintVO">
        SELECT sc.id,
               sc.serial_number,
               sc.time,
               sc.problem_type,
               sc.name,
               sc.contact_number,
               sc.location,
               sc.detailed_address,
               sc.description_title,
               sc.description_content,
               sc.images,
               sc.videos,
               CASE
                   WHEN scar.audit_type = 1 AND scar.audit_status = 1 THEN 5
                   WHEN scar.audit_type = 2 AND scar.audit_status = 2 THEN 6
                   ELSE sc.status
                   END          AS status,
               sc.report_type,
               sc.superior_id,
               sc.create_by,
               sc.create_time,
               sc.update_by,
               sc.update_time,
               sc.completion_description,
               sc.completion_images,
               sc.completion_videos,
               sc.completion_other_description,
               sc.completion_time,
               sc.completion_user_id,
               sc.completion_username,
               sc.completion_user_phone,
               sc.closing_time,
               sc.over_time_days,
               sc.latitude,
               sc.longitude,
               scar.audit_type,
               scar.audit_status,
               scar.comment,
               scar.images,
               scar.videos,
               scar.create_time AS reportTime,
               scar.system_user_id,
               scar.reporter,
               scar.department_name,
               scar.department_id,
               scar.comment,
               su.nick_name,
               su.phone
        sc.serial_number,
        sc.time,
        sc.problem_type,
        sc.name,
        sc.contact_number,
        sc.location,
        sc.detailed_address,
        sc.description_title,
        sc.description_content,
        sc.images,
        sc.videos,
        CASE
        WHEN scar.audit_type = 1 AND scar.audit_status = 0 THEN 7
        WHEN scar.audit_type = 2 AND scar.audit_status = 0 THEN 5
        WHEN scar.audit_status = 2 THEN 6
        ELSE sc.status
        END          AS status,
        sc.report_type,
        sc.superior_id,
        sc.create_by,
        sc.create_time,
        sc.update_by,
        sc.update_time,
        sc.completion_description,
        sc.completion_images,
        sc.completion_videos,
        sc.completion_other_description,
        sc.completion_time,
        sc.completion_user_id,
        sc.completion_username,
        sc.completion_user_phone,
        sc.closing_time,
        sc.over_time_days,
        sc.latitude,
        sc.longitude,
        scar.audit_type,
        scar.audit_status,
        scar.comment,
        scar.images,
        scar.videos,
        scar.create_time AS reportTime,
        scar.system_user_id,
        scar.reporter,
        scar.department_name,
        scar.department_id,
        scar.comment,
        scar.create_time AS auditTime,
        scar.reject_reason,
        su.nick_name,
        su.phone,
        su2.nick_name AS auditorName,
        su2.phone AS auditorPhone
        FROM sgsb_complaint sc
            LEFT JOIN sys_user su ON su.user_id = sc.create_by
                 LEFT JOIN sgsb_complaint_audit_record scar ON scar.complaint_id = sc.id AND scar.latest_flag = 1
        LEFT JOIN sys_user su2 ON su2.user_id = scar.auditor_id AND scar.audit_status != 0
        <where>
            sc.id = #{id}
        </where>