Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
谢明辉
/
VVAS-Match
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit ac310f68
authored
Apr 26, 2021
by
xmh
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
动态匹配
1 parent
e0a8d848
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
5 deletions
pom.xml
src/main/java/com/viontech/match/config/Constant.java
src/main/java/com/viontech/match/service/PersonService.java
src/main/java/com/viontech/match/service/PoolService.java
src/main/resources/application-option.properties
pom.xml
View file @
ac310f6
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
<dependency>
<dependency>
<groupId>
com.viontech.keliu
</groupId>
<groupId>
com.viontech.keliu
</groupId>
<artifactId>
keliu-base
</artifactId>
<artifactId>
keliu-base
</artifactId>
<version>
6.0.9
</version>
<version>
6.0.9
-SNAPSHOT
</version>
<exclusions>
<exclusions>
<exclusion>
<exclusion>
<artifactId>
pagehelper-spring-boot-starter
</artifactId>
<artifactId>
pagehelper-spring-boot-starter
</artifactId>
...
@@ -62,7 +62,7 @@
...
@@ -62,7 +62,7 @@
<dependency>
<dependency>
<groupId>
com.viontech.keliu
</groupId>
<groupId>
com.viontech.keliu
</groupId>
<artifactId>
AlgApiClient
</artifactId>
<artifactId>
AlgApiClient
</artifactId>
<version>
6.0.
5
</version>
<version>
6.0.
6-SNAPSHOT
</version>
<exclusions>
<exclusions>
<exclusion>
<exclusion>
<groupId>
javax
</groupId>
<groupId>
javax
</groupId>
...
...
src/main/java/com/viontech/match/config/Constant.java
View file @
ac310f6
package
com
.
viontech
.
match
.
config
;
package
com
.
viontech
.
match
.
config
;
import
java.text.SimpleDateFormat
;
/**
/**
* 常量
* 常量
*
*
...
@@ -25,4 +27,6 @@ public class Constant {
...
@@ -25,4 +27,6 @@ public class Constant {
public
final
static
int
FACE_MATCH_RESULT_SIZE
=
5
;
public
final
static
int
FACE_MATCH_RESULT_SIZE
=
5
;
/** 人体匹配结果的数量 */
/** 人体匹配结果的数量 */
public
final
static
int
BODY_MATCH_RESULT_SIZE
=
10
;
public
final
static
int
BODY_MATCH_RESULT_SIZE
=
10
;
public
final
static
ThreadLocal
<
SimpleDateFormat
>
DATE_FORMAT
=
ThreadLocal
.
withInitial
(()
->
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
));
}
}
src/main/java/com/viontech/match/service/PersonService.java
View file @
ac310f6
This diff is collapsed.
Click to expand it.
src/main/java/com/viontech/match/service/PoolService.java
View file @
ac310f6
...
@@ -22,6 +22,7 @@ import org.elasticsearch.common.settings.Settings;
...
@@ -22,6 +22,7 @@ import org.elasticsearch.common.settings.Settings;
import
org.elasticsearch.common.xcontent.XContentBuilder
;
import
org.elasticsearch.common.xcontent.XContentBuilder
;
import
org.elasticsearch.common.xcontent.XContentFactory
;
import
org.elasticsearch.common.xcontent.XContentFactory
;
import
org.elasticsearch.rest.RestStatus
;
import
org.elasticsearch.rest.RestStatus
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
...
@@ -47,6 +48,10 @@ public class PoolService {
...
@@ -47,6 +48,10 @@ public class PoolService {
private
RestHighLevelClient
client
;
private
RestHighLevelClient
client
;
@Resource
@Resource
private
ObjectMapper
objectMapper
;
private
ObjectMapper
objectMapper
;
@Value
(
"${vion.index.number_of_shards:1}"
)
private
Integer
shards
;
@Value
(
"${vion.index.number_of_replicas:0}"
)
private
Integer
replicas
;
/**
/**
* 添加特征池
* 添加特征池
...
@@ -65,8 +70,8 @@ public class PoolService {
...
@@ -65,8 +70,8 @@ public class PoolService {
XContentBuilder
builder
=
getCreateIndexContentBuilder
();
XContentBuilder
builder
=
getCreateIndexContentBuilder
();
createIndexRequest
.
mapping
(
builder
);
createIndexRequest
.
mapping
(
builder
);
Settings
.
Builder
setting
=
Settings
.
builder
();
Settings
.
Builder
setting
=
Settings
.
builder
();
setting
.
put
(
"index.number_of_shards"
,
1
);
setting
.
put
(
"index.number_of_shards"
,
shards
);
setting
.
put
(
"index.number_of_replicas"
,
0
);
setting
.
put
(
"index.number_of_replicas"
,
replicas
);
createIndexRequest
.
settings
(
setting
);
createIndexRequest
.
settings
(
setting
);
CreateIndexResponse
createIndexResponse
=
client
.
indices
().
create
(
createIndexRequest
,
RequestOptions
.
DEFAULT
);
CreateIndexResponse
createIndexResponse
=
client
.
indices
().
create
(
createIndexRequest
,
RequestOptions
.
DEFAULT
);
...
@@ -147,6 +152,7 @@ public class PoolService {
...
@@ -147,6 +152,7 @@ public class PoolService {
BulkResponse
bulkItemResponses
=
personService
.
addPerson
(
poolId
,
personPool
);
BulkResponse
bulkItemResponses
=
personService
.
addPerson
(
poolId
,
personPool
);
if
(
bulkItemResponses
!=
null
&&
bulkItemResponses
.
hasFailures
())
{
if
(
bulkItemResponses
!=
null
&&
bulkItemResponses
.
hasFailures
())
{
log
.
info
(
bulkItemResponses
.
buildFailureMessage
());
log
.
info
(
bulkItemResponses
.
buildFailureMessage
());
return
ResponseVo
.
error
(
rid
,
bulkItemResponses
.
buildFailureMessage
());
}
}
log
.
info
(
"特征池修改操作完成:[{}],updateType:[{}]"
,
poolId
,
updateType
);
log
.
info
(
"特征池修改操作完成:[{}],updateType:[{}]"
,
poolId
,
updateType
);
...
@@ -159,7 +165,9 @@ public class PoolService {
...
@@ -159,7 +165,9 @@ public class PoolService {
/**
/**
* 查询特征池信息
* 查询特征池信息
*
* @param requestVo rid,listAll,poolId
* @param requestVo rid,listAll,poolId
*
* @return ResponseVo
* @return ResponseVo
* @throws Exception --
* @throws Exception --
*/
*/
...
@@ -210,6 +218,7 @@ public class PoolService {
...
@@ -210,6 +218,7 @@ public class PoolService {
builder
.
field
(
"dims"
,
Constant
.
FACE_FEATURE_DIMS
);
builder
.
field
(
"dims"
,
Constant
.
FACE_FEATURE_DIMS
);
}
}
builder
.
endObject
();
builder
.
endObject
();
// 人体特征
// 人体特征
builder
.
startObject
(
"body"
);
builder
.
startObject
(
"body"
);
{
{
...
@@ -217,12 +226,14 @@ public class PoolService {
...
@@ -217,12 +226,14 @@ public class PoolService {
builder
.
field
(
"dims"
,
Constant
.
BODY_FEATURE_DIMS_2048
);
builder
.
field
(
"dims"
,
Constant
.
BODY_FEATURE_DIMS_2048
);
}
}
builder
.
endObject
();
builder
.
endObject
();
// 人员id
// 人员id
builder
.
startObject
(
"personId"
);
builder
.
startObject
(
"personId"
);
{
{
builder
.
field
(
"type"
,
"keyword"
);
builder
.
field
(
"type"
,
"keyword"
);
}
}
builder
.
endObject
();
builder
.
endObject
();
// 特征id
// 特征id
builder
.
startObject
(
"fid"
);
builder
.
startObject
(
"fid"
);
{
{
...
@@ -230,6 +241,7 @@ public class PoolService {
...
@@ -230,6 +241,7 @@ public class PoolService {
}
}
builder
.
endObject
();
builder
.
endObject
();
// 年龄
builder
.
startObject
(
"age"
);
builder
.
startObject
(
"age"
);
{
{
builder
.
field
(
"type"
,
"integer"
);
builder
.
field
(
"type"
,
"integer"
);
...
@@ -238,6 +250,7 @@ public class PoolService {
...
@@ -238,6 +250,7 @@ public class PoolService {
}
}
builder
.
endObject
();
builder
.
endObject
();
// 性别
builder
.
startObject
(
"gender"
);
builder
.
startObject
(
"gender"
);
{
{
builder
.
field
(
"type"
,
"keyword"
);
builder
.
field
(
"type"
,
"keyword"
);
...
@@ -245,6 +258,32 @@ public class PoolService {
...
@@ -245,6 +258,32 @@ public class PoolService {
builder
.
field
(
"index"
,
false
);
builder
.
field
(
"index"
,
false
);
}
}
builder
.
endObject
();
builder
.
endObject
();
// 时间
builder
.
startObject
(
"counttime"
);
{
builder
.
field
(
"type"
,
"date"
);
builder
.
field
(
"format"
,
"yyyy-MM-dd HH:mm:ss"
);
}
builder
.
endObject
();
// 通道序列号
builder
.
startObject
(
"channelSerialNum"
);
{
builder
.
field
(
"type"
,
"keyword"
);
}
builder
.
endObject
();
// 身体特征类型类型
builder
.
startObject
(
"body_type"
);
{
builder
.
field
(
"type"
,
"integer"
);
builder
.
field
(
"doc_values"
,
false
);
builder
.
field
(
"index"
,
false
);
}
builder
.
endObject
();
}
}
builder
.
endObject
();
builder
.
endObject
();
}
}
...
...
src/main/resources/application-option.properties
View file @
ac310f6
...
@@ -3,4 +3,8 @@ server.port=12000
...
@@ -3,4 +3,8 @@ server.port=12000
spring.jackson.time-
zone
=
GMT+8
spring.jackson.time-
zone
=
GMT+8
spring.jackson.date-
format
=
yyyy-MM-dd HH:mm:ss
spring.jackson.date-
format
=
yyyy-MM-dd HH:mm:ss
# es
# es
spring.elasticsearch.rest.uris
=
http://127.0.0.1:9200
\ No newline at end of file
\ No newline at end of file
spring.elasticsearch.rest.uris
=
http://127.0.0.1:9200
#\u5206\u7247\u6570\u91CF
vion.index.number_of_shards
=
1
#\u526F\u672C\u6570\u91CF
vion.index.number_of_replicas
=
0
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment