Commit 6f5de97a by 姚冰

[chg] 合并索引合并分支

1 parent 5b458050
...@@ -371,19 +371,19 @@ public class PersonService { ...@@ -371,19 +371,19 @@ public class PersonService {
return client.deleteByQuery(deleteByQueryRequest); return client.deleteByQuery(deleteByQueryRequest);
} }
public BulkByScrollResponse deletePersonByMallId(String poolId, Long mallId) throws IOException { // public DeleteByQueryResponse deletePersonByMallId(String poolId, Long mallId) throws IOException {
DeleteByQueryRequest deleteByQueryRequest = new DeleteByQueryRequest(poolId) // DeleteByQueryRequest deleteByQueryRequest = new DeleteByQueryRequest(poolId)
.setQuery(new TermQueryBuilder("mallId", mallId)) // .setQuery(new TermQueryBuilder("mallId", mallId))
.setRefresh(true); // .setRefresh(true);
return client.deleteByQuery(deleteByQueryRequest, RequestOptions.DEFAULT); // return client.deleteByQuery(deleteByQueryRequest, RequestOptions.DEFAULT);
} // }
public BulkByScrollResponse deletePersonByFid(String poolId, List<String> fidList) throws IOException { // public BulkByScrollResponse deletePersonByFid(String poolId, List<String> fidList) throws IOException {
DeleteByQueryRequest deleteByQueryRequest = new DeleteByQueryRequest(poolId) // DeleteByQueryRequest deleteByQueryRequest = new DeleteByQueryRequest(poolId)
.setQuery(new TermsQueryBuilder("fid", fidList)) // .setQuery(new TermsQueryBuilder("fid", fidList))
.setRefresh(true); // .setRefresh(true);
return client.deleteByQuery(deleteByQueryRequest, RequestOptions.DEFAULT); // return client.deleteByQuery(deleteByQueryRequest, RequestOptions.DEFAULT);
} // }
/** /**
...@@ -527,7 +527,8 @@ public class PersonService { ...@@ -527,7 +527,8 @@ public class PersonService {
} }
//根据mallId过滤 //根据mallId过滤
if (person.getMallId() != null) { 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(); List<String> channelSerialNums = person.getChannelSerialNums();
...@@ -655,13 +656,14 @@ public class PersonService { ...@@ -655,13 +656,14 @@ public class PersonService {
if (!poolId.contains("staff")) { if (!poolId.contains("staff")) {
return true; return true;
} }
BoolQueryBuilder builder = new BoolQueryBuilder(); // BoolQueryBuilder builder = new BoolQueryBuilder();
builder.filter(QueryBuilders.termQuery("mallId", mallId)); // builder.filter(QueryBuilders.termQuery("mallId", mallId));
CountRequest countRequest = new CountRequest(poolId); CountRequest countRequest = new CountRequest.Builder().index(poolId).query(new BoolQuery.Builder().filter(f -> f.term(t -> t.field("mallId").value(mallId))).build()._toQuery())
countRequest.query(builder); .build();
CountResponse response = client.count(countRequest, RequestOptions.DEFAULT); // countRequest.query(builder);
log.info("特征池:{}中mallId:{}的数据量为:{}", poolId, mallId, response.getCount()); CountResponse response = client.count(countRequest);
return response.getCount() > 0; log.info("特征池:{}中mallId:{}的数据量为:{}", poolId, mallId, response.count());
return response.count() > 0;
} }
} }
...@@ -202,44 +202,24 @@ public class PoolService { ...@@ -202,44 +202,24 @@ public class PoolService {
} }
public ResponseVo deletePoolData(RequestVo requestVo) throws Exception { // public ResponseVo deletePoolData(RequestVo requestVo) throws Exception {
String rid = requestVo.getRid(); // String rid = requestVo.getRid();
Integer flushPool = requestVo.getFlushPool(); // Integer flushPool = requestVo.getFlushPool();
String poolId = requestVo.getPoolId(); // String poolId = requestVo.getPoolId();
Long mallId = requestVo.getMallId(); // Long mallId = requestVo.getMallId();
log.info("特征池删除mallId:{}数据操作开始:[{}]", mallId,poolId); // log.info("特征池删除mallId:{}数据操作开始:[{}]", mallId,poolId);
try { // try {
personService.deletePersonByMallId(poolId, mallId); // personService.deletePersonByMallId(poolId, mallId);
log.info("特征池删除mallId:{}操作完成:[{}]", mallId, poolId); // log.info("特征池删除mallId:{}操作完成:[{}]", mallId, poolId);
return ResponseVo.success(rid); // return ResponseVo.success(rid);
} catch (ElasticsearchStatusException e) { // } catch (ElasticsearchException e) {
if (e.status() == RestStatus.NOT_FOUND) { // if (e.status() == 404) {
return ResponseVo.poolIdNotExists(rid); // return ResponseVo.poolIdNotExists(rid);
} else { // } else {
return ResponseVo.error(rid, e.getDetailedMessage()); // 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 (ElasticsearchStatusException e) {
if (e.status() == RestStatus.NOT_FOUND) {
return ResponseVo.poolIdNotExists(rid);
} else {
return ResponseVo.error(rid, e.getDetailedMessage());
}
}
}
/** /**
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!