|
|
@@ -21,6 +21,7 @@ import shop.alien.entity.store.LifeUserViolation;
|
|
|
import shop.alien.entity.store.vo.LifeUserVo;
|
|
|
import shop.alien.mapper.LifeMessageMapper;
|
|
|
import shop.alien.mapper.LifeUserMapper;
|
|
|
+import shop.alien.mapper.LifeUserViolationMapper;
|
|
|
import shop.alien.mapper.second.SecondGoodsMapper;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
@@ -48,12 +49,14 @@ public class AiUserViolationUtils {
|
|
|
@Value("${third-party-pass-word.base-url:123456}")
|
|
|
private String passWord;
|
|
|
|
|
|
- @Value("${third-party-userComplaintRecordUrl.base-url}")
|
|
|
+ @Value("${third-party-ai.report-review.base-url}")
|
|
|
private String userComplaintRecordUrl;
|
|
|
|
|
|
- @Value("${third-party-goodsComplaintRecordUrl.base-url:${third-party-userComplaintRecordUrl.base-url}}")
|
|
|
+ @Value("${third-party-ai.report-review.base-url}")
|
|
|
private String goodsComplaintRecordUrl;
|
|
|
|
|
|
+ private final LifeUserViolationMapper lifeUserViolationMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 登录 AI 服务,获取 token
|
|
|
*
|
|
|
@@ -112,37 +115,36 @@ public class AiUserViolationUtils {
|
|
|
analyzeHeaders.set("Authorization", "Bearer " + accessToken);
|
|
|
|
|
|
Map<String, Object> analyzeRequest = new HashedMap<>();
|
|
|
- // 对应参数
|
|
|
- if (1 == lifeuserViolation.getDictId()){
|
|
|
- analyzeRequest.put("complaint_type", "用户违规");
|
|
|
- } else if (2 == lifeuserViolation.getDictId()){
|
|
|
- analyzeRequest.put("complaint_type", "色情低俗");
|
|
|
- } else if (3 == lifeuserViolation.getDictId()){
|
|
|
- analyzeRequest.put("complaint_type", "违法违规");
|
|
|
- } else if (4 == lifeuserViolation.getDictId()){
|
|
|
- analyzeRequest.put("complaint_type", "谩骂嘲讽、煽动对立");
|
|
|
- } else if (5 == lifeuserViolation.getDictId()){
|
|
|
- analyzeRequest.put("complaint_type", "涉嫌诈骗");
|
|
|
- } else if (6 == lifeuserViolation.getDictId()){
|
|
|
- analyzeRequest.put("complaint_type", "人身攻击");
|
|
|
- } else if (7 == lifeuserViolation.getDictId()){
|
|
|
- analyzeRequest.put("complaint_type", "种族歧视");
|
|
|
- } else if (8 == lifeuserViolation.getDictId()){
|
|
|
- analyzeRequest.put("complaint_type", "政治敏感");
|
|
|
- } else if (9 == lifeuserViolation.getDictId()){
|
|
|
- analyzeRequest.put("complaint_type", "虚假、不实内容");
|
|
|
- } else if (10 == lifeuserViolation.getDictId()){
|
|
|
- analyzeRequest.put("complaint_type", "违反公德秩序");
|
|
|
- } else if (11 == lifeuserViolation.getDictId()){
|
|
|
- analyzeRequest.put("complaint_type", "危害人身安全");
|
|
|
- } else if (12 == lifeuserViolation.getDictId()){
|
|
|
- analyzeRequest.put("complaint_type", "网络暴力");
|
|
|
- } else {
|
|
|
- analyzeRequest.put("complaint_type", "其他");
|
|
|
- }
|
|
|
-
|
|
|
- analyzeRequest.put("reporter_user_id", lifeuserViolation.getReportingUserId());
|
|
|
- analyzeRequest.put("reported_user_id", lifeuserViolation.getReportedUserId());
|
|
|
+// // 对应参数
|
|
|
+// if (1 == lifeuserViolation.getDictId()){
|
|
|
+// analyzeRequest.put("complaint_type", "用户违规");
|
|
|
+// } else if (2 == lifeuserViolation.getDictId()){
|
|
|
+// analyzeRequest.put("complaint_type", "色情低俗");
|
|
|
+// } else if (3 == lifeuserViolation.getDictId()){
|
|
|
+// analyzeRequest.put("complaint_type", "违法违规");
|
|
|
+// } else if (4 == lifeuserViolation.getDictId()){
|
|
|
+// analyzeRequest.put("complaint_type", "谩骂嘲讽、煽动对立");
|
|
|
+// } else if (5 == lifeuserViolation.getDictId()){
|
|
|
+// analyzeRequest.put("complaint_type", "涉嫌诈骗");
|
|
|
+// } else if (6 == lifeuserViolation.getDictId()){
|
|
|
+// analyzeRequest.put("complaint_type", "人身攻击");
|
|
|
+// } else if (7 == lifeuserViolation.getDictId()){
|
|
|
+// analyzeRequest.put("complaint_type", "种族歧视");
|
|
|
+// } else if (8 == lifeuserViolation.getDictId()){
|
|
|
+// analyzeRequest.put("complaint_type", "政治敏感");
|
|
|
+// } else if (9 == lifeuserViolation.getDictId()){
|
|
|
+// analyzeRequest.put("complaint_type", "虚假、不实内容");
|
|
|
+// } else if (10 == lifeuserViolation.getDictId()){
|
|
|
+// analyzeRequest.put("complaint_type", "违反公德秩序");
|
|
|
+// } else if (11 == lifeuserViolation.getDictId()){
|
|
|
+// analyzeRequest.put("complaint_type", "危害人身安全");
|
|
|
+// } else if (12 == lifeuserViolation.getDictId()){
|
|
|
+// analyzeRequest.put("complaint_type", "网络暴力");
|
|
|
+// } else {
|
|
|
+// analyzeRequest.put("complaint_type", "其他");
|
|
|
+// }
|
|
|
+ analyzeRequest.put("id", lifeuserViolation.getId());
|
|
|
+ analyzeRequest.put("type", lifeuserViolation.getReportContextType());
|
|
|
|
|
|
//举报人
|
|
|
String reporterUserId = lifeuserViolation.getReportingUserId();
|
|
|
@@ -204,6 +206,16 @@ public class AiUserViolationUtils {
|
|
|
R.fail("提交用户投诉审核任务返回record_id为空");
|
|
|
return null;
|
|
|
}
|
|
|
+ // 解析AI审核结果
|
|
|
+ String processingStatus = JSONObject.parseObject(analyzeResp.getBody()).getJSONObject("data").getJSONObject("result").getString("processing_status");
|
|
|
+ boolean success = "1".equals(processingStatus);
|
|
|
+
|
|
|
+ LifeUserViolation lifeUserViolation = lifeUserViolationMapper.selectById(lifeuserViolation.getId());
|
|
|
+
|
|
|
+ // 更新举报处理状态
|
|
|
+ lifeUserViolation.setProcessingStatus(processingStatus);
|
|
|
+ lifeUserViolation.setProcessingTime(new Date());
|
|
|
+ lifeUserViolationMapper.updateById(lifeUserViolation);
|
|
|
return taskId;
|
|
|
} else {
|
|
|
if (analyzeResp != null) {
|
|
|
@@ -305,6 +317,9 @@ public class AiUserViolationUtils {
|
|
|
|
|
|
analyzeRequest.put("evidence_images", lifeuserViolation.getImgUrl());
|
|
|
|
|
|
+ analyzeRequest.put("id", lifeuserViolation.getId());
|
|
|
+ analyzeRequest.put("type", lifeuserViolation.getReportContextType());
|
|
|
+
|
|
|
HttpEntity<Map<String, Object>> analyzeEntity = new HttpEntity<>(analyzeRequest, analyzeHeaders);
|
|
|
|
|
|
ResponseEntity<String> analyzeResp = null;
|
|
|
@@ -331,6 +346,16 @@ public class AiUserViolationUtils {
|
|
|
}
|
|
|
|
|
|
String taskId = dataJsonObj.getString("task_id");
|
|
|
+ // 解析AI审核结果
|
|
|
+ String processingStatus = JSONObject.parseObject(analyzeResp.getBody()).getJSONObject("data").getJSONObject("result").getString("processing_status");
|
|
|
+ boolean success = "1".equals(processingStatus);
|
|
|
+
|
|
|
+ LifeUserViolation lifeUserViolation = lifeUserViolationMapper.selectById(lifeuserViolation.getId());
|
|
|
+
|
|
|
+ // 更新举报处理状态
|
|
|
+ lifeUserViolation.setProcessingStatus(processingStatus);
|
|
|
+ lifeUserViolation.setProcessingTime(new Date());
|
|
|
+ lifeUserViolationMapper.updateById(lifeUserViolation);
|
|
|
if (taskId == null) {
|
|
|
log.error("提交商品举报审核任务返回task_id为空");
|
|
|
return null;
|