Forráskód Böngészése

律师模块举报相关功能

zhangchen 3 hete
szülő
commit
130899507c

+ 126 - 0
alien-entity/src/main/java/shop/alien/entity/store/LawyerUserViolation.java

@@ -0,0 +1,126 @@
+package shop.alien.entity.store;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 律师用户举报
+ * </p>
+ *
+ * @author system
+ * @since 2025-01-XX
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("lawyer_user_violation")
+@ApiModel(value="LawyerUserViolation对象", description="律师用户举报")
+public class LawyerUserViolation extends Model<LawyerUserViolation> {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "主键")
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @ApiModelProperty(value = "被举报用户类型")
+    @TableField("reported_user_type")
+    private String reportedUserType;
+
+    @ApiModelProperty(value = "被举报用户ID")
+    @TableField("reported_user_id")
+    private String reportedUserId;
+
+    @ApiModelProperty(value = "举报用户类型")
+    @TableField("reporting_user_type")
+    private String reportingUserType;
+
+    @ApiModelProperty(value = "举报用户ID")
+    @TableField("reporting_user_id")
+    private String reportingUserId;
+
+    @ApiModelProperty(value = "举报内容分类")
+    @TableField("report_context_type")
+    private String reportContextType;
+
+    @ApiModelProperty(value = "1:用户违规,2:色情低俗,3:违法违规,4:谩骂嘲讽、煽动对立,5:涉嫌诈骗,6:人身攻击,7:种族歧视,8:政治敏感,9:虚假、不实内容,违反公德秩序,10:危害人身安全,11:网络暴力,12:其他原因")
+    @TableField("violation_type")
+    private String violationType;
+
+    @ApiModelProperty(value = "其他原因具体内容")
+    @TableField("other_reason_content")
+    private String otherReasonContent;
+
+    @ApiModelProperty(value = "举报凭证图片")
+    @TableField("report_evidence_img")
+    private String reportEvidenceImg;
+
+    @ApiModelProperty(value = "处理状态(0:未处理,1:违规,2:未违规)")
+    @TableField("processing_status")
+    private String processingStatus;
+
+    @ApiModelProperty(value = "处理时间")
+    @TableField(value = "processing_time", fill = FieldFill.INSERT)
+    private Date processingTime;
+
+    @ApiModelProperty(value = "删除标记, 0:未删除, 1:已删除")
+    @TableField("delete_flag")
+    @TableLogic
+    private Integer deleteFlag;
+
+    @ApiModelProperty(value = "创建时间")
+    @TableField(value = "created_time", fill = FieldFill.INSERT)
+    private Date createdTime;
+
+    @ApiModelProperty(value = "创建人ID")
+    @TableField(value = "created_user_id", fill = FieldFill.INSERT)
+    private Integer createdUserId;
+
+    @ApiModelProperty(value = "更新时间")
+    @TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE)
+    private Date updatedTime;
+
+    @ApiModelProperty(value = "修改人ID")
+    @TableField(value = "updated_user_id", fill = FieldFill.INSERT_UPDATE)
+    private Integer updatedUserId;
+
+    @ApiModelProperty(value = "订单ID")
+    @TableField(value = "order_id")
+    private String orderId;
+
+    @ApiModelProperty(value = "举报结果")
+    @TableField(value = "report_result")
+    private String reportResult;
+
+    @ApiModelProperty(value = "举报类型")
+    @TableField(value = "dict_type")
+    private String dictType;
+
+    @ApiModelProperty(value = "举报类型ID")
+    @TableField(value = "dict_id")
+    private Integer dictId;
+
+    @ApiModelProperty(value = "视频第一帧")
+    @TableField(value = "video_first_frame")
+    private String videoFirstFrame;
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}
+

+ 101 - 0
alien-entity/src/main/java/shop/alien/entity/store/dto/LawyerUserViolationDto.java

@@ -0,0 +1,101 @@
+package shop.alien.entity.store.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * <p>
+ * 律师用户举报
+ * </p>
+ *
+ * @author system
+ * @since 2025-01-XX
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="LawyerUserViolationDto对象", description="律师用户举报")
+public class LawyerUserViolationDto {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "主键")
+    private Integer id;
+
+    @ApiModelProperty(value = "被举报用户类型")
+    private String reportedUserType;
+
+    @ApiModelProperty(value = "被举报用户ID")
+    private String reportedUserId;
+
+    @ApiModelProperty(value = "举报用户类型")
+    private String reportingUserType;
+
+    @ApiModelProperty(value = "举报用户ID")
+    private String reportingUserId;
+
+    @ApiModelProperty(value = "举报内容分类")
+    private String reportContextType;
+
+    @ApiModelProperty(value = "1:用户违规,2:色情低俗,3:违法违规,4:谩骂嘲讽、煽动对立,5:涉嫌诈骗,6:人身攻击,7:种族歧视,8:政治敏感,9:虚假、不实内容,违反公德秩序,10:危害人身安全,11:网络暴力,12:其他原因")
+    private String violationType;
+
+    @ApiModelProperty(value = "其他原因具体内容")
+    private String otherReasonContent;
+
+    @ApiModelProperty(value = "举报凭证图片")
+    private String reportEvidenceImg;
+
+    @ApiModelProperty(value = "处理状态(0:未处理,1:违规,2:未违规)")
+    private String processingStatus;
+
+    @ApiModelProperty(value = "处理时间")
+    private Date processingTime;
+
+    @ApiModelProperty(value = "删除标记, 0:未删除, 1:已删除")
+    private Integer deleteFlag;
+
+    @ApiModelProperty(value = "创建时间")
+    private Date createdTime;
+
+    @ApiModelProperty(value = "创建人ID")
+    private Integer createdUserId;
+
+    @ApiModelProperty(value = "更新时间")
+    private Date updatedTime;
+
+    @ApiModelProperty(value = "修改人ID")
+    private Integer updatedUserId;
+
+    @ApiModelProperty(value = "订单ID")
+    private String orderId;
+
+    @ApiModelProperty(value = "昵称")
+    private String nickname;
+
+    @ApiModelProperty(value = "联系方式")
+    private String phone;
+
+    @ApiModelProperty(value = "被举报人账号")
+    private String account;
+
+    @ApiModelProperty(value = "图片")
+    private String image;
+
+    @ApiModelProperty(value = "举报结果")
+    private String reportResult;
+
+    @ApiModelProperty(value = "图片List")
+    private List<String> imageList;
+
+    @ApiModelProperty(value = "举报内容")
+    private String LifeNotice;
+
+}
+

