手动全部删除es中的国内外和企标数据,慎用
This commit is contained in:
@@ -175,4 +175,14 @@ public class ResetSearchCenterController extends BaseController<Map<String, Obje
|
|||||||
}
|
}
|
||||||
return resetSearchCenterServiceTemp.syncResetALLSearchCenter(searchCenter);
|
return resetSearchCenterServiceTemp.syncResetALLSearchCenter(searchCenter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "|SearchCenter|手动删除ES中国内外和企标数据")
|
||||||
|
@PostMapping(value = "/deleteES")
|
||||||
|
public ResponseMessage deleteES(@RequestBody SearchCenter searchCenter) throws Exception {
|
||||||
|
ResponseMessage x = verifySearchCenter(searchCenter);
|
||||||
|
if (x != null) {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
return resetSearchCenterServiceTemp.deleteES(searchCenter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -812,4 +812,128 @@ public class ResetSearchCenterServiceTemp {
|
|||||||
|
|
||||||
return resultMap;
|
return resultMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Async
|
||||||
|
public ResponseMessage deleteES(SearchCenter searchCenter)throws Exception {
|
||||||
|
SearchCenter standSearch = new SearchCenter();
|
||||||
|
standSearch.setExecType(searchCenter.getExecType());
|
||||||
|
ResponseMessage stand = standSearchCenter(standSearch);
|
||||||
|
List<String> r = new ArrayList<>();
|
||||||
|
if(stand.isOk() && StringUtils.isNotBlank(stand.getData().toString())){
|
||||||
|
r.add(stand.getData().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
SearchCenter bussSearch = new SearchCenter();
|
||||||
|
bussSearch.setExecType(searchCenter.getExecType());
|
||||||
|
ResponseMessage buss = bussStandSearchCenter(bussSearch);
|
||||||
|
if(buss.isOk() && StringUtils.isNotBlank(buss.getData().toString())){
|
||||||
|
r.add(buss.getData().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
String res = String.join(", ", r);
|
||||||
|
logger.info(res);
|
||||||
|
|
||||||
|
return Result.success(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Async
|
||||||
|
public ResponseMessage bussStandSearchCenter(SearchCenter searchCenter)throws Exception {
|
||||||
|
Boolean getbussstandIndex = elasticsearchService.isIndexExist("bussstand");
|
||||||
|
|
||||||
|
if(!getbussstandIndex){
|
||||||
|
logger.info("ES 不存在索引:bussstand");
|
||||||
|
return Result.error("ES 不存在索引:bussstand");
|
||||||
|
}
|
||||||
|
|
||||||
|
String search = getSearch(searchCenter);
|
||||||
|
|
||||||
|
List<Map<String, Object>> searchListData = elasticsearchService.searchAll("bussstand",search);
|
||||||
|
|
||||||
|
List<String> esIdList = searchListData.stream().map(stringObjectMap -> stringObjectMap.get("id").toString()).collect(Collectors.toList());
|
||||||
|
|
||||||
|
//如果时自动触发,删除需要根据全部的结果进行数据处理
|
||||||
|
// List<String> delList = new ArrayList<>();
|
||||||
|
//
|
||||||
|
// if(!esIdList.isEmpty()){
|
||||||
|
//
|
||||||
|
// List<String> finalStandIdList = null;
|
||||||
|
// List<String> finalStandIdList1 = finalStandIdList;
|
||||||
|
// List<String> delDataList = esIdList.stream().filter(num -> !finalStandIdList1.contains(num))
|
||||||
|
// .collect(Collectors.toList());
|
||||||
|
// // 可以更新IDLIST 删除 ES
|
||||||
|
// if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && "DEL".equals(searchCenter.getExecType().toUpperCase())){
|
||||||
|
// delList.addAll(searchCenter.getIdList());
|
||||||
|
// }else{
|
||||||
|
// delList.addAll(delDataList);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// if(!delList.isEmpty() && ("DEL".equals(searchCenter.getExecType().toUpperCase()) || "ALL".equals(searchCenter.getExecType().toUpperCase()))){
|
||||||
|
// elasticsearchService.deleteBatchId(delList,"bussstand");
|
||||||
|
// elasticsearchService.deleteBatchId(delList,"fulltextserch");
|
||||||
|
// logger.info("重置企标:删除-共"+delList.size()+"条数据");
|
||||||
|
// }else{
|
||||||
|
// logger.info("重置企标:没有删除数据,但应该删除"+delList.size()+"条数据");
|
||||||
|
// }
|
||||||
|
|
||||||
|
if(!esIdList.isEmpty() && ("DEL".equals(searchCenter.getExecType().toUpperCase()) || "ALL".equals(searchCenter.getExecType().toUpperCase()))){
|
||||||
|
elasticsearchService.deleteBatchId(esIdList,"bussstand");
|
||||||
|
elasticsearchService.deleteBatchId(esIdList,"fulltextserch");
|
||||||
|
logger.info("重置企标:删除-共"+esIdList.size()+"条数据");
|
||||||
|
}else{
|
||||||
|
logger.info("重置企标:没有删除数据,但应该删除"+esIdList.size()+"条数据");
|
||||||
|
}
|
||||||
|
return Result.success("重置企标:删除-共"+esIdList.size()+"条数据");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Async
|
||||||
|
public ResponseMessage standSearchCenter(SearchCenter searchCenter)throws Exception {
|
||||||
|
Boolean getStandIndex = elasticsearchService.isIndexExist("stand");
|
||||||
|
|
||||||
|
if(!getStandIndex){
|
||||||
|
logger.info("ES 不存在索引:stand");
|
||||||
|
return Result.error("ES 不存在索引:stand");
|
||||||
|
}
|
||||||
|
|
||||||
|
String search = getSearch(searchCenter);
|
||||||
|
|
||||||
|
List<Map<String, Object>> searchListData = elasticsearchService.searchAll("stand",search);
|
||||||
|
|
||||||
|
List<String> esIdList = searchListData.stream().map(stringObjectMap -> stringObjectMap.get("id").toString()).collect(Collectors.toList());
|
||||||
|
//
|
||||||
|
// //如果时自动触发,删除需要根据全部的结果进行数据处理
|
||||||
|
// List<String> delList = new ArrayList<>();
|
||||||
|
//
|
||||||
|
// List<String> finalStandIdList = null;
|
||||||
|
//
|
||||||
|
// List<String> finalStandIdList1 = finalStandIdList;
|
||||||
|
// List<String> delDataList = esIdList.stream().filter(num -> !finalStandIdList1.contains(num))
|
||||||
|
// .collect(Collectors.toList());
|
||||||
|
// // 可以更新IDLIST 删除 ES
|
||||||
|
// if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && "DEL".equals(searchCenter.getExecType().toUpperCase())){
|
||||||
|
// delList.addAll(searchCenter.getIdList());
|
||||||
|
// }else{
|
||||||
|
// delList.addAll(delDataList);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if(!delList.isEmpty() && ("DEL".equals(searchCenter.getExecType().toUpperCase()) || "ALL".equals(searchCenter.getExecType().toUpperCase()))){
|
||||||
|
// elasticsearchService.deleteBatchId(delList,"stand");
|
||||||
|
// elasticsearchService.deleteBatchId(delList,"fulltextserch");
|
||||||
|
// logger.info("重置国内外标准:删除-共"+delList.size()+"条数据");
|
||||||
|
// }else{
|
||||||
|
// logger.info("重置国内外标准:没有删除数据,但应该删除"+delList.size()+"条数据");
|
||||||
|
// }
|
||||||
|
|
||||||
|
if(!esIdList.isEmpty() && ("DEL".equals(searchCenter.getExecType().toUpperCase()) || "ALL".equals(searchCenter.getExecType().toUpperCase()))){
|
||||||
|
elasticsearchService.deleteBatchId(esIdList,"stand");
|
||||||
|
elasticsearchService.deleteBatchId(esIdList,"fulltextserch");
|
||||||
|
logger.info("重置国内外标准:删除-共"+esIdList.size()+"条数据");
|
||||||
|
}else{
|
||||||
|
logger.info("重置国内外标准:没有删除数据,但应该删除"+esIdList.size()+"条数据");
|
||||||
|
}
|
||||||
|
return Result.success("重置国内外标准:删除-共"+esIdList.size()+"条数据");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
-- 福田 需要通过第三方调用的接口
|
-- 福田 需要通过第三方调用的接口
|
||||||
|
|
||||||
|
--2023-06-012 14:33
|
||||||
|
--名称 手动全部删除es中的国内外和企标数据,慎用
|
||||||
|
--详情
|
||||||
|
--路径 http://39.98.140.126:4201/api/search/resetSearchCenter/deleteES
|
||||||
|
--参数 json格式 {"execType":"ALL"}
|
||||||
|
--类型 post
|
||||||
|
|
||||||
--2023-06-01 09:41
|
--2023-06-01 09:41
|
||||||
--名称 存在重新技术委员会评审、评审意见修改时将技术委员会评审、评审意见修改的评分更新成0
|
--名称 存在重新技术委员会评审、评审意见修改时将技术委员会评审、评审意见修改的评分更新成0
|
||||||
--详情
|
--详情
|
||||||
|
|||||||
Reference in New Issue
Block a user