Pārlūkot izejas kodu

Fix:店铺评价申诉通过后申诉页面数据还展示

panzhilin 2 mēneši atpakaļ
vecāks
revīzija
b0486ab926

+ 10 - 6
alien-entity/src/main/java/shop/alien/mapper/StoreCommentAppealMapper.java

@@ -24,6 +24,7 @@ public interface StoreCommentAppealMapper extends BaseMapper<StoreCommentAppeal>
     /**
      * 申诉历史-分页查询
      * 注意:comment_id 关联的是 common_rating.id(评价ID),不是 store_comment.id
+     * 注意:common_rating 表不加 delete_flag = 0 条件,以便申诉通过后仍能显示评价快照数据
      *
      * @param page         分页参数
      * @param queryWrapper 查询条件
@@ -32,7 +33,7 @@ public interface StoreCommentAppealMapper extends BaseMapper<StoreCommentAppeal>
     @Select("select a.*, b.dict_detail appeal_status_str, c.content comment_content, c.score comment_star, c.score score, c.other_score, c.is_anonymous, c.image_urls commentImgId, d.user_name, d.user_image, e.store_name, f.phone store_phone, f.name store_contact, e.store_type " +
             "from store_comment_appeal a " +
             "left join store_dictionary b on a.appeal_status = b.dict_id and b.type_name = 'appealStatus' and b.delete_flag = 0 " +
-            "left join common_rating c on a.comment_id = c.id and c.delete_flag = 0 " +
+            "left join common_rating c on a.comment_id = c.id " +
             "left join life_user d on c.user_id = d.id and d.delete_flag = 0 " +
             "left join store_info e on a.store_id = e.id and e.delete_flag = 0 " +
             "Left join store_user f on e.id = f.store_id and f.delete_flag = 0 ${ew.customSqlSegment}")
@@ -41,14 +42,15 @@ public interface StoreCommentAppealMapper extends BaseMapper<StoreCommentAppeal>
     /**
      * 申诉历史-全部查询
      * 注意:comment_id 关联的是 common_rating.id(评价ID),不是 store_comment.id
+     * 注意:common_rating 表不加 delete_flag = 0 条件,以便申诉通过后仍能显示评价快照数据
      *
      * @param queryWrapper 查询条件
      * @return List<StoreCommentAppealVo>
      */
     @Select("select a.*, b.dict_detail appeal_status_str, c.content comment_content, c.score comment_star, d.user_name, d.user_image, e.store_name, f.phone store_phone, f.name store_contact, e.store_type from store_comment_appeal a " +
             "left join store_dictionary b on a.appeal_status = b.dict_id and b.type_name = 'appealStatus' and b.delete_flag = 0 " +
-            "left join common_rating c on a.comment_id = c.id and c.delete_flag = 0 " +
-            "left join life_user d on c.user_id = d.id  and d.delete_flag = 0 " +
+            "left join common_rating c on a.comment_id = c.id " +
+            "left join life_user d on c.user_id = d.id and d.delete_flag = 0 " +
             "left join store_info e on a.store_id = e.id and e.delete_flag = 0 " +
             "Left join store_user f on e.id = f.store_id and f.delete_flag = 0 ${ew.customSqlSegment}")
     List<StoreCommentAppealVo> getStoreCommentAppealPage(@Param(Constants.WRAPPER) QueryWrapper<StoreCommentAppealVo> queryWrapper);
@@ -56,6 +58,7 @@ public interface StoreCommentAppealMapper extends BaseMapper<StoreCommentAppeal>
     /**
      * 申诉详情
      * 注意:comment_id 关联的是 common_rating.id(评价ID),不是 store_comment.id
+     * 注意:common_rating 表不加 delete_flag = 0 条件,以便申诉通过后仍能显示评价快照数据
      *
      * @param queryWrapper 查询条件
      * @return StoreCommentAppealVo
@@ -63,21 +66,22 @@ public interface StoreCommentAppealMapper extends BaseMapper<StoreCommentAppeal>
     @Select("select a.*, b.dict_detail appeal_status_str, c.content comment_content, c.score, c.other_score, a.created_time comment_time, c.score comment_star, c.is_anonymous, c.image_urls commentImgId, d.user_name, e.phone store_phone, d.user_name userName, d.user_image userImage " +
             "from store_comment_appeal a " +
             "left join store_dictionary b on a.appeal_status = b.dict_id and b.type_name = 'appealStatus' and b.delete_flag = 0 " +
-            "left join common_rating c on a.comment_id = c.id and c.delete_flag = 0 " +
+            "left join common_rating c on a.comment_id = c.id " +
             "left join life_user d on c.user_id = d.id and d.delete_flag = 0 " +
-            "left join store_user e on a.store_id = e.store_id and e.delete_flag = 0  ${ew.customSqlSegment}")
+            "left join store_user e on a.store_id = e.store_id and e.delete_flag = 0 ${ew.customSqlSegment}")
     StoreCommentAppealVo getCommentDetail(@Param(Constants.WRAPPER) QueryWrapper<StoreCommentAppealVo> queryWrapper);
 
 
     /**
      * 申诉列表(平台端使用)
      * 注意:comment_id 关联的是 common_rating.id(评价ID),不是 store_comment.id
+     * 注意:common_rating 表不加 delete_flag = 0 条件,以便申诉通过后仍能显示评价快照数据
      *
      * @return List<Map < String, Object>>
      */
     @Select("SELECT sca.id, sca.appeal_reason, sca.appeal_status, cr.content comment_content, si.img_url, cr.image_urls user_img_url, cr.id comment_id, cr.business_id " +
             "FROM store_comment_appeal sca " +
-            "LEFT JOIN common_rating cr ON sca.comment_id = cr.id AND cr.delete_flag = 0 " +
+            "LEFT JOIN common_rating cr ON sca.comment_id = cr.id " +
             "LEFT JOIN store_img si ON sca.img_id = si.id " +
             "WHERE sca.appeal_status = 0 and record_id is null AND sca.delete_flag = 0")
     List<Map<String, Object>> getAppealList();

+ 3 - 4
alien-store/src/main/java/shop/alien/store/service/impl/StoreCommentAppealServiceImpl.java

@@ -529,10 +529,9 @@ public class StoreCommentAppealServiceImpl extends ServiceImpl<StoreCommentAppea
                     }
                 }
                 
-                // 7. 删除申诉记录(逻辑删除)
-                byId.setDeleteFlag(1);
-                byId.setUpdatedTime(new Date());
-                this.updateById(byId);
+                // 7. 不删除申诉记录,保留以便申诉历史能显示已通过的记录
+                // 申诉记录保留,只更新状态为"已同意",评价快照数据仍可在申诉历史中查看
+                log.info("申诉审核通过,保留申诉记录,申诉ID={},评价ID={}", id, ratingId);
                 break;
         }
         //商家申诉