+ 31 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/LawyerUserViolationVo.java

@@ -0,0 +1,31 @@
+package shop.alien.entity.store.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import shop.alien.entity.store.LawyerUserViolation;
+
+/**
+ * @Author: system
+ * @CreateTime: 2025-01-XX
+ * @Description: 律师举报
+ */
+
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="LawyerUserViolationVo对象", description="律师举报vo")
+public class LawyerUserViolationVo extends LawyerUserViolation {
+
+    private String reportObject;
+
+    //举报结果通知
+    private String reportResultNotification;
+
+    
+    private String phone;
+
+    private String nickName;
+}
+

+ 134 - 0
alien-entity/src/main/java/shop/alien/mapper/LawyerUserViolationMapper.java

@@ -0,0 +1,134 @@
+package shop.alien.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import shop.alien.entity.store.LawyerUserViolation;
+import shop.alien.entity.store.vo.LawyerUserViolationVo;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 律师用户举报 Mapper 接口
+ * </p>
+ *
+ * @author system
+ * @since 2025-01-XX
+ */
+public interface LawyerUserViolationMapper extends BaseMapper<LawyerUserViolation> {
+    
+    /**
+     * 分页查询律师用户举报信息
+     * 
+     * @param page 分页对象
+     * @param queryWrapper 查询条件包装器
+     * @return 分页结果
+     */
+    @Select("<script>" +
+            "WITH userInfo AS (" +
+            "    SELECT " +
+            "        lu.phone, " +
+            "        lu.id, " +
+            "        CASE lu.delete_flag " +
+            "            WHEN 1 THEN CONCAT(lu.name, '(账号已注销)') " +
+            "            ELSE lu.name " +
+            "        END AS nick_name, " +
+            "        'lawyer' AS type " +
+            "    FROM lawyer_user lu " +
+            "    UNION ALL " +
+            "    SELECT " +
+            "        su.phone, " +
+            "        su.id, " +
+            "        CASE su.delete_flag " +
+            "            WHEN 1 THEN CONCAT(su.nick_name, '(账号已注销)') " +
+            "            ELSE su.nick_name " +
+            "        END AS nick_name, " +
+            "        'store' AS type " +
+            "    FROM store_user su " +
+            "    UNION ALL " +
+            "    SELECT " +
+            "        lu2.user_phone AS phone, " +
+            "        lu2.id, " +
+            "        CASE lu2.delete_flag " +
+            "            WHEN 1 THEN CONCAT(lu2.user_name, '(账号已注销)') " +
+            "            ELSE lu2.user_name " +
+            "        END AS nick_name, " +
+            "        'user' AS type " +
+            "    FROM life_user lu2 " +
+            ") " +
+            "SELECT " +
+            "    luv.*, " +
+            "    ui.nick_name AS nickname, " +
+            "    ui.phone " +
+            "FROM lawyer_user_violation luv " +
+            "LEFT JOIN userInfo ui ON (" +
+            "    (ui.type = 'lawyer' AND luv.reporting_user_type = 'lawyer' AND ui.id = luv.reporting_user_id) OR " +
+            "    (ui.type = 'store' AND luv.reporting_user_type = '1' AND ui.id = luv.reporting_user_id) OR " +
+            "    (ui.type = 'user' AND luv.reporting_user_type = '2' AND ui.id = luv.reporting_user_id)" +
+            ") " +
+            "    ${ew.customSqlSegment}" +
+            "</script>")
+    IPage<LawyerUserViolationVo> getViolationPage(
+            IPage<LawyerUserViolationVo> page, 
+            @Param(Constants.WRAPPER) QueryWrapper<LawyerUserViolationVo> queryWrapper
+    );
+    
+    /**
+     * 查询律师用户举报信息列表
+     * 
+     * @param queryWrapper 查询条件包装器
+     * @return 举报信息列表
+     */
+    @Select("<script>" +
+            "WITH userInfo AS (" +
+            "    SELECT " +
+            "        lu.phone, " +
+            "        lu.id, " +
+            "        CASE lu.delete_flag " +
+            "            WHEN 1 THEN CONCAT(lu.name, '(账号已注销)') " +
+            "            ELSE lu.name " +
+            "        END AS nick_name, " +
+            "        'lawyer' AS type " +
+            "    FROM lawyer_user lu " +
+            "    UNION ALL " +
+            "    SELECT " +
+            "        su.phone, " +
+            "        su.id, " +
+            "        CASE su.delete_flag " +
+            "            WHEN 1 THEN CONCAT(su.nick_name, '(账号已注销)') " +
+            "            ELSE su.nick_name " +
+            "        END AS nick_name, " +
+            "        'store' AS type " +
+            "    FROM store_user su " +
+            "    UNION ALL " +
+            "    SELECT " +
+            "        lu2.user_phone AS phone, " +
+            "        lu2.id, " +
+            "        CASE lu2.delete_flag " +
+            "            WHEN 1 THEN CONCAT(lu2.user_name, '(账号已注销)') " +
+            "            ELSE lu2.user_name " +
+            "        END AS nick_name, " +
+            "        'user' AS type " +
+            "    FROM life_user lu2 " +
+            ") " +
+            "SELECT " +
+            "    luv.*, " +
+            "    ui.nick_name AS nickname, " +
+            "    ui.phone " +
+            "FROM lawyer_user_violation luv " +
+            "LEFT JOIN userInfo ui ON (" +
+            "    (ui.type = 'lawyer' AND luv.reporting_user_type = 'lawyer' AND ui.id = luv.reporting_user_id) OR " +
+            "    (ui.type = 'store' AND luv.reporting_user_type = '1' AND ui.id = luv.reporting_user_id) OR " +
+            "    (ui.type = 'user' AND luv.reporting_user_type = '2' AND ui.id = luv.reporting_user_id)" +
+            ") " +
+            "    ${ew.customSqlSegment}" +
+            "</script>")
+    List<LawyerUserViolationVo> getViolationList(
+            @Param(Constants.WRAPPER) QueryWrapper<LawyerUserViolationVo> queryWrapper
+    );
+}
+

