Преглед на файлове

3467 证照管理(提测0306):其他资质证明页面中更换证明,选择正常的资质证明图片,上传不成功
3466 证照管理(提测0306):其他资质证明页面中更换证明,选择的是赌博图片,弹出的提示信息优化

lutong преди 4 седмици
родител
ревизия
aa27ddbfaa
променени са 1 файла, в които са добавени 18 реда и са изтрити 2 реда
  1. 18 2
      alien-store-platform/src/main/java/shop/alien/storeplatform/controller/LicenseController.java

+ 18 - 2
alien-store-platform/src/main/java/shop/alien/storeplatform/controller/LicenseController.java

@@ -13,10 +13,11 @@ import shop.alien.entity.storePlatform.vo.StoreLicenseHistoryDto;
 import shop.alien.entity.storePlatform.vo.StoreLicenseHistoryVO;
 import shop.alien.mapper.WebAuditMapper;
 import shop.alien.storeplatform.service.LicenseService;
+import shop.alien.storeplatform.util.AiContentModerationUtil;
 
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
-import java.util.Map;
 
 
 @Slf4j
@@ -32,6 +33,8 @@ public class LicenseController {
 
     private final WebAuditMapper webAuditMapper;
 
+    private final AiContentModerationUtil aiContentModerationUtil;
+
 
     @ApiOperation("获取营业执照图片信息")
     @ApiOperationSupport(order = 1)
@@ -161,10 +164,23 @@ public class LicenseController {
     }
 
 
-    @ApiOperation(value = "门店装修-修改娱乐经营许可证")
+    @ApiOperation(value = "门店装修-修改娱乐经营许可证", notes = "上传前会同步进行AI图片审核,不通过则直接返回失败原因")
     @PostMapping("/uploadEntertainmentLicence")
     public R<String> uploadEntertainmentLicence(@RequestBody StoreImg storeImg) {
         log.info("StoreInfoController.uploadEntertainmentLicence?storeImg={}", storeImg);
+        if (storeImg == null) {
+            return R.fail("参数不能为空");
+        }
+        // AI 图片审核(同步):不通过则直接返回原因给前台
+        if (storeImg.getImgUrl() != null && !storeImg.getImgUrl().trim().isEmpty()) {
+            AiContentModerationUtil.AuditResult auditResult = aiContentModerationUtil.auditContent(
+                    null, Collections.singletonList(storeImg.getImgUrl().trim()));
+            if (!auditResult.isPassed()) {
+                String reason = auditResult.getFailureReason() != null ? auditResult.getFailureReason() : "图片审核未通过";
+                log.warn("娱乐经营许可证图片AI审核不通过, storeId={}, reason={}", storeImg.getStoreId(), reason);
+                return R.fail(reason);
+            }
+        }
         int num = licenseService.uploadEntertainmentLicence(storeImg);
         if (num > 0) {
             WebAudit webAudit = new WebAudit();