Explorar o código

举报代码修改

zhangchen hai 3 semanas
pai
achega
da72098a4a

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

@@ -109,5 +109,9 @@ public class LawyerUserViolationDto {
     @ApiModelProperty(value = "举报内容")
     private String LifeNotice;
 
+    @ApiModelProperty(value = "律师电话")
+    private String reportedPhone;
+
+
 }
 

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

@@ -1,6 +1,7 @@
 package shop.alien.entity.store.vo;
 
 import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
@@ -23,12 +24,19 @@ public class LawyerUserViolationVo extends LawyerUserViolation {
     //举报结果通知
     private String reportResultNotification;
 
+    @ApiModelProperty(value = "用户电话")
     private String phone;
 
+    @ApiModelProperty(value = "用户姓名")
     private String nickName;
 
     private String reportUserName;
 
+    @ApiModelProperty(value = "律师姓名")
     private String reportedUserName;
+
+    @ApiModelProperty(value = "律师电话")
+    private String reportedPhone;
+
 }
 

+ 3 - 2
alien-entity/src/main/java/shop/alien/mapper/LawyerUserViolationMapper.java

@@ -64,16 +64,17 @@ public interface LawyerUserViolationMapper extends BaseMapper<LawyerUserViolatio
             "    luv.*, " +
             "    ui.nick_name AS nickname, " +
             "    ui.phone, " +
+            "    ui_reported.phone AS reported_phone, " +
             "    ui.nick_name AS reportUserName, " +
             "    ui_reported.nick_name AS reportedUserName " +
             "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 = 'lawyer' AND luv.reporting_user_type = '3' 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)" +
             ") " +
             "LEFT JOIN userInfo ui_reported ON (" +
-            "    (ui_reported.type = 'lawyer' AND (luv.reported_user_type = 'lawyer' OR luv.reported_user_type = '3') AND ui_reported.id = luv.reported_user_id) OR " +
+            "    (ui_reported.type = 'lawyer' AND luv.reported_user_type = '3' AND ui_reported.id = luv.reported_user_id) OR " +
             "    (ui_reported.type = 'store' AND luv.reported_user_type = '1' AND ui_reported.id = luv.reported_user_id) OR " +
             "    (ui_reported.type = 'user' AND luv.reported_user_type = '2' AND ui_reported.id = luv.reported_user_id)" +
             ") " +

+ 22 - 5
alien-lawyer/src/main/java/shop/alien/lawyer/controller/LawyerUserViolationController.java

@@ -140,16 +140,33 @@ public class LawyerUserViolationController {
     @ApiOperation("举报分页")
     @ApiOperationSupport(order = 4)
     @GetMapping("/page")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query"),
+            @ApiImplicitParam(name = "pageSize", value = "大小", dataType = "int", paramType = "query"),
+            @ApiImplicitParam(name = "orderNumber", value = "订单号", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "phone", value = "用户电话", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "reportedUserName", value = "律师名称", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "processingStatus", value = "状态(0:待处理,1:已通过,2:已驳回)", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "reportedPhone", value = "律师电话", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "violationReason", value = "举报原因", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "startTime", value = "开始时间", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "endTime", value = "结束时间", dataType = "String", paramType = "query")
+    })
     public R<IPage<LawyerUserViolationDto>> getViolationPage(
             @RequestParam(defaultValue = "1") int pageNum,
             @RequestParam(defaultValue = "10") int pageSize,
-            @RequestParam(required = false) String orderId,
-            @RequestParam(required = false) String processingStatus,
+            @RequestParam(required = false) String orderNumber,
+            @RequestParam(required = false) String phone,
             @RequestParam(required = false) String reportedUserName,
-            @RequestParam(required = false) String violationReason
+            @RequestParam(required = false) String processingStatus,
+            @RequestParam(required = false) String reportedPhone,
+            @RequestParam(required = false) String violationReason,
+            @RequestParam(required = false) String startTime,
+            @RequestParam(required = false) String endTime
+
     ) {
-        log.info("LawyerUserViolationController.getViolationPage?pageNum={},pageSize={},orderId={},processingStatus={},reportedUserName={},violationReason={}", pageNum, pageSize, orderId, processingStatus, reportedUserName, violationReason);
-        return R.data(lawyerUserViolationService.getViolationPage(pageNum, pageSize, orderId, processingStatus, reportedUserName, violationReason));
+        log.info("LawyerUserViolationController.getViolationPage?pageNum={},pageSize={},orderId={},processingStatus={},reportedUserName={},violationReason={}", pageNum, pageSize, orderNumber, processingStatus, reportedUserName, violationReason);
+        return R.data(lawyerUserViolationService.getViolationPage(pageNum, pageSize, orderNumber, phone, processingStatus, reportedUserName, reportedPhone, violationReason, startTime, endTime));
     }
 
     @ApiOperation(value = "举报审核")

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

