地址改成配置文件

This commit is contained in:
方亮 2025-09-08 09:20:32 +08:00
parent 50f1eb2c91
commit f000a43c9c
1 changed files with 7 additions and 10 deletions

View File

@ -26,21 +26,15 @@ import okhttp3.MediaType;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import org.apache.logging.log4j.util.Base64Util;
import org.hibernate.validator.internal.util.StringHelper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.net.URLEncoder;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Base64;
import static com.bonus.bmw.utils.BaiduRecognitionUtils.HTTP_CLIENT;
/**
* @author 马三炮
* @date 2025/8/14
@ -55,6 +49,9 @@ public class AppRecognitionServiceImpl implements AppRecognitionService {
@Autowired
private FileUploadUtils fileUploadUtils;
@Value("${face.path}")
public String faceUrl;
/**
* 人脸识别-人脸照片采集入库
* @param facePhoto
@ -83,7 +80,7 @@ public class AppRecognitionServiceImpl implements AppRecognitionService {
bean.setImg("data:image/jpeg;base64,fddsdafretrthwuwtrewyewtrweet");
}
for (int i = 0; i < maxRetries; i++) {
String body = HttpUtil.post(IpAndPathConfig.getFaceRecognitionUrl() + "/updatedb",
String body = HttpUtil.post(faceUrl + "/updatedb",
FastJsonHelper.beanToJsonStr(bean));
log.error(body);
JSONObject jsonObject = FastJsonHelper.jsonStrToJsonObj(body);
@ -128,7 +125,7 @@ public class AppRecognitionServiceImpl implements AppRecognitionService {
bean.setImg("data:image/png;base64,fddsdafretrthwuwtrewyewtrweet");
}
for (int i = 0; i < maxRetries; i++) {
String body = HttpUtil.post(IpAndPathConfig.getFaceRecognitionUrl() + "/updatedb",
String body = HttpUtil.post(faceUrl + "/updatedb",
FastJsonHelper.beanToJsonStr(bean));
log.error(body);
JSONObject jsonObject = FastJsonHelper.jsonStrToJsonObj(body);
@ -167,7 +164,7 @@ public class AppRecognitionServiceImpl implements AppRecognitionService {
} else {
fileBase64 = "data:image/jpeg;base64," + fileBase64;
}
String body = HttpUtil.post(IpAndPathConfig.getFaceRecognitionUrl() + "/facerecognition",
String body = HttpUtil.post(faceUrl + "/facerecognition",
FastJsonHelper.beanToJsonStr(new FaceRecognitionBean(fileBase64)));
log.info("人脸识别响应内容: {}", body);
JSONObject jsonObject = FastJsonHelper.jsonStrToJsonObj(body);