|
|
@@ -1,5 +1,8 @@
|
|
|
package com.yingpaipay.business.service;
|
|
|
|
|
|
+import com.yingpaipay.business.constant.AiAuditResultConst;
|
|
|
+import com.yingpaipay.business.domain.dto.AiAuditDto;
|
|
|
+import com.yingpaipay.business.enumeration.AiAuditRejectReasonEnum;
|
|
|
import com.yingpaipay.setting.service.IAiSettingService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -22,16 +25,14 @@ public class AiAuditService {
|
|
|
private final IAiSettingService settingService;
|
|
|
private final ISysOssService ossService;
|
|
|
|
|
|
- public void audit(Long ossId) {
|
|
|
+ public AiAuditDto audit(Long ossId) {
|
|
|
if (!settingService.query().getEnabledFlag()) {
|
|
|
- return;
|
|
|
- }
|
|
|
- boolean flag = handleAudit(ossId);
|
|
|
- if (!flag) {
|
|
|
+ return null;
|
|
|
}
|
|
|
+ return handleAudit(ossId);
|
|
|
}
|
|
|
|
|
|
- public boolean handleAudit(Long ossId) {
|
|
|
+ public AiAuditDto handleAudit(Long ossId) {
|
|
|
SysOssVo ossVo = ossService.getById(ossId);
|
|
|
String url = ossVo.getUrl();
|
|
|
File file;
|
|
|
@@ -49,8 +50,20 @@ public class AiAuditService {
|
|
|
throw new RuntimeException("AI 审核文件下载失败", e);
|
|
|
}
|
|
|
|
|
|
+ AiAuditDto dto = new AiAuditDto();
|
|
|
// TODO 进行具体的审核环节
|
|
|
+ boolean pageFlag = checkPages(file);
|
|
|
+ if (!pageFlag) {
|
|
|
+ dto.setResult(AiAuditResultConst.REJECT);
|
|
|
+ dto.setRejectReason(AiAuditRejectReasonEnum.PAGE_ERROR);
|
|
|
+ }
|
|
|
+
|
|
|
+ dto.setResult(AiAuditResultConst.PASS);
|
|
|
+ return dto;
|
|
|
+ }
|
|
|
|
|
|
+ private boolean checkPages(File file) {
|
|
|
+ // TODO 使用 textin 进行 OCR 解析
|
|
|
return true;
|
|
|
}
|
|
|
|