Commit 245b23d6 by yangyang

海南人像提交(海南)

parent 0ea82b9e
......@@ -66,6 +66,7 @@ public class HttpClient {
if (result.getStatusLine().getStatusCode() == HttpStatus.SC_OK){
// 读取服务器返回的json数据(然后解析)
jsonResult = EntityUtils.toString(result.getEntity(), "utf-8");
System.out.println("back="+jsonResult);
}else{
throw new Exception();
}
......
......@@ -16,7 +16,7 @@ public class PropertieUtil {
String value = "";
try {
Properties prop = new Properties();
InputStream fileInputStream = PropertieUtil.class.getResourceAsStream(url);
FileInputStream fileInputStream = new FileInputStream(url);
prop.load(fileInputStream);
value = prop.getProperty(key);
fileInputStream.close();
......@@ -34,7 +34,7 @@ public class PropertieUtil {
String filePath = token_url;
// 获取配置文件
Properties pps = new Properties();
InputStream fileInputStream = PropertieUtil.class.getResourceAsStream(filePath);
FileInputStream fileInputStream = new FileInputStream(filePath);
InputStream in = new BufferedInputStream(fileInputStream);
InputStreamReader inputStreamReader = new InputStreamReader(in, "UTF-8");
pps.load(inputStreamReader);
......
......@@ -32,7 +32,7 @@ import java.util.*;
public class TokenUtils {
private static Log logger = LogFactory.getLog(HttpClient.class);
private static RequestConfig requestConfig = null;
private static String tokenPath="/token.properties";
private static String tokenPath="/data/software/jar/token.properties";
static{
// 设置请求和传输超时时间
......
......@@ -6,6 +6,7 @@ import com.founder.commonutils.peopleEntity.NaoTuRybq;
import com.founder.commonutils.peopleEntity.PeopleResourceTrackResult;
import com.founder.commonutils.publicEntity.MapRestResult;
import com.founder.commonutils.util.JsonUtils;
import com.founder.publicapi.service.ImageService;
import com.founder.publicapi.service.PeopleService;
import com.founder.servicebase.logs.OperLog;
import com.founder.servicebase.logs.OperationType;
......@@ -36,7 +37,8 @@ public class PeopleContoller {
@Autowired
private PeopleService peopleService;
@Autowired
private ImageService imageService;
@ApiOperation(value = "虚实身份信息")
@OperLog(message = "虚实身份信息", operation = OperationType.QUERY)
......@@ -180,7 +182,7 @@ public class PeopleContoller {
@ApiOperation(value = "发起人像比对任务", notes = "发起人像比对任务")
public MapRestResult getRxbd(
@RequestParam(value = "file", required = false) MultipartFile file,@RequestParam(value = "base64Img", required = false) String base64Img,@RequestParam(value = "fjmc", required = false) String fjmc,@RequestParam(value = "threshold", required = false) String threshold,@RequestParam(value = "topNumber", required = false) String topNumber,@RequestParam(value = "model", required = false) String model, HttpServletRequest request) {
return peopleService.getFqRxbdjgrw(file, base64Img,request, fjmc, threshold, topNumber, model);
return imageService.getFqRxbdjgrw(file, base64Img,request, fjmc, threshold, topNumber, model);
}
}
......@@ -24,6 +24,8 @@ import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/*
*
......@@ -61,8 +63,9 @@ public class ImageServiceImpl implements ImageService {
return resultMapAll;
}
}
BASE64Encoder base64Encoder = new BASE64Encoder();// base64处理
faceSearchParam.setBase64Img(base64Encoder.encode(file.getBytes()));
String base64Img = new BASE64Encoder().encode(file.getBytes()).replaceAll("[\\s*\t\n\r]", "");
System.out.println(base64Img);
faceSearchParam.setBase64Img(base64Img);
JSONObject params = new JSONObject();// 请求参数
List<FaceSearchResult> cameraFaceResults=new ArrayList<>();// 存储返回结果
//请求参数
......@@ -224,10 +227,16 @@ public class ImageServiceImpl implements ImageService {
JSONObject params = new JSONObject();// 请求参数
MapRestResult mapRestResult = null;
try {
Matcher matcher = Pattern.compile("^data.(.*?);base64,").matcher(base64Img);
if (matcher.find()){
base64Img = base64Img.replace(matcher.group(),"");
base64Img = base64Img.replaceAll("[\\s*\t\n\r]", "");
System.out.println(base64Img);
}
//请求参数
params.put("compareFace", new BASE64Encoder().encode(file.getBytes()));// 人像base64
params.put("compareFace", base64Img);// 人像base64
params.put("faceType", 2);// 1:url 全 路 径 2:base64
params.put("thresholdMin", 0.85);// 最低相似度,不能 低 于0.85, 默认0.85
params.put("thresholdMin", 0.95);// 最低相似度,不能 低 于0.85, 默认0.85
String url = imageUrl + "/govServerWeb/personFace/compareFace";
String resultString = HttpClient.doPostJson(url, getToken(), String.valueOf(params));
if (null != resultString) {//如果返回结果不为空
......
......@@ -820,6 +820,9 @@ public class PeopleServiceImpl implements PeopleService {
reqEntity.addPart("threshold", new StringBody(threshold));
reqEntity.addPart("topNumber", new StringBody(topNumber));
reqEntity.addPart("userId", new StringBody("150147"));
reqEntity.addPart("userIdNumber", new StringBody("150147"));
reqEntity.addPart("userName", new StringBody("150147"));
reqEntity.addPart("userName", new StringBody("150147"));
httppost.setEntity(reqEntity);
HttpResponse response = httpclient.execute(httppost);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment