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 6f5de97a
authored
Oct 24, 2024
by
姚冰
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[chg] 合并索引合并分支
1 parent
5b458050
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
58 deletions
src/main/java/com/viontech/match/service/PersonService.java
src/main/java/com/viontech/match/service/PoolService.java
src/main/java/com/viontech/match/service/PersonService.java
View file @
6f5de97
...
...
@@ -371,19 +371,19 @@ public class PersonService {
return
client
.
deleteByQuery
(
deleteByQueryRequest
);
}
public
BulkByScroll
Response
deletePersonByMallId
(
String
poolId
,
Long
mallId
)
throws
IOException
{
DeleteByQueryRequest
deleteByQueryRequest
=
new
DeleteByQueryRequest
(
poolId
)
.
setQuery
(
new
TermQueryBuilder
(
"mallId"
,
mallId
))
.
setRefresh
(
true
);
return
client
.
deleteByQuery
(
deleteByQueryRequest
,
RequestOptions
.
DEFAULT
);
}
// public DeleteByQuery
Response deletePersonByMallId(String poolId, Long mallId) throws IOException {
//
DeleteByQueryRequest deleteByQueryRequest = new DeleteByQueryRequest(poolId)
//
.setQuery(new TermQueryBuilder("mallId", mallId))
//
.setRefresh(true);
//
return client.deleteByQuery(deleteByQueryRequest, RequestOptions.DEFAULT);
//
}
public
BulkByScrollResponse
deletePersonByFid
(
String
poolId
,
List
<
String
>
fidList
)
throws
IOException
{
DeleteByQueryRequest
deleteByQueryRequest
=
new
DeleteByQueryRequest
(
poolId
)
.
setQuery
(
new
TermsQueryBuilder
(
"fid"
,
fidList
))
.
setRefresh
(
true
);
return
client
.
deleteByQuery
(
deleteByQueryRequest
,
RequestOptions
.
DEFAULT
);
}
//
public BulkByScrollResponse deletePersonByFid(String poolId, List<String> fidList) throws IOException {
//
DeleteByQueryRequest deleteByQueryRequest = new DeleteByQueryRequest(poolId)
//
.setQuery(new TermsQueryBuilder("fid", fidList))
//
.setRefresh(true);
//
return client.deleteByQuery(deleteByQueryRequest, RequestOptions.DEFAULT);
//
}
/**
...
...
@@ -527,7 +527,8 @@ public class PersonService {
}
//根据mallId过滤
if
(
person
.
getMallId
()
!=
null
)
{
boolQuery
.
filter
().
add
(
QueryBuilders
.
termQuery
(
"mallId"
,
person
.
getMallId
()));
// boolQuery.filter().add(QueryBuilders.termQuery("mallId", person.getMallId()));
queries
.
add
(
QueryBuilders
.
term
().
field
(
"mallId"
).
value
(
person
.
getMallId
()).
build
().
_toQuery
());
}
// 根据通道号过滤
List
<
String
>
channelSerialNums
=
person
.
getChannelSerialNums
();
...
...
@@ -655,13 +656,14 @@ public class PersonService {
if
(!
poolId
.
contains
(
"staff"
))
{
return
true
;
}
BoolQueryBuilder
builder
=
new
BoolQueryBuilder
();
builder
.
filter
(
QueryBuilders
.
termQuery
(
"mallId"
,
mallId
));
CountRequest
countRequest
=
new
CountRequest
(
poolId
);
countRequest
.
query
(
builder
);
CountResponse
response
=
client
.
count
(
countRequest
,
RequestOptions
.
DEFAULT
);
log
.
info
(
"特征池:{}中mallId:{}的数据量为:{}"
,
poolId
,
mallId
,
response
.
getCount
());
return
response
.
getCount
()
>
0
;
// BoolQueryBuilder builder = new BoolQueryBuilder();
// builder.filter(QueryBuilders.termQuery("mallId", mallId));
CountRequest
countRequest
=
new
CountRequest
.
Builder
().
index
(
poolId
).
query
(
new
BoolQuery
.
Builder
().
filter
(
f
->
f
.
term
(
t
->
t
.
field
(
"mallId"
).
value
(
mallId
))).
build
().
_toQuery
())
.
build
();
// countRequest.query(builder);
CountResponse
response
=
client
.
count
(
countRequest
);
log
.
info
(
"特征池:{}中mallId:{}的数据量为:{}"
,
poolId
,
mallId
,
response
.
count
());
return
response
.
count
()
>
0
;
}
}
src/main/java/com/viontech/match/service/PoolService.java
View file @
6f5de97
...
...
@@ -202,44 +202,24 @@ 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
(
ElasticsearchStatusException
e
)
{
if
(
e
.
status
()
==
RestStatus
.
NOT_FOUND
)
{
return
ResponseVo
.
poolIdNotExists
(
rid
);
}
else
{
return
ResponseVo
.
error
(
rid
,
e
.
getDetailedMessage
());
}
}
}
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
(
ElasticsearchStatusException
e
)
{
if
(
e
.
status
()
==
RestStatus
.
NOT_FOUND
)
{
return
ResponseVo
.
poolIdNotExists
(
rid
);
}
else
{
return
ResponseVo
.
error
(
rid
,
e
.
getDetailedMessage
());
}
}
}
// 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());
// }
// }
// }
/**
...
...
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