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