소스 검색

举报新增接口,返回举报及订单信息

zhangchen 1 주 전
부모
커밋
63f3abd490

+ 168 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/LawyerViolationDetailVO.java

@@ -0,0 +1,168 @@
+package shop.alien.entity.store.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 律师举报详情VO(包含举报信息、订单信息、律师信息)
+ *
+ * @author system
+ * @since 2025-01-XX
+ */
+@Data
+@ApiModel(value = "LawyerViolationDetailVO对象", description = "律师举报详情VO(包含举报信息、订单信息、律师信息)")
+public class LawyerViolationDetailVO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    // ========== 举报信息 ==========
+    @ApiModelProperty(value = "举报ID")
+    private Integer violationId;
+
+    @ApiModelProperty(value = "订单号")
+    private String orderNumber;
+
+    @ApiModelProperty(value = "举报原因")
+    private String violationReason;
+
+    @ApiModelProperty(value = "其他原因具体内容")
+    private String otherReasonContent;
+
+    @ApiModelProperty(value = "举报凭证图片")
+    private String reportEvidenceImg;
+
+    @ApiModelProperty(value = "处理状态(0:未处理,1:违规,2:未违规)")
+    private String processingStatus;
+
+    @ApiModelProperty(value = "处理时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date processingTime;
+
+    @ApiModelProperty(value = "举报结果")
+    private String reportResult;
+
+    @ApiModelProperty(value = "举报创建时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date violationCreatedTime;
+
+    @ApiModelProperty(value = "举报用户ID")
+    private String reportingUserId;
+
+    @ApiModelProperty(value = "举报用户姓名")
+    private String reportingUserName;
+
+    @ApiModelProperty(value = "被举报用户ID")
+    private String reportedUserId;
+
+    // ========== 订单信息 ==========
+    @ApiModelProperty(value = "订单ID")
+    private Integer orderId;
+
+    @ApiModelProperty(value = "客户端用户ID")
+    private Integer clientUserId;
+
+    @ApiModelProperty(value = "问题描述")
+    private String problemDescription;
+
+    @ApiModelProperty(value = "订单金额,单位分")
+    private Integer orderAmount;
+
+    @ApiModelProperty(value = "咨询费用,单位分")
+    private Integer consultationFee;
+
+    @ApiModelProperty(value = "咨询开始时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date startTime;
+
+    @ApiModelProperty(value = "咨询结束时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date endTime;
+
+    @ApiModelProperty(value = "订单状态, 0:待支付,1.待接单 2:进行中, 3:已完成, 4:已取消,5.已退款")
+    private Integer orderStatus;
+
+    @ApiModelProperty(value = "支付状态, 0:未支付, 1:已支付")
+    private Integer paymentStatus;
+
+    @ApiModelProperty(value = "下单时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date orderTime;
+
+    @ApiModelProperty(value = "支付时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date paymentTime;
+
+    @ApiModelProperty(value = "用户评分, 1-5星")
+    private Integer rating;
+
+    @ApiModelProperty(value = "用户评价内容")
+    private String comment;
+
+    // ========== 律师信息 ==========
+    @ApiModelProperty(value = "律师用户ID")
+    private Integer lawyerUserId;
+
+    @ApiModelProperty(value = "律师姓名")
+    private String lawyerName;
+
+    @ApiModelProperty(value = "律师手机号")
+    private String lawyerPhone;
+
+    @ApiModelProperty(value = "律师邮箱")
+    private String lawyerEmail;
+
+    @ApiModelProperty(value = "律师执业证号")
+    private String lawyerCertificateNo;
+
+    @ApiModelProperty(value = "所属律师事务所")
+    private String lawFirm;
+
+    @ApiModelProperty(value = "执业年限")
+    private Integer practiceYears;
+
+    @ApiModelProperty(value = "专业领域,多个用逗号分隔")
+    private String specialtyFields;
+
+    @ApiModelProperty(value = "资质认证状态, 0:未认证, 1:认证中, 2:已认证, 3:认证失败")
+    private Integer certificationStatus;
+
+    @ApiModelProperty(value = "服务评分, 0-5分")
+    private Double serviceScore;
+
+    @ApiModelProperty(value = "服务次数")
+    private Integer serviceCount;
+
+    @ApiModelProperty(value = "咨询收费标准(单位分/小时)")
+    private Integer lawyerConsultationFee;
+
+    @ApiModelProperty(value = "所属省份")
+    private String province;
+
+    @ApiModelProperty(value = "所属城市")
+    private String city;
+
+    @ApiModelProperty(value = "所属区县")
+    private String district;
+
+    @ApiModelProperty(value = "详细地址")
+    private String address;
+
+    @ApiModelProperty(value = "律师头像")
+    private String headImg;
+
+    @ApiModelProperty(value = "律师昵称")
+    private String nickName;
+
+    @ApiModelProperty(value = "个人简介(详细)")
+    private String personalIntroduction;
+
+    @ApiModelProperty(value = "律所名称")
+    private String firmName;
+
+}
+

+ 70 - 0
alien-entity/src/main/java/shop/alien/mapper/LawyerConsultationOrderMapper.java

@@ -8,6 +8,7 @@ import org.apache.ibatis.annotations.*;
 import org.apache.ibatis.annotations.Param;
 import shop.alien.entity.store.LawyerConsultationOrder;
 import shop.alien.entity.store.vo.LawyerConsultationOrderVO;
+import shop.alien.entity.store.vo.LawyerViolationDetailVO;
 import shop.alien.entity.store.dto.LawyerConsultationOrderDto;
 
 import java.util.List;
@@ -602,5 +603,74 @@ public interface LawyerConsultationOrderMapper extends BaseMapper<LawyerConsulta
             "AND order_status = 5")
     Map<String, Object> getRefundedStatistics(@Param("lawyerUserId") Integer lawyerUserId);
 
+    /**
+     * 根据订单ID查询举报详情(包含举报信息、订单信息、律师信息)
+     *
+     * @param orderId 订单ID
+     * @return 举报详情VO
+     */
+    @Select("SELECT " +
+            "luv.id AS violationId, " +
+            "luv.order_number, " +
+            "luv.violation_reason, " +
+            "luv.other_reason_content, " +
+            "luv.report_evidence_img, " +
+            "luv.processing_status, " +
+            "luv.processing_time, " +
+            "luv.report_result, " +
+            "luv.created_time AS violationCreatedTime, " +
+            "luv.reporting_user_id, " +
+            "luv.reported_user_id, " +
+            "lco.id AS orderId, " +
+            "lco.client_user_id, " +
+            "lco.problem_description, " +
+            "lco.order_amount, " +
+            "lco.consultation_fee, " +
+            "lco.start_time, " +
+            "lco.end_time, " +
+            "lco.order_status, " +
+            "lco.payment_status, " +
+            "lco.order_time, " +
+            "lco.payment_time, " +
+            "lco.rating, " +
+            "lco.comment, " +
+            "lco.lawyer_user_id, " +
+            "lu.name AS lawyerName, " +
+            "lu.phone AS lawyerPhone, " +
+            "lu.email AS lawyerEmail, " +
+            "lu.lawyer_certificate_no, " +
+            "lu.law_firm, " +
+            "lu.practice_years, " +
+            "lu.specialty_fields, " +
+            "lu.certification_status, " +
+            "lu.service_score, " +
+            "lu.service_count, " +
+            "lu.consultation_fee AS lawyerConsultationFee, " +
+            "lu.province, " +
+            "lu.city, " +
+            "lu.district, " +
+            "lu.address, " +
+            "lu.head_img, " +
+            "lu.nick_name, " +
+            "lu.personal_introduction, " +
+            "lf.firm_name " +
+            "FROM lawyer_consultation_order lco " +
+            "LEFT JOIN (" +
+            "    SELECT luv1.* " +
+            "    FROM lawyer_user_violation luv1 " +
+            "    INNER JOIN (" +
+            "        SELECT order_number, MAX(id) as max_id " +
+            "        FROM lawyer_user_violation " +
+            "        WHERE delete_flag = 0 " +
+            "        GROUP BY order_number" +
+            "    ) luv2 ON luv1.order_number = luv2.order_number AND luv1.id = luv2.max_id " +
+            "    WHERE luv1.delete_flag = 0" +
+            ") luv ON luv.order_number = lco.order_number " +
+            "LEFT JOIN lawyer_user lu ON lco.lawyer_user_id = lu.id AND lu.delete_flag = 0 " +
+            "LEFT JOIN law_firm lf ON lf.id = lu.firm_id " +
+            "WHERE lco.id = #{orderId} AND lco.delete_flag = 0 " +
+            "LIMIT 1")
+    LawyerViolationDetailVO getViolationDetailByOrderId(@Param("orderId") Integer orderId);
+
 }
 

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

@@ -11,6 +11,7 @@ import shop.alien.entity.store.LawyerUserViolation;
 import shop.alien.entity.store.StoreDictionary;
 import shop.alien.entity.store.dto.LawyerUserViolationDto;
 import shop.alien.entity.store.vo.LawyerUserViolationVo;
+import shop.alien.entity.store.vo.LawyerViolationDetailVO;
 import shop.alien.lawyer.service.LawyerUserViolationService;
 
 import java.util.List;
@@ -223,5 +224,51 @@ public class LawyerUserViolationController {
         }
     }
 
+    /**
+     * 根据订单ID查询举报详情
+     * <p>
+     * 查询举报详情信息,包括举报的详情信息、订单的详情信息以及订单律师名字相关信息
+     * </p>
+     *
+     * @param orderId 订单ID,必须大于0
+     * @return 统一响应结果,包含举报详情VO对象(包含举报信息、订单信息、律师信息)
+     * @author system
+     * @since 2025-01-XX
+     */
+    @ApiOperation(value = "根据订单ID查询举报详情", notes = "查询举报详情信息,包括举报的详情信息、订单的详情信息以及订单律师名字相关信息")
+    @ApiOperationSupport(order = 9)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "orderId", value = "订单ID", dataType = "Integer", paramType = "query", required = true)
+    })
+    @GetMapping("/getViolationDetailByOrderId")
+    public R<LawyerViolationDetailVO> getViolationDetailByOrderId(
+            @RequestParam(value = "orderId", required = true) Integer orderId) {
+        log.info("根据订单ID查询举报详情请求,orderId={}", orderId);
+
+        // 参数校验
+        if (orderId == null || orderId <= 0) {
+            log.warn("根据订单ID查询举报详情失败:订单ID为空或无效,orderId={}", orderId);
+            return R.fail("订单ID不能为空");
+        }
+
+        try {
+            LawyerViolationDetailVO detailVO = lawyerUserViolationService.getViolationDetailByOrderId(orderId);
+            if (detailVO == null) {
+                log.warn("根据订单ID查询举报详情:订单不存在或未举报,orderId={}", orderId);
+                return R.fail("订单不存在或未举报");
+            }
+
+            log.info("根据订单ID查询举报详情成功,orderId={}", orderId);
+            return R.data(detailVO);
+
+        } catch (RuntimeException e) {
+            log.warn("根据订单ID查询举报详情业务异常,orderId={},异常信息:{}", orderId, e.getMessage());
+            return R.fail(e.getMessage());
+        } catch (Exception e) {
+            log.error("根据订单ID查询举报详情异常,orderId={},异常信息:{}", orderId, e.getMessage(), e);
+            return R.fail("查询举报详情失败,请稍后重试");
+        }
+    }
+
 }
 

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