+ 36 - 0
alien-entity/src/main/resources/mapper/LawyerUserViolationMapper.xml

@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="shop.alien.mapper.LawyerUserViolationMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="shop.alien.entity.store.LawyerUserViolation">
+        <id column="id" property="id" />
+        <result column="reported_user_id" property="reportedUserId" />
+        <result column="reported_user_type" property="reportedUserType" />
+        <result column="reporting_user_id" property="reportingUserId" />
+        <result column="reporting_user_type" property="reportingUserType" />
+        <result column="violation_type" property="violationType" />
+        <result column="other_reason_content" property="otherReasonContent" />
+        <result column="report_evidence_img" property="reportEvidenceImg" />
+        <result column="delete_flag" property="deleteFlag" />
+        <result column="created_time" property="createdTime" />
+        <result column="created_user_id" property="createdUserId" />
+        <result column="updated_time" property="updatedTime" />
+        <result column="updated_user_id" property="updatedUserId" />
+        <result column="order_id" property="orderId" />
+        <result column="report_result" property="reportResult" />
+        <result column="report_context_type" property="reportContextType" />
+        <result column="processing_status" property="processingStatus" />
+        <result column="processing_time" property="processingTime" />
+        <result column="dict_type" property="dictType" />
+        <result column="dict_id" property="dictId" />
+        <result column="video_first_frame" property="videoFirstFrame" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, reported_user_id, reported_user_type, reporting_user_id, reporting_user_type, violation_type, other_reason_content, report_evidence_img, delete_flag, created_time, created_user_id, updated_time, updated_user_id, order_id, report_result, report_context_type, processing_status, processing_time, dict_type, dict_id, video_first_frame
+    </sql>
+
+</mapper>
+

+ 103 - 0
alien-lawyer/src/main/java/shop/alien/lawyer/controller/LawyerUserViolationController.java

