Merge remote-tracking branch 'origin/dev_20230216' into dev_20230216

This commit is contained in:
gaojiabao
2023-06-13 15:31:55 +08:00
4 changed files with 142 additions and 1 deletions
@@ -175,4 +175,14 @@ public class ResetSearchCenterController extends BaseController<Map<String, Obje
}
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;
}
@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()+"条数据");
}
}
@@ -273,7 +273,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
if(ObjectUtils.isNotEmpty(bussionessStand)){
sn = bussionessStand.getNewStandSn();
}
if (StringUtils.isBlank(MaxSn) && (StringUtils.isBlank(snStandSort) || snStandSort.equals(standSort))){
if ((StringUtils.isBlank(MaxSn) || !MaxSn.equals(standMaxSn)) && (StringUtils.isBlank(snStandSort) || snStandSort.equals(standSort))){
saveBussStandSn(reviseStatus, standSort, sn, taskId);
}
bussionessStand.setStandSn(sn);
@@ -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
--名称 存在重新技术委员会评审、评审意见修改时将技术委员会评审、评审意见修改的评分更新成0
--详情