@@ -7,6 +7,7 @@ import shop.alien.entity.store.StoreDictionary;
 import shop.alien.entity.store.UserLoginInfo;
 import shop.alien.entity.store.dto.LawyerUserViolationDto;
 import shop.alien.entity.store.vo.LawyerUserViolationVo;
+import shop.alien.entity.store.vo.LawyerViolationDetailVO;
 
 import java.io.IOException;
 import java.util.List;
@@ -69,5 +70,18 @@ public interface LawyerUserViolationService extends IService<LawyerUserViolation
      * @since 2025-01-XX
      */
     List<StoreDictionary> getViolationReason();
+
+    /**
+     * 根据订单ID查询举报详情
+     * <p>
+     * 查询举报详情信息,包括举报的详情信息、订单的详情信息以及订单律师名字相关信息
+     * </p>
+     *
+     * @param orderId 订单ID,必须大于0
+     * @return 举报详情VO对象,包含举报信息、订单信息、律师信息,如果订单不存在或未举报则返回null
+     * @author system
+     * @since 2025-01-XX
+     */
+    LawyerViolationDetailVO getViolationDetailByOrderId(Integer orderId);
 }
 

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

@@ -17,6 +17,7 @@ import org.springframework.util.CollectionUtils;
 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.LawyerViolationDetailVO;
 import shop.alien.entity.store.vo.WebSocketVo;
 import shop.alien.mapper.*;
 import shop.alien.lawyer.config.WebSocketProcess;
