Kaynağa Gözat

修改视频创建逻辑、新增图片检查接口、新增百度API接口、修改上传阿里云检查、新增回调接口

private_deployment
lrh 1 yıl önce
ebeveyn
işleme
d841342d20
2 değiştirilmiş dosya ile 8 ekleme ve 17 silme
  1. +1
    -2
      suimangCApi/src/main/java/com/iformall/controller/PersonPhotoController.java
  2. +7
    -15
      suimangCApi/src/main/java/com/iformall/utils/BaiduImageCheckUtil.java

+ 1
- 2
suimangCApi/src/main/java/com/iformall/controller/PersonPhotoController.java Dosyayı Görüntüle

@@ -109,8 +109,7 @@ public class PersonPhotoController extends BaseController {
if (size > length) { if (size > length) {
return new ResultData(ErrorCode.PICTURE_FOUR_SIZE_EXCEED); return new ResultData(ErrorCode.PICTURE_FOUR_SIZE_EXCEED);
} }
AiBaiduCheckResult checkResult = BaiduImageCheckUtil.photoCheck(file);
return new ResultData(checkResult);
return BaiduImageCheckUtil.photoCheck(file);
} }






+ 7
- 15
suimangCApi/src/main/java/com/iformall/utils/BaiduImageCheckUtil.java Dosyayı Görüntüle

@@ -3,6 +3,7 @@ package com.iformall.utils;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.iformall.common.ErrorCode; import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData;
import com.iformall.sm.AiBaiduCheckResult; import com.iformall.sm.AiBaiduCheckResult;
import okhttp3.*; import okhttp3.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@@ -31,7 +32,7 @@ public class BaiduImageCheckUtil {


public static final OkHttpClient HTTP_CLIENT = new OkHttpClient().newBuilder().build(); public static final OkHttpClient HTTP_CLIENT = new OkHttpClient().newBuilder().build();


public static AiBaiduCheckResult photoCheck(MultipartFile file) {
public static ResultData photoCheck(MultipartFile file) {
try { try {
byte[] fileBytes = file.getBytes(); byte[] fileBytes = file.getBytes();
String imgStr = Base64Util.encode(fileBytes); String imgStr = Base64Util.encode(fileBytes);
@@ -46,27 +47,18 @@ public class BaiduImageCheckUtil {
JSONObject jsonObject = JSON.parseObject(result); JSONObject jsonObject = JSON.parseObject(result);
//1:合规,2:不合规,3:疑似,4:审核失败 //1:合规,2:不合规,3:疑似,4:审核失败
Integer type = jsonObject.getInteger("conclusionType"); Integer type = jsonObject.getInteger("conclusionType");
AiBaiduCheckResult checkResult = new AiBaiduCheckResult();
if (type == 1) { if (type == 1) {
checkResult.setMsg("图片合规");
checkResult.setCode(200);
return new ResultData();
} else if (type == 2 || type == 3) { } else if (type == 2 || type == 3) {
checkResult.setMsg("图片不合规");
checkResult.setCode(ErrorCode.SYS_SERVER_ERROR.getCode());
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"图片不合规");
} else if (type == 4) { } else if (type == 4) {
checkResult.setMsg("图片审核失败");
checkResult.setCode(ErrorCode.SYS_SERVER_ERROR.getCode());
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"图片审核失败");
} else { } else {
checkResult.setMsg("图片审核失败");
checkResult.setCode(ErrorCode.SYS_SERVER_ERROR.getCode());
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"图片审核失败");
} }
return checkResult;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
AiBaiduCheckResult checkResult = new AiBaiduCheckResult();
checkResult.setMsg("图片审核失败");
checkResult.setCode(ErrorCode.SYS_SERVER_ERROR.getCode());
return checkResult;
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"图片审核失败");
} }
} }




Yükleniyor…
İptal
Kaydet