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 3bd562f2
authored
Sep 29, 2024
by
姚冰
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[chg] es8合并索引
1 parent
1c4ec01c
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
74 additions
and
73 deletions
src/main/java/com/viontech/match/controller/MainController.java
src/main/java/com/viontech/match/entity/PersonInfo.java
src/main/java/com/viontech/match/entity/SearchResultHit.java
src/main/java/com/viontech/match/entity/vo/RequestVo.java
src/main/java/com/viontech/match/enumeration/CommandEnum.java
src/main/java/com/viontech/match/service/PersonService.java
src/main/java/com/viontech/match/service/PoolService.java
src/main/java/com/viontech/match/controller/MainController.java
View file @
3bd562f
...
...
@@ -49,6 +49,12 @@ public class MainController {
return
personService
.
updatePerson
(
requestVo
);
case
CountMatchPerson:
return
personService
.
countMatchPerson
(
requestVo
);
case
DelPoolData:
return
poolService
.
deletePoolData
(
requestVo
);
case
DelStaffPoolData:
return
poolService
.
deleteStaffPoolData
(
requestVo
);
case
UpdateStaff:
return
personService
.
updateStaff
(
requestVo
);
default
:
return
ResponseVo
.
commandNotFound
(
rid
);
}
...
...
src/main/java/com/viontech/match/entity/PersonInfo.java
View file @
3bd562f
...
...
@@ -23,7 +23,9 @@ public class PersonInfo {
private
Long
gateId
;
private
String
direction
;
public
PersonInfo
(
String
unid
,
String
personId
,
Double
[]
body
,
Double
[]
data
,
Integer
age
,
String
gender
,
Integer
bodyType
,
Date
countTime
,
String
fid
,
String
channelSerialNum
,
Long
gateId
,
String
direction
)
{
private
Long
mallId
;
public
PersonInfo
(
String
unid
,
String
personId
,
Double
[]
body
,
Double
[]
data
,
Integer
age
,
String
gender
,
Integer
bodyType
,
Date
countTime
,
String
fid
,
String
channelSerialNum
,
Long
gateId
,
String
direction
,
Long
mallId
)
{
this
.
unid
=
unid
;
this
.
personId
=
personId
;
this
.
body
=
body
;
...
...
@@ -37,5 +39,6 @@ public class PersonInfo {
this
.
gateId
=
gateId
;
this
.
direction
=
direction
;
this
.
_score
=
"1"
;
this
.
mallId
=
mallId
;
}
}
src/main/java/com/viontech/match/entity/SearchResultHit.java
View file @
3bd562f
...
...
@@ -16,7 +16,7 @@ public class SearchResultHit {
private
String
_score
;
private
Integer
age
;
private
String
gender
;
private
Integer
body
T
ype
;
private
Integer
body
_t
ype
;
// @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
private
String
counttime
;
private
String
fid
;
...
...
src/main/java/com/viontech/match/entity/vo/RequestVo.java
View file @
3bd562f
...
...
@@ -67,6 +67,10 @@ public class RequestVo {
//暂时无用
private
FaceFeature
newFaceFeature
;
private
Long
mallId
;
private
List
<
String
>
fidList
;
public
void
setPoolId
(
String
poolId
)
{
this
.
poolId
=
poolId
.
toLowerCase
();
}
...
...
src/main/java/com/viontech/match/enumeration/CommandEnum.java
View file @
3bd562f
...
...
@@ -14,5 +14,8 @@ public enum CommandEnum {
QueryPersonPool
,
MatchPerson
,
UpdatePerson
,
CountMatchPerson
CountMatchPerson
,
DelPoolData
,
DelStaffPoolData
,
UpdateStaff
;
}
src/main/java/com/viontech/match/service/PersonService.java
View file @
3bd562f
This diff is collapsed.
Click to expand it.
src/main/java/com/viontech/match/service/PoolService.java
View file @
3bd562f
...
...
@@ -87,19 +87,15 @@ public class PoolService {
.
numberOfReplicas
(
String
.
valueOf
(
replicas
));
if
(
StringUtils
.
isNotEmpty
(
translogDurability
))
{
settings
.
translog
(
t
->
t
.
durability
(
TranslogDurability
.
Async
));
// setting.put("index.translog.durability", translogDurability);
if
(
StringUtils
.
isNotEmpty
(
translogSyncInterval
))
{
settings
.
translog
(
t
->
t
.
syncInterval
(
i
->
i
.
time
(
translogSyncInterval
)));
// setting.put("index.translog.sync_interval", translogSyncInterval);
}
}
if
(
mergeThreadCount
!=
null
)
{
// setting.put("index.merge.scheduler.max_thread_count", mergeThreadCount);
settings
.
merge
(
m
->
m
.
scheduler
(
s
->
s
.
maxThreadCount
(
mergeThreadCount
)));
}
if
(
requestVo
.
isUseILMPolicy
())
{
// setting.put("index.lifecycle.name", ILM.LIFECYCLE_NAME);
settings
.
lifecycle
(
l
->
l
.
name
(
ILM
.
LIFECYCLE_NAME
));
}
...
...
@@ -166,6 +162,46 @@ public class PoolService {
}
}
public
ResponseVo
deletePoolData
(
RequestVo
requestVo
)
throws
Exception
{
String
rid
=
requestVo
.
getRid
();
Integer
flushPool
=
requestVo
.
getFlushPool
();
String
poolId
=
requestVo
.
getPoolId
();
Long
mallId
=
requestVo
.
getMallId
();
log
.
info
(
"特征池删除mallId:{}数据操作开始:[{}]"
,
mallId
,
poolId
);
try
{
personService
.
deletePersonByMallId
(
poolId
,
mallId
);
log
.
info
(
"特征池删除mallId:{}操作完成:[{}]"
,
mallId
,
poolId
);
return
ResponseVo
.
success
(
rid
);
}
catch
(
ElasticsearchException
e
)
{
if
(
e
.
status
()
==
404
)
{
return
ResponseVo
.
poolIdNotExists
(
rid
);
}
else
{
return
ResponseVo
.
error
(
rid
,
e
.
getMessage
());
}
}
}
public
ResponseVo
deleteStaffPoolData
(
RequestVo
requestVo
)
throws
Exception
{
String
rid
=
requestVo
.
getRid
();
Integer
flushPool
=
requestVo
.
getFlushPool
();
String
poolId
=
requestVo
.
getPoolId
();
List
<
String
>
fidList
=
requestVo
.
getFidList
();
log
.
info
(
"店员特征池删除数据操作开始:[{}]"
,
poolId
);
try
{
personService
.
deletePersonByFid
(
poolId
,
fidList
);
log
.
info
(
"店员特征池删除操作完成:[{}]"
,
poolId
);
return
ResponseVo
.
success
(
rid
);
}
catch
(
ElasticsearchException
e
)
{
if
(
e
.
status
()
==
404
)
{
return
ResponseVo
.
poolIdNotExists
(
rid
);
}
else
{
return
ResponseVo
.
error
(
rid
,
e
.
getMessage
());
}
}
}
/**
* 修改特征池(添加人员)
*
...
...
@@ -243,73 +279,22 @@ public class PoolService {
public
TypeMapping
.
Builder
getCreateIndexContentBuilder
()
throws
IOException
{
// JSONObject content = new JSONObject();
// JSONObject properties = new JSONObject();
// JSONObject data = new JSONObject();
// data.put("type", "dense_vector");
// data.put("dims", Constant.FACE_FEATURE_DIMS);
// JSONObject body = new JSONObject();
// body.put("type", "dense_vector");
// body.put("dims", Constant.BODY_FEATURE_DIMS_2048);
// JSONObject personId = new JSONObject();
// personId.put("type", "keyword");
//
// JSONObject unid = new JSONObject();
// unid.put("type", "keyword");
// JSONObject fid = new JSONObject();
// fid.put("type", "text");
// JSONObject age = new JSONObject();
// age.put("type", "integer");
// age.put("doc_values", false);
// age.put("index", false);
// JSONObject gender = new JSONObject();
// gender.put("type", "keyword");
// gender.put("doc_values", false);
// gender.put("index", false);
// JSONObject counttime = new JSONObject();
// counttime.put("type", "date");
// counttime.put("format", "yyyy-MM-dd HH:mm:ss");
// JSONObject channelSerialNum = new JSONObject();
// channelSerialNum.put("type", "keyword");
// JSONObject body_type = new JSONObject();
// body_type.put("type", "integer");
// body_type.put("doc_values", false);
// body_type.put("index", false);
// JSONObject direction = new JSONObject();
// direction.put("type", "keyword");
// JSONObject gateId = new JSONObject();
// gateId.put("type", "long");
// properties.put("data", data);
// properties.put("body", body);
// properties.put("personId", personId);
// properties.put("unid", unid);
// properties.put("fid", fid);
// properties.put("age", age);
// properties.put("gender", gender);
// properties.put("counttime", counttime);
// properties.put("channelSerialNum", channelSerialNum);
// properties.put("body_type", body_type);
// properties.put("gateId", gateId);
// properties.put("direction", direction);
//
// InputStream is = new ByteArrayInputStream(properties.toJSONString().getBytes());
Map
<
String
,
Property
>
properties1
=
new
HashMap
<>();
properties1
.
put
(
"direction"
,
new
Property
.
Builder
().
keyword
(
k
->
k
.
index
(
true
)).
build
());
properties1
.
put
(
"fid"
,
new
Property
.
Builder
().
text
(
t
->
t
.
index
(
true
)).
build
());
properties1
.
put
(
"gateId"
,
new
Property
.
Builder
().
long_
(
t
->
t
.
index
(
true
)).
build
());
properties1
.
put
(
"personId"
,
new
Property
.
Builder
().
keyword
(
k
->
k
.
index
(
true
)).
build
());
properties1
.
put
(
"body"
,
new
Property
.
Builder
().
denseVector
(
d
->
d
.
dims
(
Constant
.
BODY_FEATURE_DIMS_2048
).
similarity
(
"cosine"
)).
build
());
properties1
.
put
(
"data"
,
new
Property
.
Builder
().
denseVector
(
d
->
d
.
dims
(
Constant
.
FACE_FEATURE_DIMS
).
similarity
(
"cosine"
)).
build
());
properties1
.
put
(
"body_type"
,
new
Property
.
Builder
().
integer
(
i
->
i
.
index
(
false
).
docValues
(
false
)).
build
());
properties1
.
put
(
"channelSerialNum"
,
new
Property
.
Builder
().
keyword
(
k
->
k
.
index
(
true
)).
build
());
properties1
.
put
(
"age"
,
new
Property
.
Builder
().
integer
(
i
->
i
.
index
(
false
).
docValues
(
false
)).
build
());
properties1
.
put
(
"gender"
,
new
Property
.
Builder
().
keyword
(
k
->
k
.
index
(
false
).
docValues
(
false
)).
build
());
properties1
.
put
(
"counttime"
,
new
Property
.
Builder
().
date
(
d
->
d
.
format
(
"yyyy-MM-dd HH:mm:ss"
)).
build
());
properties1
.
put
(
"unid"
,
new
Property
.
Builder
().
keyword
(
k
->
k
.
index
(
true
)).
build
());
Map
<
String
,
Property
>
properties
=
new
HashMap
<>();
properties
.
put
(
"direction"
,
new
Property
.
Builder
().
keyword
(
k
->
k
.
index
(
true
)).
build
());
properties
.
put
(
"fid"
,
new
Property
.
Builder
().
text
(
t
->
t
.
index
(
true
)).
build
());
properties
.
put
(
"gateId"
,
new
Property
.
Builder
().
long_
(
t
->
t
.
index
(
true
)).
build
());
properties
.
put
(
"personId"
,
new
Property
.
Builder
().
keyword
(
k
->
k
.
index
(
true
)).
build
());
properties
.
put
(
"body"
,
new
Property
.
Builder
().
denseVector
(
d
->
d
.
dims
(
Constant
.
BODY_FEATURE_DIMS_2048
).
similarity
(
"cosine"
)).
build
());
properties
.
put
(
"data"
,
new
Property
.
Builder
().
denseVector
(
d
->
d
.
dims
(
Constant
.
FACE_FEATURE_DIMS
).
similarity
(
"cosine"
)).
build
());
properties
.
put
(
"body_type"
,
new
Property
.
Builder
().
integer
(
i
->
i
.
index
(
false
).
docValues
(
false
)).
build
());
properties
.
put
(
"channelSerialNum"
,
new
Property
.
Builder
().
keyword
(
k
->
k
.
index
(
true
)).
build
());
properties
.
put
(
"age"
,
new
Property
.
Builder
().
integer
(
i
->
i
.
index
(
false
).
docValues
(
false
)).
build
());
properties
.
put
(
"gender"
,
new
Property
.
Builder
().
keyword
(
k
->
k
.
index
(
false
).
docValues
(
false
)).
build
());
properties
.
put
(
"counttime"
,
new
Property
.
Builder
().
date
(
d
->
d
.
format
(
"yyyy-MM-dd HH:mm:ss"
)).
build
());
properties
.
put
(
"unid"
,
new
Property
.
Builder
().
keyword
(
k
->
k
.
index
(
true
)).
build
());
properties
.
put
(
"mallId"
,
new
Property
.
Builder
().
keyword
(
k
->
k
.
index
(
true
)).
build
());
// builder.properties(properties1);
TypeMapping
.
Builder
builder
=
new
TypeMapping
.
Builder
().
properties
(
properties1
);
TypeMapping
.
Builder
builder
=
new
TypeMapping
.
Builder
().
properties
(
properties
);
return
builder
;
}
...
...
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