diff --git a/adc-da-slrs/src/main/java/com/adc/da/search/ResetSearchCenterController.java b/adc-da-slrs/src/main/java/com/adc/da/search/ResetSearchCenterController.java index 93ea333b..e4fb0d71 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/search/ResetSearchCenterController.java +++ b/adc-da-slrs/src/main/java/com/adc/da/search/ResetSearchCenterController.java @@ -175,4 +175,14 @@ public class ResetSearchCenterController extends BaseController 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> searchListData = elasticsearchService.searchAll("bussstand",search); + + List esIdList = searchListData.stream().map(stringObjectMap -> stringObjectMap.get("id").toString()).collect(Collectors.toList()); + + //如果时自动触发,删除需要根据全部的结果进行数据处理 +// List delList = new ArrayList<>(); +// +// if(!esIdList.isEmpty()){ +// +// List finalStandIdList = null; +// List finalStandIdList1 = finalStandIdList; +// List 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> searchListData = elasticsearchService.searchAll("stand",search); + + List esIdList = searchListData.stream().map(stringObjectMap -> stringObjectMap.get("id").toString()).collect(Collectors.toList()); +// +// //如果时自动触发,删除需要根据全部的结果进行数据处理 +// List delList = new ArrayList<>(); +// +// List finalStandIdList = null; +// +// List finalStandIdList1 = finalStandIdList; +// List 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()+"条数据"); + } + } diff --git a/adc-da-slrs/src/main/resources/mysql/interfaceLog.sql b/adc-da-slrs/src/main/resources/mysql/interfaceLog.sql index 930ef31a..7d091d5d 100644 --- a/adc-da-slrs/src/main/resources/mysql/interfaceLog.sql +++ b/adc-da-slrs/src/main/resources/mysql/interfaceLog.sql @@ -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 --详情