mitao
2025-02-25 97acbe77e0c6ca4e719563f19dfad0541e428ddb
修改bug
12个文件已修改
151 ■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/controller/ComplaintController.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/enums/ReportTypeEnum.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/Complaint.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/ComplaintAuditRecord.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/ComplaintFlow.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/ComplaintProgress.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/SystemUser.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/vo/ComplaintVO.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/IComplaintFlowService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintFlowServiceImpl.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/ComplaintMapper.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/controller/ComplaintController.java
@@ -62,8 +62,9 @@
    @PostMapping("/save")
    @ApiOperation(value = "录入诉求")
    @DistributedLock(lockName = "complaint_serial_number_lock")
    public void save(Complaint complaint) {
    public R<?> save(@RequestBody Complaint complaint) {
        complaintService.saveComplaint(complaint, getUserId());
        return R.ok();
    }
    @PostMapping("/list")
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/enums/ReportTypeEnum.java
@@ -1,10 +1,10 @@
package com.panzhihua.sangeshenbian.enums;
public enum ReportTypeEnum {
    COMMUNITY(1, "社区"),
    STREET(2, "街道"),
    DISTRICT(3, "区县"),
    CITY(4, "市");
    COMMUNITY(4, "社区"),
    STREET(3, "街道"),
    DISTRICT(2, "区县"),
    CITY(1, "市");
    private final int code;
    private final String description;
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/Complaint.java
@@ -3,11 +3,14 @@
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -33,7 +36,8 @@
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = " ")
    @TableId(value = "id")
    @TableId(value = "id",type = IdType.ASSIGN_ID)
    @JsonSerialize(using = com.fasterxml.jackson.databind.ser.std.ToStringSerializer.class)
    private Long id;
    @ApiModelProperty(value = "诉求号")
@@ -140,4 +144,18 @@
    @TableField("completion_user_phone")
    private String completionUserPhone;
    @ApiModelProperty(value = "截止日期")
    @TableField("closing_time")
    private Date closingTime;
    @ApiModelProperty(value = "超时天数")
    @TableField("over_time_days")
    private Integer overTimeDays;
    @ApiModelProperty(value = "经度")
    private BigDecimal longitude;
    @ApiModelProperty(value = "纬度")
    private BigDecimal latitude;
}
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/ComplaintAuditRecord.java
@@ -8,6 +8,7 @@
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -33,6 +34,7 @@
    @ApiModelProperty(value = "主键")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @JsonSerialize(using = com.fasterxml.jackson.databind.ser.std.ToStringSerializer.class)
    private Long id;
    @ApiModelProperty(value = "是否最新")
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/ComplaintFlow.java
@@ -8,6 +8,7 @@
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -33,6 +34,7 @@
    @ApiModelProperty(value = "主键ID")
    @TableId(value = "id",type = IdType.ASSIGN_ID)
    @JsonSerialize(using = com.fasterxml.jackson.databind.ser.std.ToStringSerializer.class)
    private Long id;
    @ApiModelProperty(value = "诉求ID")
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/ComplaintProgress.java
@@ -8,6 +8,7 @@
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -32,7 +33,8 @@
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "主键")
    @TableId(value = "id")
    @TableId(value = "id",type = IdType.ASSIGN_ID)
    @JsonSerialize(using = com.fasterxml.jackson.databind.ser.std.ToStringSerializer.class)
    private Long id;
    @ApiModelProperty(value = "诉求id")
@@ -40,7 +42,7 @@
    private Long complaintId;
    @ApiModelProperty(value = "办理进度描述")
    @TableField("describe")
    @TableField("`describe`")
    private String describe;
    @ApiModelProperty(value = "图片url")
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/SystemUser.java
@@ -7,6 +7,7 @@
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.xalan.templates.VarNameCollector;
import java.time.LocalDateTime;
@@ -114,7 +115,7 @@
     */
    @TableField("street_id")
    @ApiModelProperty(value = "街道ID")
    private Integer streetId;
    private String streetId;
    /**
     * 社区
     */
