|
|
@@ -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(",");
|