Commit 6f5de97a by 姚冰

[chg] 合并索引合并分支

1 parent 5b458050
......@@ -371,19 +371,19 @@ public class PersonService {
return client.deleteByQuery(deleteByQueryRequest);
}
public BulkByScrollResponse 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 DeleteByQueryResponse 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;
}
}
......@@ -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());
// }
// }
// }
/**
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!