@@ -1471,5 +1472,93 @@ public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolat
             throw new RuntimeException("查询举报原因列表失败:" + e.getMessage(), e);
         }
     }
+
+    /**
+     * 根据订单ID查询举报详情
+     * <p>
+     * 查询举报详情信息,包括举报的详情信息、订单的详情信息以及订单律师名字相关信息
+     * </p>
+     *
+     * @param orderId 订单ID,必须大于0
+     * @return 举报详情VO对象,包含举报信息、订单信息、律师信息,如果订单不存在或未举报则返回null
+     * @author system
+     * @since 2025-01-XX
+     */
+    @Override
+    public LawyerViolationDetailVO getViolationDetailByOrderId(Integer orderId) {
+        log.info("根据订单ID查询举报详情开始,orderId={}", orderId);
+
+        // 参数校验
+        if (orderId == null || orderId <= 0) {
+            log.warn("根据订单ID查询举报详情失败:订单ID为空或无效,orderId={}", orderId);
+            return null;
+        }
+
+        try {
+            // 查询举报详情
+            LawyerViolationDetailVO detailVO = consultationOrderMapper.getViolationDetailByOrderId(orderId);
+            if (detailVO == null) {
+                log.warn("根据订单ID查询举报详情:订单不存在,orderId={}", orderId);
+                return null;
+            }
+
+            // 检查是否存在举报信息(如果violationId为null,说明没有举报记录)
+            if (detailVO.getViolationId() == null) {
+                log.warn("根据订单ID查询举报详情:订单存在但没有举报信息,orderId={}", orderId);
+                return null;
+            }
+
+            // 查询举报人姓名
+            if (StringUtils.isNotEmpty(detailVO.getReportingUserId())) {
+                String reportingUserName = getReportingUserNameById(detailVO.getReportingUserId());
+                detailVO.setReportingUserName(reportingUserName);
+            }
+
+            log.info("根据订单ID查询举报详情成功,orderId={}, violationId={}", orderId, detailVO.getViolationId());
+            return detailVO;
+
+        } catch (Exception e) {
+            log.error("根据订单ID查询举报详情异常,orderId={},异常信息:{}", orderId, e.getMessage(), e);
+            throw new RuntimeException("查询举报详情失败:" + e.getMessage(), e);
+        }
+    }
+
+    /**
+     * 根据用户ID获取举报人姓名
+     *
+     * @param userId 用户ID
+     * @return 用户姓名,如果用户不存在返回null
+     */
+    private String getReportingUserNameById(String userId) {
+        if (StringUtils.isEmpty(userId)) {
+            return null;
+        }
+
+        try {
+            // 查询举报人信息(可能是律师、商户或普通用户)
+            // 先尝试查询律师用户
+            LawyerUser lawyerUser = lawyerUserMapper.selectById(userId);
+            if (lawyerUser != null) {
+                return lawyerUser.getName();
+            }
+
+            // 查询商户用户
+            StoreUser storeUser = storeUserMapper.selectById(userId);
+            if (storeUser != null) {
+                return storeUser.getNickName();
+            }
+
+            // 查询普通用户
+            LifeUser lifeUser = lifeUserMapper.selectById(userId);
+            if (lifeUser != null) {
+                return lifeUser.getUserName();
+            }
+
+            return null;
+        } catch (Exception e) {
+            log.error("获取举报人姓名异常,userId={},异常信息:{}", userId, e.getMessage(), e);
+            return null;
+        }
+    }
 }