@@ -46,7 +46,7 @@ public interface LawyerUserViolationService extends IService<LawyerUserViolation
      */
     LawyerUserViolationVo reportListById(String id);
 
-    IPage<LawyerUserViolationDto> getViolationPage(int page, int size, String orderId, String processingStatus, String reportedUserName, String violationReason);
+    IPage<LawyerUserViolationDto> getViolationPage(int pageNum, int pageSize, String orderNumber, String phone, String processingStatus, String reportedUserName, String reportedPhone, String violationReason, String startTime, String endTime);
 
     void approve(int id, String processingStatus, String reportResult);
 

+ 63 - 21
alien-lawyer/src/main/java/shop/alien/lawyer/service/impl/LawyerUserViolationServiceImpl.java

@@ -754,34 +754,40 @@ public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolat
      * 分页查询违规举报信息
      * <p>
      * 根据查询条件分页查询律师用户违规举报信息,支持按订单号、处理状态、
-     * 被举报人名称、违规原因等条件进行筛选查询
+     * 被举报人名称、违规原因、手机号、时间范围等条件进行筛选查询
      * </p>
      *
-     * @param page            当前页码,从1开始,必须大于0
-     * @param size            每页大小,必须大于0且不超过最大值
-     * @param orderId         订单号,支持模糊查询,可为空
+     * @param pageNum          当前页码,从1开始,必须大于0
+     * @param pageSize         每页大小,必须大于0且不超过最大值
+     * @param orderNumber          订单号,支持模糊查询,可为空
+     * @param phone            举报人手机号,精确匹配,可为空
      * @param processingStatus 处理状态,精确匹配,可为空
      * @param reportedUserName 被举报人名称,支持模糊查询,可为空
-     * @param violationReason 违规原因,精确匹配,可为空
+     * @param reportedPhone    被举报人手机号,精确匹配,可为空
+     * @param violationReason  违规原因,精确匹配,可为空
+     * @param startTime        开始时间,格式:yyyy-MM-dd HH:mm:ss,可为空
+     * @param endTime          结束时间,格式:yyyy-MM-dd HH:mm:ss,可为空
      * @return 分页查询结果,包含违规举报DTO列表
-     * @throws RuntimeException 当分页参数无效时抛出
+     * @throws RuntimeException 当分页参数无效或查询异常时抛出
      * @author system
      * @since 2025-01-XX
      */
     @Override
