jyc 3 months ago
parent
commit
b39fc65f5d

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

@@ -58,7 +58,7 @@ public interface StoreCommentAppealMapper extends BaseMapper<StoreCommentAppeal>
     @Select("select a.*, b.dict_detail appeal_status_str, c.comment_content, c.score, c.other_score, a.created_time comment_time, c.comment_star,c.img_id 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' " +
-            "left join store_comment c on a.comment_id = c.id  and c.delete_flag = 0 " +
+            "left join store_comment 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}")
     StoreCommentAppealVo getCommentDetail(@Param(Constants.WRAPPER) QueryWrapper<StoreCommentAppealVo> queryWrapper);

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

@@ -8,8 +8,10 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.common.collect.Lists;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
@@ -26,6 +28,9 @@ import shop.alien.mapper.*;
 import shop.alien.store.service.StoreCommentAppealService;
 import shop.alien.store.util.FileUploadUtil;
 import shop.alien.util.common.netease.TextCheckUtil;
+import shop.alien.util.common.safe.TextModerationResultVO;
+import shop.alien.util.common.safe.TextModerationUtil;
+import shop.alien.util.common.safe.TextReviewServiceEnum;
 
 import java.net.URLEncoder;
 import java.util.*;
@@ -54,6 +59,9 @@ public class StoreCommentAppealServiceImpl extends ServiceImpl<StoreCommentAppea
 
     private final StoreDictionaryMapper storeDictionaryMapper;
 
+    @Autowired
+    private TextModerationUtil textModerationUtil;
+
     /**
      * 懒得查, 留着导出Excel
      */
@@ -116,10 +124,19 @@ public class StoreCommentAppealServiceImpl extends ServiceImpl<StoreCommentAppea
     @Override
     public Integer addAppeal(MultipartRequest multipartRequest, Integer storeId, Integer commentId, String appealReason) {
         try {
-            Map<String, String> checkText = TextCheckUtil.check(appealReason);
+            /*Map<String, String> checkText = TextCheckUtil.check(appealReason);
             if (null == checkText || checkText.get("result").equals("1")) {
                 return 3;
+            }*/
+
+            List<String> servicesList = Lists.newArrayList();
+            servicesList.add(TextReviewServiceEnum.COMMENT_DETECTION_PRO.getService());
+            servicesList.add(TextReviewServiceEnum.LLM_QUERY_MODERATION.getService());
+            TextModerationResultVO textCheckResult = textModerationUtil.invokeFunction(appealReason, servicesList);
+            if ("high".equals(textCheckResult.getRiskLevel())) {
+                return 3;
             }
+
             List<String> fileNameSet = new ArrayList<>(multipartRequest.getMultiFileMap().keySet());
             LambdaQueryWrapper<StoreCommentAppeal> wrapper = new LambdaQueryWrapper<>();
             //待审批, 已通过
@@ -131,9 +148,9 @@ public class StoreCommentAppealServiceImpl extends ServiceImpl<StoreCommentAppea
                     .in(StoreCommentAppeal::getAppealStatus, list)
                     .orderByDesc(StoreCommentAppeal::getCreatedTime)
                     .last("limit 1");
-            if (this.getOne(wrapper) != null) {
+            /*if (this.getOne(wrapper) != null) {
                 return 2;
-            }
+            }*/
             StoreCommentAppeal storeCommentAppeal = new StoreCommentAppeal();
             StringBuilder imgId = new StringBuilder();
             for (int i = 0; i < fileNameSet.size(); i++) {
@@ -270,7 +287,7 @@ public class StoreCommentAppealServiceImpl extends ServiceImpl<StoreCommentAppea
     @Override
     public StoreCommentAppealVo getStoreCommentAppealDetail(Integer id) {
         QueryWrapper<StoreCommentAppealVo> storeCommentAppealVoQueryWrapper = new QueryWrapper<>();
-        storeCommentAppealVoQueryWrapper.eq("a.id", id).eq("a.delete_flag", 0);
+        storeCommentAppealVoQueryWrapper.eq("a.id", id);
         StoreCommentAppealVo commentDetail = storeCommentAppealMapper.getCommentDetail(storeCommentAppealVoQueryWrapper);
 
         String[] split = commentDetail.getImgId().split(",");