Commit ec549f78 by 李乾广

[add]日志打印rid

1 parent 7b18ab5b
......@@ -144,7 +144,7 @@ public class PersonService {
ResponseVo result = ResponseVo.success(rid, "success");
result.setCount(count);
log.info("CountMatchPerson完成,PoolIds:[{}],count:{}", poolIds, count);
log.info("rid:{} CountMatchPerson完成,PoolIds:[{}],count:{}", rid, poolIds, count);
return result;
} catch (ElasticsearchStatusException e) {
ResponseVo error = ResponseVo.error(rid, e.getDetailedMessage());
......@@ -185,9 +185,9 @@ public class PersonService {
pool.setPersonPoolId(id);
if (poolService.existPool(id)) {
pool.setStatus(0);
List<Person> face = matchPerson(id, requestVo.getPerson(), 0, size, agg);
List<Person> face = matchPerson(rid, id, requestVo.getPerson(), 0, size, agg);
matchFaces.addAll(face);
List<Person> body = matchPerson(id, requestVo.getPerson(), 1, size, agg);
List<Person> body = matchPerson(rid, id, requestVo.getPerson(), 1, size, agg);
matchBodies.addAll(body);
} else {
pool.setStatus(1);
......@@ -345,6 +345,7 @@ public class PersonService {
/**
* 人员匹配入口
*
* @param rid 请求唯一id
* @param poolId 在哪个特征池中匹配
* @param person 用来匹配的人员信息
* @param type 匹配类型 0人脸 1人体
......@@ -352,14 +353,14 @@ public class PersonService {
* @return 匹配结果
* @throws Exception --
*/
public List<Person> matchPerson(String poolId, Person person, int type, Integer size, Boolean agg) throws Exception {
public List<Person> matchPerson(String rid, String poolId, Person person, int type, Integer size, Boolean agg) throws Exception {
List<Person> matchResult = new ArrayList<>();
int matchResultSize;
if (type == 0) {
matchFace(poolId, matchResult, person, size, agg);
matchFace(rid, poolId, matchResult, person, size, agg);
matchResultSize = Constant.FACE_MATCH_RESULT_SIZE;
} else {
matchBody(poolId, matchResult, person, size, agg);
matchBody(rid, poolId, matchResult, person, size, agg);
matchResultSize = Constant.BODY_MATCH_RESULT_SIZE;
}
if (size != null) {
......@@ -376,7 +377,7 @@ public class PersonService {
return matchResult;
}
private void matchFace(String poolId, List<Person> matchResult, Person person, Integer size, Boolean agg) throws Exception {
private void matchFace(String rid, String poolId, List<Person> matchResult, Person person, Integer size, Boolean agg) throws Exception {
List<FaceFeature> faceFeatures = person.getFaceFeatures();
if (CollectionUtils.isNotEmpty(faceFeatures)) {
for (FaceFeature faceFeature : faceFeatures) {
......@@ -386,7 +387,7 @@ public class PersonService {
continue;
}
SearchRequest searchRequest = getSearchRequest(poolId, size == null ? Constant.FACE_MATCH_RESULT_SIZE : size, feature, person, 0, agg);
SearchRequest searchRequest = getSearchRequest(rid, poolId, size == null ? Constant.FACE_MATCH_RESULT_SIZE : size, feature, person, 0, agg);
matchResult.addAll(match0(searchRequest, agg));
}
} else {
......@@ -394,7 +395,7 @@ public class PersonService {
}
}
private void matchBody(String poolId, List<Person> matchResult, Person person, Integer size, Boolean agg) throws Exception {
private void matchBody(String rid, String poolId, List<Person> matchResult, Person person, Integer size, Boolean agg) throws Exception {
List<BodyFeature> bodyFeatures = person.getBodyFeatures();
if (CollectionUtils.isNotEmpty(bodyFeatures)) {
for (BodyFeature faceFeature : bodyFeatures) {
......@@ -410,7 +411,7 @@ public class PersonService {
feature = Arrays.copyOfRange(feature, 3, Constant.BODY_FEATURE_DIMS_2048 + 3);
}
SearchRequest searchRequest = getSearchRequest(poolId, size == null ? Constant.BODY_MATCH_RESULT_SIZE : size, feature, person, 1, agg);
SearchRequest searchRequest = getSearchRequest(rid, poolId, size == null ? Constant.BODY_MATCH_RESULT_SIZE : size, feature, person, 1, agg);
matchResult.addAll(match0(searchRequest, agg));
}
......@@ -489,7 +490,7 @@ public class PersonService {
return builder;
}
private SearchRequest getSearchRequest(String poolId, Integer matchResultSize, Double[] feature, Person person, int type, Boolean agg) {
private SearchRequest getSearchRequest(String rid, String poolId, Integer matchResultSize, Double[] feature, Person person, int type, Boolean agg) {
SearchSourceBuilder builder = getSearchSourceBuilder(feature, person, type);
if (agg) {
MaxAggregationBuilder maxScoreAgg = AggregationBuilders.max("max_score").script(new Script("_score"));
......@@ -503,7 +504,7 @@ public class PersonService {
.size(matchResultSize);
}
log.debug("poolId:{} 匹配时参数:{}", poolId, builder.toString());
log.debug("rid:{} poolId:{} 匹配时参数:{}", rid, poolId, builder.toString());
return new SearchRequest(poolId).source(builder);
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!