@@ -0,0 +1,103 @@
+package shop.alien.lawyer.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import io.swagger.annotations.*;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+import shop.alien.entity.result.R;
+import shop.alien.entity.store.LawyerUserViolation;
+import shop.alien.entity.store.dto.LawyerUserViolationDto;
+import shop.alien.lawyer.service.LawyerUserViolationService;
+
+import java.util.Map;
+
+
+/**
+ * <p>
+ * 律师用户举报 前端控制器
+ * </p>
+ *
+ * @author system
+ * @since 2025-01-XX
+ */
+@Api(tags = {"律师用户举报"})
+@Slf4j
+@CrossOrigin
+@RestController
+@RequestMapping("/lawyer/user-violation")
+@RequiredArgsConstructor
+public class LawyerUserViolationController {
+
+    private final LawyerUserViolationService lawyerUserViolationService;
+
+    @ApiOperation("举报")
+    @ApiOperationSupport(order = 1)
+    @PostMapping("/reporting")
+    public R<String> reporting(@RequestBody LawyerUserViolation lawyerUserViolation) throws Exception  {
+        log.info("LawyerUserViolationController.reporting?lawyerUserViolation={}", lawyerUserViolation.toString());
+        int reporting = lawyerUserViolationService.reporting(lawyerUserViolation);
+        if (0 == reporting) {
+            return R.fail("举报失败");
+        } else {
+            return R.data("举报成功");
+        }
+    }
+
+    @ApiOperation("举报结果")
+    @ApiOperationSupport(order = 2)
+    @GetMapping("/reportListByUserId")
+    public R<Map<String, Object>> reportListByUserId(@RequestParam(value = "userId") String userId) {
+        return R.data(lawyerUserViolationService.reportListByUserId(userId));
+    }
+
+    @ApiOperation("举报结果详细信息")
+    @ApiOperationSupport(order = 3)
+    @GetMapping("/reportListById")
+    public R<Map<String, Object>> reportListById(@RequestParam(value = "id") String id) {
+        return R.data(lawyerUserViolationService.reportListById(id));
+    }
+
+    @ApiOperation("举报分页")
+    @ApiOperationSupport(order = 4)
+    @GetMapping("/page")
+    public R<IPage<LawyerUserViolationDto>> getViolationPage(
+            @RequestParam(defaultValue = "1") int pageNum,
+            @RequestParam(defaultValue = "10") int pageSize,
+            @RequestParam(required = false) String nickname,
+            @RequestParam(required = false) String phone,
+            @RequestParam(required = false) String processingStatus) {
+        log.info("LawyerUserViolationController.getViolationPage?pageNum={},pageSize={},nickName={},phone={},processingStatus={}", pageNum, pageSize, nickname, phone, processingStatus);
+        return R.data(lawyerUserViolationService.getViolationPage(pageNum, pageSize, nickname, phone, processingStatus));
+    }
+
+    @ApiOperation(value = "举报审核")
+    @ApiOperationSupport(order = 5)
+    @GetMapping("/approve")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "processingStatus", value = "审批状态(1:审批成功,2:审批失败)", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "reportResult", value = "处理结果", dataType = "String", paramType = "query")
+    })
+    @ResponseBody
+    public R<String> approveStoreInfo(@RequestParam("id") int id, @RequestParam("processingStatus") String processingStatus, @RequestParam("reportResult") String reportResult) {
+        log.info("LawyerUserViolationController.approveStoreInfo?id={}&processingStatus={}", id, processingStatus);
+        lawyerUserViolationService.approve(id, processingStatus, reportResult);
+        return R.success("审批完成");
+    }
+
+    @ApiOperation("查看详情")
+    @ApiOperationSupport(order = 6)
+    @GetMapping("/byId")
+    public LawyerUserViolationDto byId(@RequestParam(defaultValue = "10") int id) {
+        return lawyerUserViolationService.byId(id);
+    }
+
+    @ApiOperation("查看通知详情")
+    @ApiOperationSupport(order = 7)
+    @GetMapping("/byIdNotice")
+    public LawyerUserViolationDto byIdNotice(@RequestParam(defaultValue = "10") int id) {
+        return lawyerUserViolationService.byIdNotice(id);
+    }
+}
+

+ 40 - 0
alien-lawyer/src/main/java/shop/alien/lawyer/service/LawyerUserViolationService.java

@@ -0,0 +1,40 @@
+package shop.alien.lawyer.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import shop.alien.entity.store.LawyerUserViolation;
+import shop.alien.entity.store.UserLoginInfo;
+import shop.alien.entity.store.dto.LawyerUserViolationDto;
+
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * <p>
+ * 律师用户举报 服务类
+ * </p>
+ *
+ * @author system
+ * @since 2025-01-XX
+ */
+public interface LawyerUserViolationService extends IService<LawyerUserViolation> {
+
+    int reporting(LawyerUserViolation lawyerUserViolation) throws Exception ;
+
+    Map<String, Object> reportListByUserId(String userId);
+
+    Map<String, Object> reportListById(String id);
+
+    IPage<LawyerUserViolationDto> getViolationPage(int page, int size, String nickName, String phone, String processingStatus);
+
+    void approve(int id, String processingStatus, String reportResult);
+
+    LawyerUserViolationDto byId(Integer id);
+
+    LawyerUserViolationDto byIdNotice(Integer id);
+
+    String exportExcel(String nickName, String phone, String processingStatus) throws IOException;
+
+    String level(UserLoginInfo userLoginInfo);
+}
+

+ 485 - 0
alien-lawyer/src/main/java/shop/alien/lawyer/service/impl/LawyerUserViolationServiceImpl.java