-    public IPage<LawyerUserViolationDto> getViolationPage(int page, int size, String orderId,
-                                                           String processingStatus, String reportedUserName,
-                                                           String violationReason) {
+    public IPage<LawyerUserViolationDto> getViolationPage(int pageNum, int pageSize, String orderNumber,
+                                                           String phone, String processingStatus,
+                                                           String reportedUserName, String reportedPhone,
+                                                           String violationReason, String startTime,
+                                                           String endTime) {
         // 参数校验
-        validatePageParams(page, size);
+        validatePageParams(pageNum, pageSize);
 
         try {
             // 构建分页对象
-            IPage<LawyerUserViolationVo> pageRequest = new Page<>(page, size);
+            IPage<LawyerUserViolationVo> pageRequest = new Page<>(pageNum, pageSize);
 
             // 构建查询条件
-            QueryWrapper<LawyerUserViolationVo> queryWrapper = buildQueryWrapper(orderId,
-                    processingStatus, reportedUserName, violationReason);
+            QueryWrapper<LawyerUserViolationVo> queryWrapper = buildQueryWrapper(orderNumber, phone,
+                    processingStatus, reportedUserName, reportedPhone, violationReason, startTime, endTime);
 
             // 执行分页查询
             IPage<LawyerUserViolationVo> resultPage = lawyerUserViolationMapper.getViolationPage(pageRequest,
@@ -790,8 +796,13 @@ public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolat
             // 转换为DTO并处理数据
             return convertToDtoPage(resultPage);
 
+        } catch (RuntimeException e) {
+            log.error("分页查询违规举报信息业务异常,页码:{},每页大小:{},异常信息:{}",
+                    pageNum, pageSize, e.getMessage());
+            throw e;
         } catch (Exception e) {
-            log.error("分页查询违规举报信息异常,页码:{},每页大小:{},异常信息:{}", page, size, e.getMessage(), e);
+            log.error("分页查询违规举报信息异常,页码:{},每页大小:{},异常信息:{}",
+                    pageNum, pageSize, e.getMessage(), e);
             throw new RuntimeException("分页查询违规举报信息失败:" + e.getMessage(), e);
         }
     }
@@ -820,15 +831,26 @@ public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolat
 
     /**
      * 构建查询条件
+     * <p>
+     * 根据传入的查询参数动态构建查询条件,支持多条件组合查询
+     * </p>
      *
-     * @param orderId          订单号
-     * @param processingStatus 处理状态
-     * @param reportedUserName 被举报人名称
-     * @param violationReason  违规原因
+     * @param orderId          订单号,支持模糊查询
+     * @param phone            举报人手机号,精确匹配
+     * @param processingStatus 处理状态,精确匹配
+     * @param reportedUserName 被举报人名称,支持模糊查询
+     * @param reportedPhone    被举报人手机号,精确匹配
+     * @param violationReason  违规原因,精确匹配
+     * @param startTime        开始时间,大于等于查询
+     * @param endTime          结束时间,小于等于查询
      * @return 查询条件包装器
      */
-    private QueryWrapper<LawyerUserViolationVo> buildQueryWrapper(String orderId, String processingStatus,
-                                                                   String reportedUserName, String violationReason) {
+    private QueryWrapper<LawyerUserViolationVo> buildQueryWrapper(String orderId, String phone,
+                                                                    String processingStatus,
+                                                                    String reportedUserName,
+                                                                    String reportedPhone,
+                                                                    String violationReason,
+                                                                    String startTime, String endTime) {
         QueryWrapper<LawyerUserViolationVo> queryWrapper = new QueryWrapper<>();
 
         // 基础查询条件:未删除且为订单举报
@@ -837,7 +859,12 @@ public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolat
 
         // 动态查询条件:订单号模糊查询
         if (StringUtils.isNotEmpty(orderId)) {
-            queryWrapper.like("luv.order_id", orderId);
+            queryWrapper.like("luv.order_number", orderId);
+        }
+
+        // 动态查询条件:举报人手机号精确匹配
+        if (StringUtils.isNotEmpty(phone)) {
+            queryWrapper.eq("ui.phone", phone);
         }
 
         // 动态查询条件:处理状态精确匹配
@@ -850,11 +877,26 @@ public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolat
             queryWrapper.like("ui_reported.nick_name", reportedUserName);
         }
 
+        // 动态查询条件:被举报人手机号精确匹配
+        if (StringUtils.isNotEmpty(reportedPhone)) {
+            queryWrapper.eq("ui_reported.phone", reportedPhone);
+        }
+
         // 动态查询条件:违规原因精确匹配
         if (StringUtils.isNotEmpty(violationReason)) {
             queryWrapper.eq("luv.violation_reason", violationReason);
         }
 
+        // 动态查询条件:开始时间范围查询(大于等于)
+        if (StringUtils.isNotEmpty(startTime)) {
+            queryWrapper.ge("luv.created_time", startTime);
+        }
+
+        // 动态查询条件:结束时间范围查询(小于等于)
+        if (StringUtils.isNotEmpty(endTime)) {
+            queryWrapper.le("luv.created_time", endTime);
+        }
+
         // 排序:按更新时间倒序
         queryWrapper.orderByDesc("luv.updated_time");