Merge branch 'develop_master' into FOTON

This commit is contained in:
super_liu
2022-05-10 16:56:21 +08:00
9 changed files with 438 additions and 23 deletions
@@ -122,6 +122,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
// 重置ES // 重置ES
addInterceptor.excludePathPatterns("/api/search/resetSearchCenter/resetALLSearchCenter"); addInterceptor.excludePathPatterns("/api/search/resetSearchCenter/resetALLSearchCenter");
addInterceptor.excludePathPatterns("/api/search/resetSearchCenter/manualResetALLSearchCenter"); addInterceptor.excludePathPatterns("/api/search/resetSearchCenter/manualResetALLSearchCenter");
addInterceptor.excludePathPatterns("/api/search/resetSearchCenter/resetALLSearchCenterToSearch");
addInterceptor.excludePathPatterns("/api/search/resetSearchCenter/resetAStandSearchCenter"); addInterceptor.excludePathPatterns("/api/search/resetSearchCenter/resetAStandSearchCenter");
addInterceptor.excludePathPatterns("/api/search/resetSearchCenter/resetBLawsSearchCenter"); addInterceptor.excludePathPatterns("/api/search/resetSearchCenter/resetBLawsSearchCenter");
addInterceptor.excludePathPatterns("/api/search/resetSearchCenter/resetCBussStandSearchCenter"); addInterceptor.excludePathPatterns("/api/search/resetSearchCenter/resetCBussStandSearchCenter");
@@ -122,7 +122,7 @@ public interface ElasticsearchService {
* 使用索引查询所有 * 使用索引查询所有
*/ */
List<Map<String,Object>> searchAll(String index); List<Map<String,Object>> searchAll(String index,String search);
/** /**
* 使用分词查询 * 使用分词查询
@@ -284,7 +284,7 @@ public class ElasticsearchServiceImpl implements ElasticsearchService {
* 使用索引查询所有 * 使用索引查询所有
*/ */
@Override @Override
public List<Map<String, Object>> searchAll(String index) { public List<Map<String, Object>> searchAll(String index,String search) {
List<Map<String, Object>> sourceList = new ArrayList<Map<String, Object>>(); List<Map<String, Object>> sourceList = new ArrayList<Map<String, Object>>();
//1、指定es集群 cluster.name 是固定的key值,my-application是ES集群的名称 //1、指定es集群 cluster.name 是固定的key值,my-application是ES集群的名称
@@ -295,7 +295,18 @@ public class ElasticsearchServiceImpl implements ElasticsearchService {
.get(); .get();
SearchHits hits = sResponse.getHits(); SearchHits hits = sResponse.getHits();
if(hits.getTotalHits().value > 0){ if(hits.getTotalHits().value > 0){
SearchResponse scrollResp = search(index,qBuilder, 1,(int) hits.getTotalHits().value); BoolQueryBuilder boolSelectValue = new BoolQueryBuilder();
if(StringUtils.isNotBlank(search)){
boolSelectValue
.should(QueryBuilders.wildcardQuery("sortTitle.keyword", "*" + search.toUpperCase() + "*").boost(1005f))
.should(QueryBuilders.wildcardQuery("numberTitle.keyword", "*" + search.toUpperCase() + "*").boost(1003f))
.should(QueryBuilders.wildcardQuery("yearOrder.keyword", "*" + search.toUpperCase() + "*").boost(1002f))
.should(QueryBuilders.wildcardQuery("nameTitle.keyword", "*" + search.toUpperCase() + "*").boost(1001f))
.should(QueryBuilders.wildcardQuery("title.keyword", "*" + search + "*").boost(1000f))
.should(QueryBuilders.wildcardQuery("textContent.keyword", "*" + search.toUpperCase() + "*").boost(0.0000000000000000000000000000000001f))
.should(QueryBuilders.wildcardQuery("issue_time", "*" + search.toUpperCase() + "*"));
}
SearchResponse scrollResp = search(index,boolSelectValue, 1,(int) hits.getTotalHits().value);
for (SearchHit hit : scrollResp.getHits().getHits()) { for (SearchHit hit : scrollResp.getHits().getHits()) {
sourceList.add(hit.getSourceAsMap()); sourceList.add(hit.getSourceAsMap());
} }
@@ -12,6 +12,8 @@ import com.adc.da.util.http.Result;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -29,6 +31,17 @@ public class ResetSearchCenterController extends BaseController<Map<String, Obje
@Autowired @Autowired
private ResetSearchCenterService resetSearchCenterService; private ResetSearchCenterService resetSearchCenterService;
@ApiOperation(value = "|Search|文本条件搜索更新标准数据索引")
@PostMapping(value="/resetALLSearchCenterToSearch")
public ResponseMessage resetALLSearchCenterToSearch(@RequestBody SearchCenter searchCenter) throws Exception{
ResponseMessage x = verifySearchCenter(searchCenter);
if (x != null){
return x;
}
return resetSearchCenterService.resetALLSearchCenterToSearch(searchCenter);
}
@ApiOperation(value = "|SearchCenter|重新创建ALL标准数据索引") @ApiOperation(value = "|SearchCenter|重新创建ALL标准数据索引")
@PostMapping(value="/resetALLSearchCenter") @PostMapping(value="/resetALLSearchCenter")
public ResponseMessage resetALLSearchCenter(@RequestBody SearchCenter searchCenter) throws Exception{ public ResponseMessage resetALLSearchCenter(@RequestBody SearchCenter searchCenter) throws Exception{
@@ -15,6 +15,9 @@ import java.util.List;
@Data @Data
public class SearchCenter { public class SearchCenter {
@ApiModelProperty(value = "根据搜索条件")
private String search;
// @ApiModelProperty(value = "分页查询总数 可不填 自动带入总数") // @ApiModelProperty(value = "分页查询总数 可不填 自动带入总数")
// private Integer countStand; // private Integer countStand;
@@ -105,11 +105,66 @@ public class ResetSearchCenterService {
client = this.transportClient; client = this.transportClient;
} }
@Async
public ResponseMessage resetALLSearchCenterToSearch(SearchCenter searchCenter) throws Exception{
Boolean getFulltextserchIndex = elasticsearchService.isIndexExist("fulltextserch");
SearchCenter standSearch = new SearchCenter();
standSearch.setExecType(searchCenter.getExecType());
if(StringUtils.isNotBlank(searchCenter.getSearch())){
standSearch.setSearch(searchCenter.getSearch());
}
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty()){
standSearch.setIdList(searchCenter.getIdList());
}
SarStandardsInfoEOPage page = new SarStandardsInfoEOPage();
ResponseMessage stand = resetStandSearchCenterToSearch(page,standSearch);
List<String> r = new ArrayList<>();
if(stand.isOk() && StringUtils.isNotBlank(stand.getData().toString())){
r.add(stand.getData().toString());
}
SearchCenter lawsSearch = new SearchCenter();
lawsSearch.setExecType(searchCenter.getExecType());
if(StringUtils.isNotBlank(searchCenter.getSearch())){
lawsSearch.setSearch(searchCenter.getSearch());
}
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty()){
lawsSearch.setIdList(searchCenter.getIdList());
}
SarLawsStandInfoPage lawsPage = new SarLawsStandInfoPage();
ResponseMessage laws = resetLawsSearchCenterToSearch(lawsPage,lawsSearch);
if(laws.isOk() && StringUtils.isNotBlank(laws.getData().toString())){
r.add(laws.getData().toString());
}
SearchCenter bussSearch = new SearchCenter();
bussSearch.setExecType(searchCenter.getExecType());
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty()){
bussSearch.setIdList(searchCenter.getIdList());
}
if(StringUtils.isNotBlank(searchCenter.getSearch())){
bussSearch.setSearch(searchCenter.getSearch());
}
SarBussionessStandEOPage bussPage = new SarBussionessStandEOPage();
ResponseMessage buss = resetBussStandSearchCenterToSearch(bussPage,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 @Async
public ResponseMessage resetALLSearchCenter(SearchCenter searchCenter) throws Exception{ public ResponseMessage resetALLSearchCenter(SearchCenter searchCenter) throws Exception{
Boolean getFulltextserchIndex = elasticsearchService.isIndexExist("fulltextserch"); Boolean getFulltextserchIndex = elasticsearchService.isIndexExist("fulltextserch");
SearchCenter standSearch = new SearchCenter(); SearchCenter standSearch = new SearchCenter();
standSearch.setExecType(searchCenter.getExecType()); standSearch.setExecType(searchCenter.getExecType());
if(StringUtils.isNotBlank(searchCenter.getSearch())){
standSearch.setSearch(searchCenter.getSearch());
}
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty()){ if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty()){
standSearch.setIdList(searchCenter.getIdList()); standSearch.setIdList(searchCenter.getIdList());
} }
@@ -122,6 +177,9 @@ public class ResetSearchCenterService {
SearchCenter lawsSearch = new SearchCenter(); SearchCenter lawsSearch = new SearchCenter();
lawsSearch.setExecType(searchCenter.getExecType()); lawsSearch.setExecType(searchCenter.getExecType());
if(StringUtils.isNotBlank(searchCenter.getSearch())){
lawsSearch.setSearch(searchCenter.getSearch());
}
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty()){ if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty()){
lawsSearch.setIdList(searchCenter.getIdList()); lawsSearch.setIdList(searchCenter.getIdList());
} }
@@ -136,6 +194,9 @@ public class ResetSearchCenterService {
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty()){ if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty()){
bussSearch.setIdList(searchCenter.getIdList()); bussSearch.setIdList(searchCenter.getIdList());
} }
if(StringUtils.isNotBlank(searchCenter.getSearch())){
bussSearch.setSearch(searchCenter.getSearch());
}
SarBussionessStandEOPage bussPage = new SarBussionessStandEOPage(); SarBussionessStandEOPage bussPage = new SarBussionessStandEOPage();
ResponseMessage buss = resetBussStandSearchCenter(bussPage,bussSearch); ResponseMessage buss = resetBussStandSearchCenter(bussPage,bussSearch);
if(buss.isOk() && StringUtils.isNotBlank(buss.getData().toString())){ if(buss.isOk() && StringUtils.isNotBlank(buss.getData().toString())){
@@ -185,6 +246,78 @@ public class ResetSearchCenterService {
return Result.success(res); return Result.success(res);
} }
//重建国内外标准
@Async
public ResponseMessage resetStandSearchCenterToSearch(SarStandardsInfoEOPage page,SearchCenter searchCenter) throws Exception{
int countUpdateSuccess = 0;
int countAddSuccess = 0;
Boolean getStandIndex = elasticsearchService.isIndexExist("fulltextserch");
if(!getStandIndex){
logger.info("ES 不存在索引:fulltextserch");
return Result.error("ES 不存在索引:fulltextserch");
}
String search = getSearch(searchCenter);
List<Map<String, Object>> searchListData = elasticsearchService.searchAll("fulltextserch",search);
List<String> esIdList = searchListData.stream().map(stringObjectMap -> stringObjectMap.get("id").toString()).collect(Collectors.toList());
page.setValidFlag("0");
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty()){
String[] result = searchCenter.getIdList().toArray(new String[0]);
page.setIdlist(result);
}
QueryWrapper qw = new QueryWrapper();
qw.eq("VALID_FLAG","0");
int count = iSarStandardsInfoService.count(qw);
if(count > 0){
page.setPageSize(count);
page.setMenuId("nomenu");
page.setStandType("ALL");
List<SarStandardsInfo> rowsStand = iSarStandardsInfoService.getSarStandardsInfoPage(page);
List<SarStandardsInfo> insList = new ArrayList<>();
List<SarStandardsInfo> updList = new ArrayList<>();
List<String> delList = new ArrayList<>();
List<String> standIdList = rowsStand.stream().map(SarStandardsInfo::getId).collect(Collectors.toList());
if(!esIdList.isEmpty()){
// 交集 更新
List<SarStandardsInfo> intersection = rowsStand.stream()
.filter(item -> new ArrayList<>(esIdList)
.contains(item.getId()))
.collect(Collectors.toList());
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && !intersection.isEmpty()){
List<SarStandardsInfo> collect = intersection.stream()
.filter(item -> searchCenter.getIdList().contains(item.getId())).collect(Collectors.toList());
updList.addAll(collect);
}else{
updList.addAll(intersection);
}
}
if(!updList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "UPD".equals(searchCenter.getExecType().toUpperCase()))){
for(SarStandardsInfo sarStandardsInfoEO : updList){
countUpdateSuccess++;
standFunc(sarStandardsInfoEO);
createStandMQService.sendStandMQ(sarStandardsInfoEO,"update");
}
}
logger.info("重置国内外标准:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(国内外标准共:"+0+"条)删除-共"+delList.size()+"条数据");
return Result.success("重置国内外标准:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(国内外标准共:"+0+"条)删除-共"+delList.size()+"条数据");
}else {
logger.info("未查询到标准数据");
return Result.error("未查询到标准数据");
}
}
//重建国内外标准 //重建国内外标准
@Async @Async
public ResponseMessage resetStandSearchCenter(SarStandardsInfoEOPage page,SearchCenter searchCenter) throws Exception{ public ResponseMessage resetStandSearchCenter(SarStandardsInfoEOPage page,SearchCenter searchCenter) throws Exception{
@@ -199,7 +332,9 @@ public class ResetSearchCenterService {
return Result.error("ES 不存在索引:stand"); return Result.error("ES 不存在索引:stand");
} }
List<Map<String, Object>> searchListData = elasticsearchService.searchAll("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> esIdList = searchListData.stream().map(stringObjectMap -> stringObjectMap.get("id").toString()).collect(Collectors.toList());
@@ -296,6 +431,14 @@ public class ResetSearchCenterService {
} }
private String getSearch(SearchCenter searchCenter) {
String search = "";
if(StringUtils.isNotBlank(searchCenter.getSearch())) {
search = searchCenter.getSearch();
}
return search;
}
private void standFunc(SarStandardsInfo sarStandardsInfoEO) throws Exception { private void standFunc(SarStandardsInfo sarStandardsInfoEO) throws Exception {
attrInfoSearchDetails(sarStandardsInfoEO); attrInfoSearchDetails(sarStandardsInfoEO);
FindSarItemsPageReqDTO pageInfo = new FindSarItemsPageReqDTO(); FindSarItemsPageReqDTO pageInfo = new FindSarItemsPageReqDTO();
@@ -365,6 +508,93 @@ public class ResetSearchCenterService {
} }
} }
@Async
public ResponseMessage resetLawsSearchCenterToSearch(SarLawsStandInfoPage sarLawsInfoEOPage,SearchCenter searchCenter) throws Exception{
Boolean getLawsIndex = elasticsearchService.isIndexExist("fulltextserch");
if(!getLawsIndex){
logger.info("ES 不存在索引:fulltextserch");
return Result.error("ES 不存在索引:fulltextserch");
}
String search = getSearch(searchCenter);
List<Map<String, Object>> searchListData = elasticsearchService.searchAll("fulltextserch",search);
List<String> esIdList = searchListData.stream().map(stringObjectMap -> stringObjectMap.get("id").toString()).collect(Collectors.toList());
sarLawsInfoEOPage.setLawsType("FOREIGN");
// page idlist 赋值
idListFunc(sarLawsInfoEOPage, searchCenter);
int countUpdateSuccess = 0;
int countAddSuccess = 0;
QueryWrapper qw2 = new QueryWrapper();
qw2.eq("VALID_FLAG","0");
int count2 = iSarLawsStandInfoService.count(qw2);
if(count2 > 0){
sarLawsInfoEOPage.setPageSize(count2);
List<SarLawsStandInfo> rowsStand = iSarLawsStandInfoService.getSarStandardsInfoPage(sarLawsInfoEOPage);
List<SarLawsStandInfo> insList = new ArrayList<>();
List<SarLawsStandInfo> updList = new ArrayList<>();
List<String> delList = new ArrayList<>();
List<String> standIdList = rowsStand.stream().map(SarLawsStandInfo::getId).collect(Collectors.toList());
if(!esIdList.isEmpty()){
// 交集 更新
List<SarLawsStandInfo> intersection = rowsStand.stream()
.filter(item -> new ArrayList<>(esIdList)
.contains(item.getId()))
.collect(Collectors.toList());
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && !intersection.isEmpty()){
List<SarLawsStandInfo> collect = intersection.stream()
.filter(item -> searchCenter.getIdList().contains(item.getId())).collect(Collectors.toList());
updList.addAll(collect);
}else{
updList.addAll(intersection);
}
}
if(!updList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "UPD".equals(searchCenter.getExecType().toUpperCase()))){
for(SarLawsStandInfo sarLawsInfoEO : updList){
countUpdateSuccess++;
lawsAttrInfoShowSearchDetails(sarLawsInfoEO);
FindSarItemsPageReqDTO pageInfo = new FindSarItemsPageReqDTO();
pageInfo.setStandId(sarLawsInfoEO.getId());
pageInfo.setFileType("FBGBJBD");
/**
* SarItemVO换为sarItemVOS
* List<SarItemVO> sarItemVOS = standItemsDao.querySarItemAndInterpretation(pageInfo);
* .collect(Collectors.toMap(SarItemVO::getItemsNum, SarItemVO::getItemsName));
*/
List<SarLawsItems> sarItemVOS = sarLawsItemsDao.querySarItemAndInterpretation(pageInfo);
if(!sarItemVOS.isEmpty()){
Map<String,String> collectMap = sarItemVOS.stream().filter((e) -> e.getItemsNum() != null && e.getItemsName() != null)
.collect(Collectors.toMap(SarLawsItems::getItemsNum, SarLawsItems::getTermsConditions));
sarLawsInfoEO.setMapItems(collectMap);
}
if (sarLawsInfoEO.getAttrInfoMap() != null) {
sarLawsInfoEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarLawsInfoEO.getAttrInfoMap()));
}
createStandMQService.sendLawsMQ(sarLawsInfoEO,"update");
}
}
logger.info("重置国内外政策:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(国内外政策共:"+rowsStand.size()+"条)数据");
return Result.success("");
}else {
logger.info("未查询到国内外政策数据");
return Result.error("未查询到国内外政策数据");
}
}
@Async @Async
public ResponseMessage resetLawsSearchCenter(SarLawsStandInfoPage sarLawsInfoEOPage,SearchCenter searchCenter) throws Exception{ public ResponseMessage resetLawsSearchCenter(SarLawsStandInfoPage sarLawsInfoEOPage,SearchCenter searchCenter) throws Exception{
Boolean getLawsIndex = elasticsearchService.isIndexExist("laws"); Boolean getLawsIndex = elasticsearchService.isIndexExist("laws");
@@ -374,7 +604,9 @@ public class ResetSearchCenterService {
return Result.error("ES 不存在索引:laws"); return Result.error("ES 不存在索引:laws");
} }
List<Map<String, Object>> searchListData = elasticsearchService.searchAll("laws"); String search = getSearch(searchCenter);
List<Map<String, Object>> searchListData = elasticsearchService.searchAll("laws",search);
List<String> esIdList = searchListData.stream().map(stringObjectMap -> stringObjectMap.get("id").toString()).collect(Collectors.toList()); List<String> esIdList = searchListData.stream().map(stringObjectMap -> stringObjectMap.get("id").toString()).collect(Collectors.toList());
@@ -442,6 +674,25 @@ public class ResetSearchCenterService {
for(SarLawsStandInfo sarLawsInfoEO : updList){ for(SarLawsStandInfo sarLawsInfoEO : updList){
countUpdateSuccess++; countUpdateSuccess++;
lawsAttrInfoShowSearchDetails(sarLawsInfoEO); lawsAttrInfoShowSearchDetails(sarLawsInfoEO);
FindSarItemsPageReqDTO pageInfo = new FindSarItemsPageReqDTO();
pageInfo.setStandId(sarLawsInfoEO.getId());
pageInfo.setFileType("FBGBJBD");
/**
* SarItemVO换为sarItemVOS
* List<SarItemVO> sarItemVOS = standItemsDao.querySarItemAndInterpretation(pageInfo);
* .collect(Collectors.toMap(SarItemVO::getItemsNum, SarItemVO::getItemsName));
*/
List<SarLawsItems> sarItemVOS = sarLawsItemsDao.querySarItemAndInterpretation(pageInfo);
if(!sarItemVOS.isEmpty()){
Map<String,String> collectMap = sarItemVOS.stream().filter((e) -> e.getItemsNum() != null && e.getItemsName() != null)
.collect(Collectors.toMap(SarLawsItems::getItemsNum, SarLawsItems::getTermsConditions));
sarLawsInfoEO.setMapItems(collectMap);
}
if (sarLawsInfoEO.getAttrInfoMap() != null) {
sarLawsInfoEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarLawsInfoEO.getAttrInfoMap()));
}
createStandMQService.sendLawsMQ(sarLawsInfoEO,"update"); createStandMQService.sendLawsMQ(sarLawsInfoEO,"update");
} }
} }
@@ -571,6 +822,84 @@ public class ResetSearchCenterService {
} }
} }
/**
* 文本搜索
*/
@Async
public ResponseMessage resetBussStandSearchCenterToSearch(SarBussionessStandEOPage sarBussionessStandEOPage,SearchCenter searchCenter) throws Exception{
Boolean getbussstandIndex = elasticsearchService.isIndexExist("fulltextserch");
if(!getbussstandIndex){
logger.info("ES 不存在索引:fulltextserch");
return Result.error("ES 不存在索引:fulltextserch");
}
String search = getSearch(searchCenter);
List<Map<String, Object>> searchListData = elasticsearchService.searchAll("fulltextserch",search);
List<String> esIdList = searchListData.stream().map(stringObjectMap -> stringObjectMap.get("id").toString()).collect(Collectors.toList());
sarBussionessStandEOPage.setValidFlag("0");
sarBussionessStandEOPage.setOrderBy("SAR_BUSSIONESS_STAND.issue_time is null,SAR_BUSSIONESS_STAND.issue_time desc,SAR_BUSSIONESS_STAND.id");
sarBussionessStandEOPage.setMenuRoleList(null);
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty()){
String[] result = searchCenter.getIdList().toArray(new String[0]);
sarBussionessStandEOPage.setIdlist(result);
}
int countUpdateSuccess = 0;
int countAddSuccess = 0;
sarBussionessStandEOPage.setMenuId("0");
QueryWrapper qw3 = new QueryWrapper();
qw3.eq("VALID_FLAG","0");
int count3 = iSarBussionessStandService.count(qw3);
if(count3 > 0){
sarBussionessStandEOPage.setPageSize(count3);
List<SarBussionessStand> rowsStand = iSarBussionessStandService.getSarBussionStandPage(sarBussionessStandEOPage);
List<SarBussionessStand> insList = new ArrayList<>();
List<SarBussionessStand> updList = new ArrayList<>();
List<String> delList = new ArrayList<>();
List<String> standIdList = rowsStand.stream().map(SarBussionessStand::getId).collect(Collectors.toList());
if(!esIdList.isEmpty()){
// 交集 更新
List<SarBussionessStand> intersection = rowsStand.stream()
.filter(item -> new ArrayList<>(esIdList)
.contains(item.getId()))
.collect(Collectors.toList());
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && !intersection.isEmpty()){
List<SarBussionessStand> collect = intersection.stream()
.filter(item -> searchCenter.getIdList().contains(item.getId())).collect(Collectors.toList());
updList.addAll(collect);
}else{
updList.addAll(intersection);
}
}
if(!updList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "UPD".equals(searchCenter.getExecType().toUpperCase()))){
for(SarBussionessStand sarBussionessStandEO : updList){
countUpdateSuccess++;
bussAttrInfoShowSearchDetails(sarBussionessStandEO);
if (sarBussionessStandEO.getAttrInfoMap() != null) {
sarBussionessStandEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarBussionessStandEO.getAttrInfoMap()));
}
createStandMQService.sendBussStandMQ(sarBussionessStandEO,"update");
}
}
logger.info("重置企标:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(企标共:"+rowsStand.size()+"条)数据");
return Result.success("");
}else {
logger.info("未查询到企标数据");
return Result.error("未查询到企标数据");
}
}
@Async @Async
public ResponseMessage resetBussStandSearchCenter(SarBussionessStandEOPage sarBussionessStandEOPage,SearchCenter searchCenter) throws Exception{ public ResponseMessage resetBussStandSearchCenter(SarBussionessStandEOPage sarBussionessStandEOPage,SearchCenter searchCenter) throws Exception{
Boolean getbussstandIndex = elasticsearchService.isIndexExist("bussstand"); Boolean getbussstandIndex = elasticsearchService.isIndexExist("bussstand");
@@ -580,7 +909,9 @@ public class ResetSearchCenterService {
return Result.error("ES 不存在索引:bussstand"); return Result.error("ES 不存在索引:bussstand");
} }
List<Map<String, Object>> searchListData = elasticsearchService.searchAll("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> esIdList = searchListData.stream().map(stringObjectMap -> stringObjectMap.get("id").toString()).collect(Collectors.toList());
@@ -86,6 +86,12 @@ public class SarBussionessStandState extends BaseEntity {
@TableField("PARAM2") @TableField("PARAM2")
private String param2; private String param2;
@TableField(exist = false)
private String putTime;
@TableField(exist = false)
private String FSRQBUSS;
@TableField(exist = false) @TableField(exist = false)
private String QCDW; private String QCDW;
@@ -736,6 +736,22 @@ public class SarLawsStandInfoServiceImpl extends ServiceImpl<SarLawsStandInfoDao
saveUpdateLog(sarLawsStandInfo,beforeStandEO); saveUpdateLog(sarLawsStandInfo,beforeStandEO);
if (elasflag) { if (elasflag) {
attrInfoShowSearchDetails(sarLawsStandInfo,"upd"); attrInfoShowSearchDetails(sarLawsStandInfo,"upd");
FindSarItemsPageReqDTO pageInfo = new FindSarItemsPageReqDTO();
pageInfo.setStandId(sarLawsStandInfo.getId());
pageInfo.setFileType("FBGBJBD");
/**
* SarItemVO换为sarItemVOS
* List<SarItemVO> sarItemVOS = standItemsDao.querySarItemAndInterpretation(pageInfo);
* .collect(Collectors.toMap(SarItemVO::getItemsNum, SarItemVO::getItemsName));
*/
List<SarLawsItems> sarItemVOS = sarLawsItemsDao.querySarItemAndInterpretation(pageInfo);
if(!sarItemVOS.isEmpty()){
Map<String,String> collectMap = sarItemVOS.stream().filter((e) -> e.getItemsNum() != null && e.getItemsName() != null)
.collect(Collectors.toMap(SarLawsItems::getItemsNum, SarLawsItems::getTermsConditions));
sarLawsStandInfo.setMapItems(collectMap);
}
createStandMQService.sendLawsMQ(sarLawsStandInfo, "update"); createStandMQService.sendLawsMQ(sarLawsStandInfo, "update");
} }
} }
@@ -20,7 +20,45 @@
sar_bussioness_stand_state.PARAM1, sar_bussioness_stand_state.PARAM1,
sar_bussioness_stand_state.PARAM2 sar_bussioness_stand_state.PARAM2
</sql> </sql>
<sql id="Base_Column_List_buss" >
DISTINCT sar_bussioness_stand.ID,
sar_bussioness_stand.ID AS STAND_ID,
sar_bussioness_stand.stand_sort AS standSort,
sar_bussioness_stand.STAND_NAME,
sar_bussioness_stand.STAND_CODE,
sar_bussioness_stand.ISSUE_TIME,
sar_bussioness_stand.PUT_TIME,
sar_bussioness_stand.CREATION_TIME,
sar_bussioness_stand.MODIFY_TIME,
sar_bussioness_stand.VALID_FLAG
</sql>
<sql id="SarBussionInfoRole_Where_Clause_Review_Results_Buss">
where sar_bussioness_stand.TEXT_STATUS_BUSS = '9z741h2m3j' AND sar_bussioness_stand.ISSUE_TIME IS NOT NULL
<trim suffixOverrides="," >
<if test="standCode != null and standCode != '' " >
and STAND_CODE like concat(concat('%',#{standCode}),'%')
</if>
<if test="reviewTimeStart != null and reviewTimeStart != '' and reviewTimeEnd != null and reviewTimeEnd != ''">
and DATE_FORMAT(sar_buss_stand_attr_info.FSRQBUSS, '%Y-%m-%d') between DATE_FORMAT(#{reviewTimeStart}, '%Y-%m-%d') AND DATE_FORMAT(#{reviewTimeEnd}, '%Y-%m-%d')
</if>
<if test="reviewTimeStart != null and reviewTimeStart != '' and reviewTimeEnd == null and reviewTimeEnd == ''">
and DATE_FORMAT(sar_buss_stand_attr_info.FSRQBUSS,'%Y-%m-%d') &gt;= DATE_FORMAT(#{reviewTimeStart}, '%Y-%m-%d')
</if>
<if test="reviewTimeStart == null and reviewTimeStart == '' and reviewTimeEnd != null and reviewTimeEnd != ''">
and DATE_FORMAT(sar_buss_stand_attr_info.FSRQBUSS,'%Y-%m-%d') &lt;= DATE_FORMAT(#{reviewTimeEnd}, '%Y-%m-%d')
</if>
<if test="issueTimeStart != null and issueTimeStart != '' and issueTimeEnd != null and issueTimeEnd != ''">
and DATE_FORMAT(sar_bussioness_stand.ISSUE_TIME, '%Y-%m-%d') between DATE_FORMAT(#{issueTimeStart}, '%Y-%m-%d') AND DATE_FORMAT(#{issueTimeEnd}, '%Y-%m-%d')
</if>
<if test="issueTimeStart != null and issueTimeStart != '' and issueTimeEnd == null and issueTimeEnd == ''">
and DATE_FORMAT(sar_bussioness_stand.ISSUE_TIME,'%Y-%m-%d') &gt;= DATE_FORMAT(#{issueTimeStart}, '%Y-%m-%d')
</if>
<if test="issueTimeStart == null and issueTimeStart == '' and issueTimeEnd != null and issueTimeEnd != ''">
and DATE_FORMAT(sar_bussioness_stand.ISSUE_TIME,'%Y-%m-%d') &lt;= DATE_FORMAT(#{issueTimeEnd}, '%Y-%m-%d')
</if>
</trim>
</sql>
<sql id="SarBussionInfoRole_Where_Clause_Review_Results_N"> <sql id="SarBussionInfoRole_Where_Clause_Review_Results_N">
where REVIEW_RESULTS IS NULL where REVIEW_RESULTS IS NULL
AND DATE_FORMAT(REVIEW_TIME, '%Y-%m-%d') between DATE_FORMAT(current_timestamp(), '%Y-%m-%d') AND DATE_ADD(CURDATE(), INTERVAL 30 DAY) AND DATE_FORMAT(REVIEW_TIME, '%Y-%m-%d') between DATE_FORMAT(current_timestamp(), '%Y-%m-%d') AND DATE_ADD(CURDATE(), INTERVAL 30 DAY)
@@ -84,38 +122,34 @@
A.STAND_CODE, A.STAND_CODE,
A.REVIEW_TIME, A.REVIEW_TIME,
A.ISSUE_TIME, A.ISSUE_TIME,
A.REVIEW_RESULTS, A.PUT_TIME,
A.REVIEW_PROCESS_NUM,
A.CREATION_TIME, A.CREATION_TIME,
A.MODIFY_TIME, A.MODIFY_TIME,
A.VALID_FLAG, A.VALID_FLAG,
A.PARAM1,
A.PARAM2,
A.QCDW, A.QCDW,
A.QCRBUSS, A.QCRBUSS,
A.standSort A.standSort
FROM ( FROM (
select select
<include refid="Base_Column_List" />, <include refid="Base_Column_List_buss" />,
sar_buss_stand_attr_info.FSRQBUSS AS REVIEW_TIME,
sar_buss_stand_attr_info.QCDW, sar_buss_stand_attr_info.QCDW,
sar_buss_stand_attr_info.QCRBUSS, sar_buss_stand_attr_info.QCRBUSS
sar_bussioness_stand.stand_sort AS standSort from sar_bussioness_stand
from sar_bussioness_stand_state LEFT JOIN sar_buss_stand_attr_info ON sar_buss_stand_attr_info.stand_id = sar_bussioness_stand.id
LEFT JOIN sar_buss_stand_attr_info ON sar_buss_stand_attr_info.stand_id = sar_bussioness_stand_state.stand_id <include refid="SarBussionInfoRole_Where_Clause_Review_Results_Buss"/>
LEFT JOIN sar_bussioness_stand ON sar_bussioness_stand.id = sar_bussioness_stand_state.stand_id
<include refid="SarBussionInfoRole_Where_Clause_Review_Results_N"/>
ORDER BY
REVIEW_RESULTS ASC,
REVIEW_TIME DESC,
ISSUE_TIME DESC
) A ) A
ORDER BY
A.REVIEW_TIME DESC,
A.ISSUE_TIME DESC
limit ${pager.startIndex-1},${pageSize} limit ${pager.startIndex-1},${pageSize}
</select> </select>
<select id="getBussionessStandStateCountNo" resultType="java.lang.Integer" parameterType="com.adc.da.slrs.sarBussionessStandState.entity.SarBussionessStandStatePage"> <select id="getBussionessStandStateCountNo" resultType="java.lang.Integer" parameterType="com.adc.da.slrs.sarBussionessStandState.entity.SarBussionessStandStatePage">
select count(1) from ( select count(1) from (
select id from sar_bussioness_stand_state select distinct sar_bussioness_stand.id from sar_bussioness_stand
<include refid="SarBussionInfoRole_Where_Clause_Review_Results_N"/> LEFT JOIN sar_buss_stand_attr_info ON sar_buss_stand_attr_info.stand_id = sar_bussioness_stand.id
<include refid="SarBussionInfoRole_Where_Clause_Review_Results_Buss"/>
) a ) a
</select> </select>