@@ -0,0 +1,485 @@
+package shop.alien.lawyer.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import shop.alien.entity.store.*;
+import shop.alien.entity.store.dto.LawyerUserViolationDto;
+import shop.alien.entity.store.vo.LawyerUserViolationVo;
+import shop.alien.entity.store.vo.WebSocketVo;
+import shop.alien.mapper.*;
+import shop.alien.lawyer.config.WebSocketProcess;
+import shop.alien.lawyer.service.LawyerUserViolationService;
+import shop.alien.lawyer.service.LawyerUserService;
+import shop.alien.util.ali.AliOSSUtil;
+import shop.alien.util.common.EnumUtil;
+
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * <p>
+ * 律师用户举报 服务实现类
+ * </p>
+ *
+ * @author system
+ * @since 2025-01-XX
+ */
+@Slf4j
+@Service
+@RequiredArgsConstructor
+public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolationMapper, LawyerUserViolation> implements LawyerUserViolationService {
+
+    private final LawyerUserViolationMapper lawyerUserViolationMapper;
+
+    private final LawyerUserMapper lawyerUserMapper;
+
+    private final StoreUserMapper storeUserMapper;
+
+    private final LifeUserMapper lifeUserMapper;
+
+    private final LawyerUserService lawyerUserService;
+
+    private final LifeNoticeMapper lifeNoticeMapper;
+
+    private final WebSocketProcess webSocketProcess;
+
+    @Value("${spring.web.resources.excel-path}")
+    private String excelPath;
+
+    @Value("${spring.web.resources.excel-generate-path}")
+    private String excelGeneratePath;
+
+    @Override
+    public int reporting(LawyerUserViolation lawyerUserViolation) throws Exception {
+        try {
+            int result = lawyerUserViolationMapper.insert(lawyerUserViolation);
+            if (result > 0) {
+                // 举报人消息
+                LifeNotice lifeNotice = getLifeNotice(lawyerUserViolation);
+                lifeNoticeMapper.insert(lifeNotice);
+                WebSocketVo websocketVo = new WebSocketVo();
+                websocketVo.setSenderId("system");
+                websocketVo.setReceiverId(lifeNotice.getReceiverId());
+                websocketVo.setCategory("notice");
+                websocketVo.setNoticeType("1");
+                websocketVo.setIsRead(0);
+                websocketVo.setText(com.alibaba.fastjson2.JSONObject.from(lifeNotice).toJSONString());
+                webSocketProcess.sendMessage(lifeNotice.getReceiverId(), com.alibaba.fastjson2.JSONObject.from(websocketVo).toJSONString());
+
+                // 被举报人消息
+                if(StringUtils.isNotEmpty(lawyerUserViolation.getReportContextType()) && "6".contains(lawyerUserViolation.getReportContextType())){
+                    LifeNotice lifeNoticeReported = getLifeReportedNotice(lawyerUserViolation);
+                    if (lifeNoticeReported != null) {
+                        lifeNoticeMapper.insert(lifeNoticeReported);
+                        WebSocketVo websocketVoReported = new WebSocketVo();
+                        websocketVoReported.setSenderId("system");
+                        websocketVoReported.setReceiverId(lifeNoticeReported.getReceiverId());
+                        websocketVoReported.setCategory("notice");
+                        websocketVoReported.setNoticeType("1");
+                        websocketVoReported.setIsRead(0);
+                        websocketVoReported.setText(com.alibaba.fastjson2.JSONObject.from(lifeNoticeReported).toJSONString());
+                        webSocketProcess.sendMessage(lifeNoticeReported.getReceiverId(), com.alibaba.fastjson2.JSONObject.from(websocketVoReported).toJSONString());
+                    }
+                }
+                return result;
+            }
+        } catch (Exception e) {
+            log.error("LawyerUserViolationServiceImpl_reporting Error Stack={}", e.getMessage());
+            throw new Exception(e);
+        }
+        return 0;
+    }
+
+    private LifeNotice getLifeNotice(LawyerUserViolation lawyerUserViolation) {
+        String phoneId = null;
+
+        LifeNotice lifeNotice = new LifeNotice();
+        lifeNotice.setSenderId("system");
+        lifeNotice.setBusinessId(lawyerUserViolation.getId());
+        lifeNotice.setTitle("举报通知");
+        JSONObject jsonObject = new JSONObject();
+        String message = "平台已受理,感谢您的反馈!";
+
+        String reportContextType = lawyerUserViolation.getReportContextType();
+        String reportUserId = lawyerUserViolation.getReportingUserId();
+
+        if ("3".equals(lawyerUserViolation.getReportingUserType())) {
+            LawyerUser lawyerUser = lawyerUserMapper.selectById(reportUserId);
+            phoneId = "lawyer_"+lawyerUser.getPhone();
+        } else if ("1".equals(lawyerUserViolation.getReportingUserType())) {
+            StoreUser storeUsers = storeUserMapper.selectById(reportUserId);
+            phoneId = "store_"+storeUsers.getPhone();
+        } else {
+            LifeUser lifeUsers = lifeUserMapper.selectById(reportUserId);
+            phoneId = "user_"+lifeUsers.getUserPhone();
+        }
+
+        lifeNotice.setReceiverId(phoneId);
+
+        if(StringUtils.isNotEmpty(reportContextType) && "6".contains(reportContextType)){
+            String violationType = StringUtils.isNotEmpty(lawyerUserViolation.getViolationType())?lawyerUserViolation.getViolationType():"13";
+            String violationText = EnumUtil.getStatusValue(Integer.parseInt(violationType));
+
+            String reportedUserName = "";
+            // 查询被举报用户信息
+            String reportedUserId = lawyerUserViolation.getReportedUserId();
+            if ("3".equals(lawyerUserViolation.getReportedUserType())) {
+                LawyerUser lawyerUser = lawyerUserMapper.selectById(reportedUserId);
+                reportedUserName = lawyerUser.getName();
+            } else if ("1".equals(lawyerUserViolation.getReportedUserType())) {
+                StoreUser storeUser = storeUserMapper.selectById(reportedUserId);
+                reportedUserName = storeUser.getNickName();
+            } else {
+                LifeUser lifeUser = lifeUserMapper.selectById(reportedUserId);
+                reportedUserName = lifeUser.getUserName();
+            }
+
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            String storeDate = simpleDateFormat.format(new Date());
+            message = "您在" + storeDate + "举报用户" + reportedUserName + ",涉嫌"+violationText+",已提交至平台审核,1-3个工作日会将审核结果发送到您应用内的消息-通知中,请注意查收。";
+
+        }
+
+        jsonObject.put("title", "平台已受理");
+        jsonObject.put("message", message);
+        lifeNotice.setContext(jsonObject.toJSONString());
+        lifeNotice.setNoticeType(1);
+        return lifeNotice;
+    }
+
+    private LifeNotice getLifeReportedNotice(LawyerUserViolation lawyerUserViolation) throws Exception {
+
+        // 查询被举报用户信息
+        String reportUserId = lawyerUserViolation.getReportedUserId();
+        String phoneId = "";
+        LifeNotice lifeNotice = new LifeNotice();
+
+        if ("3".equals(lawyerUserViolation.getReportedUserType())) {
+            LawyerUser lawyerUser = lawyerUserMapper.selectById(reportUserId);
+            phoneId = lawyerUser.getPhone();
+            lifeNotice.setReceiverId("lawyer_" + phoneId);
+        } else if ("1".equals(lawyerUserViolation.getReportedUserType())) {
+            StoreUser storeUser = storeUserMapper.selectById(reportUserId);
+            phoneId = storeUser.getPhone();
+            lifeNotice.setReceiverId("store_" + phoneId);
+        } else {
+            LifeUser lifeUser = lifeUserMapper.selectById(reportUserId);
+            phoneId = lifeUser.getUserPhone();
+            lifeNotice.setReceiverId("user_" + phoneId);
+        }
+        if (StringUtils.isEmpty(phoneId)){
+            return null;
+        }
+        String violationText = EnumUtil.getStatusValue(Integer.parseInt(lawyerUserViolation.getViolationType()));
+
+        lifeNotice.setSenderId("system");
+        lifeNotice.setBusinessId(lawyerUserViolation.getId());
+        lifeNotice.setTitle("举报通知");
+        JSONObject jsonObject = new JSONObject();
+        String message = "";
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String storeDate = simpleDateFormat.format(new Date());
+        String reportContextType = lawyerUserViolation.getReportContextType();
+
+        if(StringUtils.isNotEmpty(reportContextType) && reportContextType.equals("1")){
+            message = "您在" + storeDate + "被举报涉嫌"+violationText+",平台将会进行核实。如确实存在违规行为,平台将禁用您的账号**天,到期后账号可恢复使用,应用内的环境需要我们共同维护。";
+        } else {
+            return null;
+        }
+        jsonObject.put("message", message);
+        lifeNotice.setContext(jsonObject.toJSONString());
+        lifeNotice.setNoticeType(1);
+        return lifeNotice;
+    }
+
+    @Override
+    public Map<String, Object> reportListByUserId(String userId) {
+        Map<String, Object> resultMap = new HashMap<String, Object>();
+        LambdaUpdateWrapper<LawyerUserViolation> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.eq(LawyerUserViolation::getReportingUserId, userId).orderByDesc(LawyerUserViolation::getCreatedTime);
+        List<LawyerUserViolation> lawyerUserViolations = lawyerUserViolationMapper.selectList(wrapper);
+        List<LawyerUserViolation> filteredViolations = lawyerUserViolations.stream().filter(violation -> !"0".equals(violation.getProcessingStatus())).collect(Collectors.toList());
+        List<LawyerUserViolationVo> lawyerUserViolationsVo = new ArrayList<>();
+        for (LawyerUserViolation violation : filteredViolations) {
+            LawyerUserViolationVo vo = new LawyerUserViolationVo();
+            BeanUtils.copyProperties(violation, vo);
+            lawyerUserViolationsVo.add(vo);
+        }
+        lawyerUserViolationsVo.forEach(lawyerUserViolationVo -> {
+            lawyerUserViolationVo.setReportResultNotification("举报结果通知");
+        });
+        if (!lawyerUserViolations.isEmpty()) {
+            resultMap.put("createTime", lawyerUserViolations.get(0).getCreatedTime());
+            resultMap.put("data", lawyerUserViolationsVo);
+        }
+        return resultMap;
+    }
+
+    @Override
+    public Map<String, Object> reportListById(String id) {
+        Map<String, Object> resultMap = new HashMap<String, Object>();
+        LawyerUserViolationVo lawyerUserViolationVo = new LawyerUserViolationVo();
+        LawyerUserViolation lawyerUserViolation = lawyerUserViolationMapper.selectById(id);
+        //商户或者用户名称
+        String reportedUserName;
+        if ("3".equals(lawyerUserViolation.getReportedUserType())) {
+            LawyerUser lawyerUser = lawyerUserMapper.selectById(lawyerUserViolation.getReportedUserId());
+            reportedUserName = lawyerUser.getName();
+        } else if ("1".equals(lawyerUserViolation.getReportedUserType())) {
+            StoreUser storeUser = storeUserMapper.selectById(lawyerUserViolation.getReportedUserId());
+            reportedUserName = storeUser.getName();
+        } else {
+            LifeUser lifeUser = lifeUserMapper.selectById(lawyerUserViolation.getReportedUserId());
+            reportedUserName = lifeUser.getUserName();
+        }
+        resultMap.put("message", lawyerUserViolation.getProcessingStatus() != null ? lawyerUserViolation.getProcessingStatus() : "");
+        lawyerUserViolationVo.setReportObject(reportedUserName);
+        lawyerUserViolationVo.setViolationType(lawyerUserViolation.getViolationType());
+        lawyerUserViolationVo.setReportEvidenceImg(lawyerUserViolation.getReportEvidenceImg());
+        lawyerUserViolationVo.setCreatedTime(lawyerUserViolation.getCreatedTime());
+        resultMap.put("reportDetail", lawyerUserViolationVo);
+        LawyerUserViolationVo lawyerUserViolationVo2 = new LawyerUserViolationVo();
+        lawyerUserViolationVo2.setProcessingStatus(lawyerUserViolation.getProcessingStatus());
+        lawyerUserViolationVo2.setProcessingTime(lawyerUserViolation.getProcessingTime());
+        resultMap.put("processStatus", lawyerUserViolationVo);
+        return resultMap;
+    }
+
+    @Override
+    public IPage<LawyerUserViolationDto> getViolationPage(int page, int size, String nickName, String phone, String processingStatus) {
+        IPage<LawyerUserViolationVo> pageRequest = new Page<>(page, size);
+        QueryWrapper<LawyerUserViolationVo> queryWrapper = new QueryWrapper<>();
+
+        // 基础查询条件
+        queryWrapper.eq("luv.delete_flag", 0)
+                .in("luv.report_context_type", Arrays.asList("1", "2", "3"));
+
+        // 动态查询条件
+        queryWrapper.like(StringUtils.isNotEmpty(nickName), "ui.nick_name", nickName)
+                .like(StringUtils.isNotEmpty(phone), "ui.phone", phone);
+
+        if (StringUtils.isNotEmpty(processingStatus)) {
+            queryWrapper.eq("luv.processing_status", processingStatus);
+        }
+
+        queryWrapper.orderByDesc("luv.updated_time");
+
+        IPage<LawyerUserViolationVo> resultPage = lawyerUserViolationMapper.getViolationPage(pageRequest, queryWrapper);
+
+        return resultPage.convert(e -> {
+            LawyerUserViolationDto dto = new LawyerUserViolationDto();
+            BeanUtils.copyProperties(e, dto);
+
+            // 处理举报凭证图片
+            if (Objects.nonNull(e.getReportEvidenceImg())) {
+                List<String> imageList = Arrays.stream(e.getReportEvidenceImg().split(","))
+                        .map(String::trim)
+                        .filter(StringUtils::isNotEmpty)
+                        .collect(Collectors.toList());
+
+                if (!imageList.isEmpty()) {
+                    dto.setImage(imageList.get(0));
+                    dto.setImageList(imageList);
+                }
+            }
+
+            dto.setNickname(e.getNickName());
+            return dto;
+        });
+    }
+
+    @Override
+    public void approve(int id, String processingStatus, String reportResult) {
+        if(id==0 || StringUtils.isBlank(processingStatus)){
+            return;
+        }
+        LawyerUserViolation v = lawyerUserViolationMapper.selectById(id);
+        v.setProcessingStatus(processingStatus);
+        v.setProcessingTime(new Date());
+        v.setReportResult(reportResult);
+
+        // 举报时间
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String violationTime = simpleDateFormat.format(v.getCreatedTime());
+        // 被举报人信息
+        String reportedUserName = "";
+        if(StringUtils.isNotEmpty(v.getReportedUserId())){
+            if ("3".equals(v.getReportedUserType())) {
+                LawyerUser lawyerUser = lawyerUserMapper.selectById(v.getReportedUserId());
+                if(lawyerUser != null){
+                    reportedUserName = lawyerUser.getName();
+                }
+            } else if ("1".equals(v.getReportedUserType())) {
+                StoreUser storeUser = storeUserMapper.selectById(v.getReportedUserId());
+                if(storeUser != null){
+                    reportedUserName = storeUser.getNickName();
+                }
+            } else{
+                LifeUser lifeUser = lifeUserMapper.selectById(v.getReportedUserId());
+                if(lifeUser != null) {
+                    reportedUserName = lifeUser.getUserName();
+                }
+            }
+        }
+
+        // 举报通知信息
+        String message = "";
+        String title = "";
+        if (processingStatus.equals("1")) {
+            // 通过
+            if (v.getReportContextType().equals("1")) {
+                // 用户
+                message = "您在"+violationTime+"举报用户"+reportedUserName+",涉嫌违法违规,经核实,确实存在违规行为,平台已将用户禁用,感谢您为此做出的贡献。";
+                title = "用户举报成功通知";
+            }
+        } else {
+            // 驳回
+            switch (v.getReportContextType()) {
+                case "1":
+                    message = "您在"+violationTime+"举报用户"+reportedUserName+",涉嫌违法违规,经核实,不存在违规行为,感谢您为此做出的贡献。";
+                    title = "用户举报失败通知";
+                    break;
+            }
+        }
+        lawyerUserViolationMapper.updateById(v);
+        LifeNotice LifeMessage = new LifeNotice();
+        com.alibaba.fastjson2.JSONObject jsonObject = new com.alibaba.fastjson2.JSONObject();
+        jsonObject.put("message", message);
+        LifeMessage.setContext(jsonObject.toJSONString());
+        LifeMessage.setSenderId("system");
+        LifeMessage.setIsRead(0);
+        LifeMessage.setTitle(title);
+        LifeMessage.setNoticeType(1);
+        LifeMessage.setBusinessId(id);
+        if ("3".equals(v.getReportingUserType())) {
+            LawyerUser lawyerUser = lawyerUserService.getById(v.getReportingUserId());
+            LifeMessage.setReceiverId("lawyer_" + lawyerUser.getPhone());
+        } else if ("1".equals(v.getReportingUserType())) {
+            StoreUser storeUser = storeUserMapper.selectById(v.getReportingUserId());
+            if (storeUser != null) {
+                LifeMessage.setReceiverId("store_" + storeUser.getPhone());
+            }
+        } else {
+            LifeUser lifeUser = lifeUserMapper.selectById(v.getReportingUserId());
+            if (lifeUser != null) {
+                LifeMessage.setReceiverId("user_" + lifeUser.getUserPhone());
+            }
+        }
+        lifeNoticeMapper.insert(LifeMessage);
+
+        WebSocketVo websocketVo = new WebSocketVo();
+        websocketVo.setSenderId("system");
+        websocketVo.setReceiverId(LifeMessage.getReceiverId());
+        websocketVo.setCategory("notice");
+        websocketVo.setNoticeType("1");
+        websocketVo.setIsRead(0);
+        websocketVo.setText(com.alibaba.fastjson2.JSONObject.from(LifeMessage).toJSONString());
+        try {
+            webSocketProcess.sendMessage(LifeMessage.getReceiverId(), com.alibaba.fastjson2.JSONObject.from(websocketVo).toJSONString());
+        } catch (Exception e) {
+            log.error("LawyerUserViolationServiceImpl_approve Error Stack={}", e.getMessage());
+        }
+    }
+
+    @Override
+    public LawyerUserViolationDto byId(Integer id) {
+        LawyerUserViolation entity = lawyerUserViolationMapper.selectById(id);
+        if (entity == null) return null;
+        LawyerUserViolationDto dto = new LawyerUserViolationDto();
+        BeanUtils.copyProperties(entity, dto);
+        if (Objects.nonNull(entity.getReportEvidenceImg())) {
+            List<String> list = Arrays.stream(entity.getReportEvidenceImg().split(",")).map(String::trim).collect(Collectors.toList());
+            dto.setImageList(list);
+        }
+        // 处理举报人信息
+        if ("3".equals(dto.getReportingUserType())) {
+            LawyerUser lawyerUser = lawyerUserService.getById(dto.getReportingUserId());
+            if (lawyerUser != null) {
+                dto.setNickname(lawyerUser.getName());
+                dto.setPhone(lawyerUser.getPhone());
+            }
+        } else if ("1".equals(dto.getReportingUserType())) {
+            StoreUser storeUser = storeUserMapper.selectById(dto.getReportingUserId());
+            if (storeUser != null) {
+                dto.setNickname(storeUser.getNickName());
+                dto.setPhone(storeUser.getPhone());
+            }
+        } else {
+            LifeUser lifeUser = lifeUserMapper.selectById(dto.getReportingUserId());
+            if (lifeUser != null) {
+                dto.setNickname(lifeUser.getUserName());
+                dto.setPhone(lifeUser.getUserPhone());
+            }
+        }
+        // 处理被举报人信息
+        if ("lawyer".equals(dto.getReportedUserType())) {
+            LawyerUser lawyerUser = lawyerUserService.getById(dto.getReportedUserId());
+            if (lawyerUser != null) {
+                dto.setAccount(lawyerUser.getPhone());
+            }
+        } else if ("1".equals(dto.getReportedUserType())) {
+            StoreUser storeUser = storeUserMapper.selectById(dto.getReportedUserId());
+            if (storeUser != null) {
+                dto.setAccount(storeUser.getPhone());
+            }
+        } else {
+            LifeUser lifeUser = lifeUserMapper.selectById(dto.getReportedUserId());
+            if (lifeUser != null) {
+                dto.setAccount(lifeUser.getUserPhone());
+            }
+        }
+        return dto;
+    }
+
+    @Override
+    public LawyerUserViolationDto byIdNotice(Integer id) {
+        LifeNotice lifeNotice = lifeNoticeMapper.selectById(id);
+        LawyerUserViolationDto dto = byId(lifeNotice.getBusinessId());
+        dto.setLifeNotice(lifeNotice.getContext());
+        return dto;
+    }
+
+    @Override
+    public String exportExcel(String nickName, String phone, String processingStatus) throws IOException {
+        // Excel导出功能,可以根据需要实现
+        return "";
+    }
+
+    @Override
+    public String level(UserLoginInfo userLoginInfo) {
+        if (null == userLoginInfo) {
+            return "O";
+        }
+        String type = userLoginInfo.getType();
+        LambdaQueryWrapper<LawyerUserViolation> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(LawyerUserViolation::getReportContextType, "1").eq(LawyerUserViolation::getReportedUserId, userLoginInfo.getUserId());
+        if (Objects.equals(type, "lawyer")) {
+            wrapper.eq(LawyerUserViolation::getReportedUserType, "lawyer");
+        } else if (Objects.equals(type, "store")) {
+            wrapper.eq(LawyerUserViolation::getReportedUserType, "1");
+        } else if (Objects.equals(type, "user")) {
+            wrapper.eq(LawyerUserViolation::getReportedUserType, "2");
+        }
+        int count = Optional.ofNullable(lawyerUserViolationMapper.selectList(wrapper)).map(List::size).orElse(0);
+        if (count == 0) return "O";
+        if (count >= 15) return "E";
+        if (count >= 10) return "D";
+        if (count >= 6) return "C";
+        if (count >= 3) return "B";
+        return "A";
+    }
+}
+