|
|
@@ -17,20 +17,19 @@ import org.springframework.util.MultiValueMap;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.client.ResourceAccessException;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
import org.springframework.http.*;
|
|
|
import shop.alien.entity.result.R;
|
|
|
import shop.alien.entity.second.SecondGoodsRecord;
|
|
|
import shop.alien.entity.second.SecondRiskControlRecord;
|
|
|
import shop.alien.entity.store.*;
|
|
|
-import shop.alien.mapper.LifeUserMapper;
|
|
|
-import shop.alien.mapper.LifeUserViolationMapper;
|
|
|
-import shop.alien.mapper.StoreDictionaryMapper;
|
|
|
-import shop.alien.mapper.StoreImgMapper;
|
|
|
+import shop.alien.mapper.*;
|
|
|
import shop.alien.mapper.second.SecondGoodsRecordMapper;
|
|
|
import shop.alien.mapper.second.SecondRiskControlRecordMapper;
|
|
|
import shop.alien.util.common.Constants;
|
|
|
|
|
|
+import java.net.SocketException;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
@@ -88,6 +87,8 @@ public class AiCheckXxlJob {
|
|
|
@Value("${third-party-goodsresult.base-url}")
|
|
|
private String goodsResultUrl;
|
|
|
|
|
|
+ private final LifeNoticeMapper lifeNoticeMapper;
|
|
|
+
|
|
|
/**
|
|
|
* AI自动审核任务处理器
|
|
|
* <p>
|
|
|
@@ -111,8 +112,8 @@ public class AiCheckXxlJob {
|
|
|
log.info("登录Ai服务获取token..." + loginUrl);
|
|
|
//构建请求参数
|
|
|
MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
|
|
|
- formData.add("username", "admin"); // 表单字段 1:用户名
|
|
|
- formData.add("password", "123456"); // 表单字段 2:密码
|
|
|
+ formData.add("username", userName); // 表单字段 1:用户名
|
|
|
+ formData.add("password", passWord); // 表单字段 2:密码
|
|
|
|
|
|
//设置请求头
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
@@ -212,6 +213,12 @@ public class AiCheckXxlJob {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ } catch (ResourceAccessException e) {
|
|
|
+ if (e.getCause() instanceof SocketException) {
|
|
|
+ log.error("AI自动审核请求网络异常,连接被中断: {}", e.getMessage());
|
|
|
+ } else {
|
|
|
+ log.error("AI自动审核请求资源访问异常", e);
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
log.error("AI自动审核请求异常", e);
|
|
|
}
|
|
|
@@ -289,9 +296,26 @@ public class AiCheckXxlJob {
|
|
|
violation.setReportResult(data.getString("matched_type"));
|
|
|
violation.setProcessingStatus(processingStatus);
|
|
|
lifeUserViolationMapper.updateById(violation);
|
|
|
+
|
|
|
+ // 发送通知
|
|
|
+ LifeNotice lifeMessage = new LifeNotice();
|
|
|
+ LifeUser lifeUser = lifeUserMapper.selectById(violation.getReportingUserId());
|
|
|
+ lifeMessage.setReceiverId("user_" + lifeUser.getUserPhone());
|
|
|
+ String text = "您的举报用户结果为" + (isValid ? "违规" : "未违规");
|
|
|
+ lifeMessage.setContext(text);
|
|
|
+ lifeMessage.setSenderId("system");
|
|
|
+ lifeMessage.setIsRead(0);
|
|
|
+ lifeMessage.setNoticeType(1);
|
|
|
+ lifeNoticeMapper.insert(lifeMessage);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ } catch (ResourceAccessException e) {
|
|
|
+ if (e.getCause() instanceof SocketException) {
|
|
|
+ log.error("AI自动审核结果查询网络异常,连接被中断: {}", e.getMessage());
|
|
|
+ } else {
|
|
|
+ log.error("AI自动审核结果查询资源访问异常", e);
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
log.error("AI自动审核结果查询异常", e);
|
|
|
}
|