qxy 3 тижнів тому
батько
коміт
8b0a1a8c97

+ 3 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/CommentAppealVo.java

@@ -87,6 +87,9 @@ public class CommentAppealVo implements Serializable {
     @ApiModelProperty(value = "评价用户名称")
     private String reviewUserName;
 
+    @ApiModelProperty(value = "用户名称")
+    private String userName;
+
     @ApiModelProperty(value = "评价用户头像")
     private String reviewUserAvatar;
 

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

@@ -21,11 +21,11 @@ public interface CommentAppealMapper extends BaseMapper<CommentAppeal> {
      * 查询申诉历史列表(包含评价和用户信息)
      *
      * @param status    申诉状态
-     * @param userId 律师用户ID
+     * @param lawyerUserId 律师用户ID
      * @return 申诉历史列表
      */
     List<CommentAppealVo> getAppealHistoryList(@Param("status") Integer status,
-                                                @Param("userId") Integer userId);
+                                                @Param("lawyerUserId") Integer lawyerUserId);
 
     /**
      * 根据ID查询申诉详情(包含评价和用户信息)

+ 6 - 5
alien-entity/src/main/resources/mapper/CommentAppealMapper.xml

@@ -36,6 +36,7 @@
         <!-- 评价相关信息 -->
         <result column="review_user_id" property="reviewUserId" />
         <result column="review_user_name" property="reviewUserName" />
+        <result column="user_name" property="userName" />
         <result column="review_user_avatar" property="reviewUserAvatar" />
         <result column="overall_rating" property="overallRating" />
         <result column="service_attitude_rating" property="serviceAttitudeRating" />
@@ -73,7 +74,7 @@
             CASE
                 WHEN orv.is_anonymous = 1 THEN '匿名用户'
                 ELSE lu.user_name
-            END AS review_user_name,
+            END AS user_name,
             CASE
                 WHEN orv.is_anonymous = 1 THEN NULL
                 ELSE lu.user_image
@@ -86,13 +87,13 @@
             orv.created_time AS review_time,
             orv.review_images
         FROM comment_appeals ca
-        LEFT JOIN lawyer_order_review orv ON orv.id = ca.comment_id AND orv.delete_flag = 0
+        LEFT JOIN lawyer_order_review orv ON orv.id = ca.comment_id
         LEFT JOIN life_user lu ON lu.id = orv.user_id AND lu.delete_flag = 0
         WHERE ca.delete_flag = 0
         <if test="status != null">
             AND ca.status = #{status}
         </if>
-        <if test="userId != null">
+        <if test="lawyerUserId != null">
             AND orv.lawyer_user_id = #{lawyerUserId}
         </if>
         ORDER BY ca.appeal_time DESC
@@ -161,7 +162,7 @@
             CASE
                 WHEN orv.is_anonymous = 1 THEN '匿名用户'
                 ELSE lu.user_name
-            END AS userName,
+            END AS user_name,
             CASE
                 WHEN orv.is_anonymous = 1 THEN NULL
                 ELSE lu.user_image
@@ -178,7 +179,7 @@
             orv.created_time AS review_time,
             orv.review_images
         FROM comment_appeals ca
-        LEFT JOIN lawyer_order_review orv ON orv.id = ca.comment_id AND orv.delete_flag = 0
+        LEFT JOIN lawyer_order_review orv ON orv.id = ca.comment_id
         LEFT JOIN life_user lu ON lu.id = orv.user_id AND lu.delete_flag = 0
         LEFT JOIN lawyer_user lu2 ON lu2.id = orv.lawyer_user_id AND lu2.delete_flag = 0
         WHERE ca.delete_flag = 0

+ 3 - 3
alien-lawyer/src/main/java/shop/alien/lawyer/controller/CommentAppealController.java

@@ -108,12 +108,12 @@ public class CommentAppealController {
             @ApiImplicitParam(name = "pageNum", value = "页数(默认1)", dataType = "int", paramType = "query"),
             @ApiImplicitParam(name = "pageSize", value = "页容(默认10)", dataType = "int", paramType = "query"),
             @ApiImplicitParam(name = "status", value = "申诉状态:0-待处理,1-已通过,2-已驳回", dataType = "Integer", paramType = "query"),
-            @ApiImplicitParam(name = "userId", value = "律师用户ID", dataType = "Integer", paramType = "query")
+            @ApiImplicitParam(name = "lawyerUserId", value = "律师用户ID", dataType = "Integer", paramType = "query")
     })
     @GetMapping("/getAppealHistory")
     public R<List<CommentAppealVo>> getAppealHistory(
-            @RequestParam(defaultValue = "1") int pageNum,
-            @RequestParam(defaultValue = "10") int pageSize,
+            @RequestParam int pageNum,
+            @RequestParam int pageSize,
             @RequestParam(required = false) Integer status,
             @RequestParam(required = false) Integer lawyerUserId) {
         log.info("CommentAppealController.getAppealHistory?pageNum={}, pageSize={}, status={}, lawyerUserId={}",

+ 57 - 1
alien-lawyer/src/main/java/shop/alien/lawyer/service/impl/CommentAppealServiceImpl.java

@@ -47,6 +47,7 @@ public class CommentAppealServiceImpl extends ServiceImpl<CommentAppealMapper, C
     private final LifeUserMapper lifeUserMapper;
     private final LawyerUserMapper lawyerUserMapper;
 
+
     @Override
     public R<CommentAppeal> submitAppeal(CommentAppeal commentAppeal) {
         log.info("CommentAppealServiceImpl.submitAppeal?commentAppeal={}", commentAppeal);
@@ -79,6 +80,10 @@ public class CommentAppealServiceImpl extends ServiceImpl<CommentAppealMapper, C
         boolean result = this.save(commentAppeal);
         if (result) {
             log.info("提交申诉成功,id={}", commentAppeal.getId());
+            
+            // 发送通知给评价用户,告知其评价被申诉了
+            sendSubmitAppealNotification(commentAppeal);
+            
             return R.data(commentAppeal, "申诉提交成功");
         } else {
             return R.fail("申诉提交失败");
@@ -159,6 +164,57 @@ public class CommentAppealServiceImpl extends ServiceImpl<CommentAppealMapper, C
     }
 
     /**
+     * 发送提交申诉通知(给评价用户)
+     *
+     * @param appeal 申诉记录
+     */
+    private void sendSubmitAppealNotification(CommentAppeal appeal) {
+        try {
+            // 查询律师用户信息
+            LambdaQueryWrapper<LawyerUser> lawyerUser = new LambdaQueryWrapper<>();
+            lawyerUser.eq(LawyerUser :: getId, appeal.getLawyerUserId());
+            LawyerUser lifeUser = lawyerUserMapper.selectOne(lawyerUser);
+            if (lifeUser == null) {
+                log.warn("评价用户不存在,userId={}", lifeUser.getId());
+                return;
+            }
+            LambdaQueryWrapper<OrderReview> orderReviewLambdaQueryWrapper = new LambdaQueryWrapper<>();
+            orderReviewLambdaQueryWrapper.eq(OrderReview ::  getId, appeal.getCommentId());
+            OrderReview orderReview = orderReviewMapper.selectOne(orderReviewLambdaQueryWrapper);
+            String orderNumber = "";
+            if(orderReview != null){
+                orderNumber = orderReview.getOrderNumber();
+            }
+            String receiverId = "user_" + lifeUser.getPhone();
+            String message = String.format("您提交的差评申诉信息,订单编号为"+ orderNumber +",已提交至平台审核,1-3个工作日会发送您审核结果,请注意查收。触发条件:提交信息成功。");
+
+            LifeNotice lifeNotice = new LifeNotice();
+            lifeNotice.setReceiverId(receiverId);
+            lifeNotice.setBusinessId(appeal.getId());
+            lifeNotice.setTitle("申诉通知");
+            lifeNotice.setSenderId("system");
+            lifeNotice.setIsRead(0);
+            lifeNotice.setNoticeType(1);
+            lifeNotice.setDeleteFlag(0);
+
+            com.alibaba.fastjson2.JSONObject jsonObject = new com.alibaba.fastjson2.JSONObject();
+            jsonObject.put("message", message);
+            jsonObject.put("orderNumber", orderReview.getOrderNumber());
+            jsonObject.put("appealId", appeal.getId());
+            jsonObject.put("status", "pending"); // 待审核状态
+            lifeNotice.setContext(jsonObject.toJSONString());
+
+            lifeNoticeMapper.insert(lifeNotice);
+
+            // 发送 WebSocket 消息
+            sendWebSocketNotification(receiverId, lifeNotice);
+            log.info("提交申诉通知发送成功,receiverId={}, appealId={}", receiverId, appeal.getId());
+        } catch (Exception e) {
+            log.error("发送提交申诉通知失败,appealId={}, error={}", appeal.getId(), e.getMessage(), e);
+        }
+    }
+
+    /**
      * 发送审核通知
      *
      * @param appeal      申诉记录
@@ -471,7 +527,7 @@ public class CommentAppealServiceImpl extends ServiceImpl<CommentAppealMapper, C
 
     @Override
     public List<CommentAppealVo> getAppealHistory(Integer pageNum, Integer pageSize, Integer status, Integer lawyerUserId) {
-        log.info("CommentAppealServiceImpl.getAppealHistory?pageNum={}, pageSize={}, status={}, userId={}",
+        log.info("CommentAppealServiceImpl.getAppealHistory?pageNum={}, pageSize={}, status={}, lawyerUserId={}",
                 pageNum, pageSize, status, lawyerUserId);
         List<CommentAppealVo> appealList = new ArrayList<>();
         //status 3 查全部