@@ -126,7 +127,7 @@
     */
    @TableField("community_id")
    @ApiModelProperty(value = "社区ID")
    private Integer communityId;
    private Long communityId;
    /**
     * 状态(1=正常,2=冻结,3=删除)
     */
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/vo/ComplaintVO.java
@@ -20,7 +20,7 @@
public class ComplaintVO extends Complaint {
    @ApiModelProperty(value = "上报人")
    private String reportName;
    private String reporter;
    @ApiModelProperty(value = "所属部门")
    private String departmentName;
@@ -31,6 +31,12 @@
    @ApiModelProperty(value = "上报说明")
    private String comment;
    @ApiModelProperty(value = "录入人")
    private String nickname;
    @ApiModelProperty(value = "联系方式")
    private String phone;
    @ApiModelProperty(value = "诉求流转记录")
    List<ComplaintFlow> complaintFlows;
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/IComplaintFlowService.java
@@ -15,5 +15,13 @@
 * @since 2025-02-22
 */
public interface IComplaintFlowService extends IService<ComplaintFlow> {
    void createFlow(Long complaintId,Integer type, Long userId);
    /**
     * 创建流程
     * @param complaintId
     * @param reportType
     * @param type 流转类型 0-上报 1-下派
     * @param userId
     */
    void createFlow(Long complaintId , Long superiorId, Integer reportType, Integer type, Long userId);
}
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintFlowServiceImpl.java
@@ -1,7 +1,11 @@
package com.panzhihua.sangeshenbian.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.netflix.servo.monitor.LongGauge;
import com.panzhihua.common.exceptions.ServiceException;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.service.user.UserService;
import com.panzhihua.sangeshenbian.enums.ReportTypeEnum;
import com.panzhihua.sangeshenbian.model.entity.*;
import com.panzhihua.sangeshenbian.dao.ComplaintFlowMapper;
@@ -30,14 +34,13 @@
    private final IBcRegionService bcRegionService;
    private final IComStreetService comStreetService;
    private final IComActService comActService;
    private final UserService userService;
    @Override
    public void createFlow(Long complaintId , Integer type, Long userId) {
    public void createFlow(Long complaintId , Long superiorId, Integer reportType, Integer type, Long userId) {
        Complaint complaint = complaintService.getById(complaintId);
        Integer reportType = complaint.getReportType();
        String name = getFlowName(reportType, complaint);
        String name = getFlowName(reportType, superiorId);
        ComplaintFlow complaintFlow = new ComplaintFlow();
        complaintFlow.setComplaintId(complaintId);
@@ -48,21 +51,24 @@
        save(complaintFlow);
    }
    private String getFlowName(Integer reportType, Complaint complaint) {
    private String getFlowName(Integer reportType, Long superiorId) {
        String name;
        if (reportType == ReportTypeEnum.COMMUNITY.getCode()) {
            ComAct byId = comActService.getById(complaint.getSuperiorId());
            ComAct byId = comActService.getById(superiorId);
            name = byId.getName();
        }else if (reportType == ReportTypeEnum.STREET.getCode()) {
            ComStreet comStreet = comStreetService.getById(complaint.getSuperiorId());
            ComStreet comStreet = comStreetService.getById(superiorId);
            name = comStreet.getName();
        }  else if (reportType == ReportTypeEnum.CITY.getCode() || reportType == ReportTypeEnum.DISTRICT.getCode()){
            BcRegion bcRegion = bcRegionService.getOne(new LambdaQueryWrapper<BcRegion>()
                    .eq(BcRegion::getRegionCode, complaint.getSuperiorId()));
                    .eq(BcRegion::getRegionCode, superiorId));
            name = bcRegion.getRegionName();
        } else {
            // 处理未预期的账号等级
            throw new ServiceException("未知的账号等级");
            R<LoginUserInfoVO> userR = userService.getUserInfoByUserId(String.valueOf(superiorId));
            if (R.isOk(userR)) {
                throw new ServiceException("获取用户信息失败");
            }
            name =  userR.getData().getNickName();
        }
        return name;
    }
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java
@@ -39,6 +39,7 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import static cn.hutool.core.util.ObjectUtil.isNull;
@@ -173,7 +174,7 @@
        ComplaintProgress complaintProgress = BeanUtil.copyProperties(dto, ComplaintProgress.class);
        complaintProgress.setCreateTime(new Date());
        complaintProgress.setCreateBy(loginUserInfoVO.getUserId());
        complaintProgress.setCreateByName(loginUserInfoVO.getName());
        complaintProgress.setCreateByName(loginUserInfoVO.getNickName());
        complaintProgressService.save(complaintProgress);
    }
@@ -211,13 +212,16 @@
        SystemUser adminUser = systemUserService.getOne(new LambdaQueryWrapper<SystemUser>()
                .eq(SystemUser::getPhone, phone)
                .eq(SystemUser::getIsAdmin, 1)
                .eq(SystemUser::getStatus, 3)
                .ne(SystemUser::getStatus, 3)
                .last("LIMIT 1"));
        Long superiorId;
        int reportType;
        if (adminUser == null) {
            superiorId = loginUserInfoVO.getCommunityId();
            if (Objects.isNull(superiorId)){
                throw new ServiceException("上报失败,请绑定社区");
            }
            reportType = ReportTypeEnum.COMMUNITY.getCode();
        } else {
            int accountLevel = adminUser.getAccountLevel(); // 改为基本类型
@@ -228,7 +232,7 @@
            // 使用基本类型比较并补充默认分支
            if (accountLevel == ReportTypeEnum.COMMUNITY.getCode()) {
                superiorId = adminUser.getStreetId().longValue();
                superiorId = Long.parseLong(adminUser.getStreetId());
            } else if (accountLevel == ReportTypeEnum.STREET.getCode()) {
                superiorId = Long.parseLong(adminUser.getDistrictsCode());
            } else if (accountLevel == ReportTypeEnum.DISTRICT.getCode()) {
@@ -259,50 +263,60 @@
        SystemUser adminUser = systemUserService.getOne(new LambdaQueryWrapper<SystemUser>()
                .eq(SystemUser::getPhone, phone)
                .eq(SystemUser::getIsAdmin, 1)
                .eq(SystemUser::getStatus, 3)
                .ne(SystemUser::getStatus, 3)
                .last("LIMIT 1"));
        if (adminUser == null) {
            throw new ServiceException("无权下派");
        }
        long superiorId;
        int reportType;
        int accountLevel = adminUser.getAccountLevel(); // 改为基本类型
        if (accountLevel == 1) {
            throw new ServiceException("市级账号,无法上报!");
        if (accountLevel == 4) {
            throw new ServiceException("社区账号,无法下派!");
        }
        reportType = accountLevel - 1;
        // 使用基本类型比较并补充默认分支
        if (accountLevel == ReportTypeEnum.STREET.getCode()) {
            superiorId = adminUser.getCommunityId().longValue();
        } else if (accountLevel == ReportTypeEnum.DISTRICT.getCode()) {
            superiorId = adminUser.getStreetId().longValue();
            superiorId = Long.parseLong(adminUser.getStreetId());
        } else if (accountLevel == ReportTypeEnum.CITY.getCode()) {
            superiorId = Long.parseLong(adminUser.getDistrictsCode());
        } else {
            // 处理未预期的账号等级
            throw new ServiceException("未知的账号等级");
            throw new ServiceException("未知的账号等级2");
        }
        Long superiorOrgId;
        Complaint complaint = getById(dto.getComplaintId());
        complaint.setReportType(reportType);
        superiorOrgId = complaint.getSuperiorId();
        complaint.setReportType(accountLevel - 1);
        complaint.setSuperiorId(superiorId);
        updateById(complaint);
        // 添加流转记录
        complaintFlowService.createFlow(dto.getComplaintId(), 1, loginUserInfoVO.getUserId());
        complaintFlowService.createFlow(dto.getComplaintId(), superiorOrgId, accountLevel, 1, loginUserInfoVO.getUserId());
    }
    @Override
    public void reportAudit(ComplaintReporAuditDTO complaintReporAuditDTO, LoginUserInfoVO loginUserInfoVO) {
        complaintAuditRecordService.audit(complaintReporAuditDTO.getId(), loginUserInfoVO.getUserId(),
                complaintReporAuditDTO.getAuditResult(), complaintReporAuditDTO.getRejectReason());
        // 添加流转记录
        ComplaintAuditRecord complaintAuditRecord = complaintAuditRecordService.getById(complaintReporAuditDTO.getId());
        complaintFlowService.createFlow(complaintAuditRecord.getComplaintId(), 0, loginUserInfoVO.getUserId());
        Complaint complaint = getById(complaintAuditRecord.getComplaintId());
        Long superiorId = null;
        if (Objects.nonNull(complaint)) {
            superiorId = complaint.getCreateBy();
            if (Objects.nonNull(complaint.getSuperiorId())) {
                superiorId = complaint.getSuperiorId();
            }
            complaintFlowService.createFlow(complaintAuditRecord.getComplaintId(), superiorId,complaint.getReportType(),0, loginUserInfoVO.getUserId());
        }
    }
@@ -330,16 +344,16 @@
        SystemUser adminUser = systemUserService.getOne(new LambdaQueryWrapper<SystemUser>()
                .eq(SystemUser::getPhone, phone)
                .eq(SystemUser::getIsAdmin, 1)
                .eq(SystemUser::getStatus, 3)
                .ne(SystemUser::getStatus, 3)
                .last("LIMIT 1"));
        if (adminUser == null) {
            throw new ServiceException("无权下派");
        }
        int accountLevel = adminUser.getAccountLevel(); // 改为基本类型
        if (accountLevel == 1) {
      /*  if (accountLevel == 1) {
            throw new ServiceException("市级账号,无法上报!");
        }
        }*/
        // 使用基本类型比较并补充默认分支
        List<DispatchVO> dispatchVOList = new ArrayList<>();
@@ -361,7 +375,7 @@
            }
        } else if (accountLevel == ReportTypeEnum.CITY.getCode()) {
            List<BcRegion> list = bcRegionService.list(new LambdaQueryWrapper<BcRegion>()
                    .eq(BcRegion::getHierarchyOrder, 3));
                    .eq(BcRegion::getHierarchyOrder, 3).eq(BcRegion::getParentId, 510400));//获取攀枝花市下的区县
            for (BcRegion region : list) {
                DispatchVO dispatchVO = new DispatchVO();
                dispatchVO.setId(Long.valueOf(region.getRegionCode()));
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/ComplaintMapper.xml
@@ -35,6 +35,7 @@
               sc.completion_username,
               sc.completion_user_phone,
               sc.closing_time,
               sc.over_time_days,
               sc.latitude,
               sc.longitude,
               scar.audit_type,
@@ -44,7 +45,7 @@
               scar.videos,
               scar.create_time AS reportTime,
               scar.system_user_id,
               scar.name        AS reportName,
               scar.reporter,
               scar.department_name,
               scar.department_id
        FROM sgsb_complaint sc
@@ -53,6 +54,7 @@
            <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>
            <if test="isSuperior == 1 and targetId != null">
                AND sc.superior_id = #{targetId}
@@ -105,6 +107,7 @@
               sc.completion_username,
               sc.completion_user_phone,
               sc.closing_time,
               sc.over_time_days,
               sc.latitude,
               sc.longitude,
               scar.audit_type,
@@ -114,13 +117,15 @@
               scar.videos,
               scar.create_time AS reportTime,
               scar.system_user_id,
               scar.name        AS reportName,
               scar.reporter,
               scar.department_name,
               scar.department_id,
               scar.comment
               scar.comment,
               su.nick_name,
               su.phone
        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
        WHERE sc.id = #{id}
        <where>
            sc.id = #{id}
        </where>